> For the complete documentation index, see [llms.txt](https://dev-docs.dcentwallet.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dev-docs.dcentwallet.com/dcent-biometric-wallet-for-pc/dcent-cli-connector/ethereum-and-evm-compatible.md).

# Ethereum & EVM compatible

## Sign Transaction

The D'CENT Web SDK provides functions for signing transaction of coins.

### **getEthereumSignedTransaction()**

#### Supported Coin Type

* ETHEREUM
* RSK
* XDC

#### Parameters

* coinType
* nonce
* gasPrice
* gasLimit
* to (address)
* value
* data
* key path for signing
* chain ID

#### Returned response object:

```json
{
    "header": {
        "version": "1.0",
        "response_from": "ethereum",
        "status": "success"
    },
    "body": {
        "command": "transaction",
        "parameter": {
            "sign_v": "0x78",
            "sign_r": "0xf9e4c3ed......9557ad37",
            "sign_s": "0x697a2abf......b76c4cb2",
            "signed": "f86c0884......b76c4cb2"
        }
    }
}
```

### getTokenSignedTransaction()

#### Supported Coin Type

* ERC20
* RRC20
* XRC20

#### Parameters

* coinType
* nonce
* gasPrice
* gasLimit
* value
* key path for signing
* chain ID
* contract information :

  ```json
  // example
  {
    name: 'OmiseGO',
    address: '0xd26114cd6EE289AccF82350c8d8487fedB8A0C07',
    to: '0x354609C4c9a15d4265cF6D94010568D5Cf4d0c1B',
    decimals: 18,
    value: '100000000000000000',
    symbol: 'OMG'
  }  
  ```

#### Returned response object

```json
{
    "header": {
        "version": "1.0",
        "response_from": "erc20",
        "status": "success"
    },
    "body": {
        "command": "transaction",
        "parameter": {
            "signed": "0xf8a91584......cc79c29a",
            "sign": {
                "sign_v": "0x26",
                "sign_r": "0x33930787......d4456f53",
                "sign_s": "0x708126c7......cc79c29a"
            }
        }
    }
}
```

## Ethereum Signed Massage

You can get a signature value to sign a user message with that private key With a given key path (BIP32). The input message is prefixed with 'Ethereum sign message' and then hashed and signed.

```javascript
var message = 'This is a message!'
var result
try {
    result = await DcentCLIConnector.getEthereumSignedMessage(message, "m/44'/60'/0'/0/0");
} catch (e) {
    console.log(e)
    result = e
}
```

#### Returned response object

```json
{
    "header": {
        "version": "1.0",
        "response_from": "ethereum",
        "status": "success"
    },
    "body": {
        "command": "msg_sign",
        "parameter": {
            "address": "0x54b9c508aC61Eaf2CD8F9cA510ec3897CfB09382",
            "sign": "0x0d935339......06a6291b"
        }
    }
}
```

## Signed Data

You can get a signature value to sign message with that private key With a given key path (BIP32). The input data is hex string format. The input data is hashed and signed.

```javascript
var message = "0x1901f2cee375fa42b42143804025fc449deafd50cc031ca257e0b194a650a912090feb4221181ff3f1a83ea7313993ca9218496e424604ba9492bb4052c03d5c3df8"
var key =  "m/44'/60'/0'/0/0"
var result
try {
    result = await dcent.getSignedData(key, message);
} catch (e) {
    console.log(e)
    result = e
}
```

#### Returned response object

```json
{
    "header": {
        "version": "1.0",
        "response_from": "ethereum",
        "status": "success"
    },
    "body": {
        "command": "sign_data",
        "parameter": {
            "address": "0x54b9c508aC61Eaf2CD8F9cA510ec3897CfB09382",
            "sign": "0x0d935339......06a6291b"
        }
    }
}
```

## Signed Message

You can get a signature value to sign a user message with that private key With a given key path (BIP32). The input message is prefixed depending on the coin type and then hashed and signed.

```javascript
var message = 'This is a message!'
var key =  "m/44'/60'/0'/0/0"
var result
try {
    result = await dcent.getSignedMessage( DcentWebConnector.coinType.ETHEREUM, key, message);
} catch (e) {
    console.log(e)
    result = e
}
```

#### Returned response object

```json
{
    "header": {
        "version": "1.0",
        "response_from": "ethereum",
        "status": "success"
    },
    "body": {
        "command": "msg_sign",
        "parameter": {
            "address": "0x54b9c508aC61Eaf2CD8F9cA510ec3897CfB09382",
            "sign": "0x0d935339......06a6291b"
        }
    }
}
```

Please Refer to the `sample/index.js` to learn more about how to use the SDK APIs. There is a node.js program using our CLI SDK.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://dev-docs.dcentwallet.com/dcent-biometric-wallet-for-pc/dcent-cli-connector/ethereum-and-evm-compatible.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
