Links

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:

{
"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 :
    // example
    {
    name: 'OmiseGO',
    address: '0xd26114cd6EE289AccF82350c8d8487fedB8A0C07',
    to: '0x354609C4c9a15d4265cF6D94010568D5Cf4d0c1B',
    decimals: 18,
    value: '100000000000000000',
    symbol: 'OMG'
    }

Returned response object

{
"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 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 with 'Ethereum sign message' and then hashed and signed.
var message = 'This is a message!'
var result
try {
result = await dcent.getEthereumSignedMessage(message, "m/44'/60'/0'/0/0");
} catch (e) {
console.log(e)
result = e
}
Returned response object has:
{
"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.
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 has:
{
"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.
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 has:
{
"header": {
"version": "1.0",
"response_from": "ethereum",
"status": "success"
},
"body": {
"command": "msg_sign",
"parameter": {
"address": "0x54b9c508aC61Eaf2CD8F9cA510ec3897CfB09382",
"sign": "0x0d935339......06a6291b"
}
}
}