D'CENT developer guide
Official siteUser GuideBlogTwitter
  • Introduction
  • How to Connect Your DApp to D’CENT Mobile App
  • In-app browser (dapp browser)
    • Getting Started
    • EVM compatible networks
    • Klaytn network
    • Tron network
  • Dynamic Link
    • Dynamic Link to In-app Browser
    • EIP-681 : Transaction/Payment Request
  • D'CENT WalletConnect (DWC)
    • Introduction
    • Packages
    • D'CENT WalletConnect
    • Test Environment
    • WalletConnect monorepo
  • Collectibles
    • NFT list on Collectibles tab
  • D'CENT biometric wallet for PC
    • D'CENT SDK for PC Environment
    • dcent-web-connector
      • Configurations
      • Device & Accounts Info.
      • Address & XPUB
      • Ethereum & EVM compatible
      • Klaytn
      • Bitcoin
      • XRPL (XRP Ledger)
      • Hedera (HBAR & HTS)
      • Tron (TRX & TRC20)
      • Stellar
      • Tezos (XTZ & XTZ_FA)
      • Vechain
      • Near (NEAR & Near Token)
      • Havah
      • Polkadot
      • Polkadot Parachain
      • Cosmos & Cosmos compatible network
      • Algorand
    • dcent-cli-connector
      • Configurations
      • Device & Accounts Info.
      • Address & XPUB
      • Ethereum & EVM compatible
      • Hedera (HBAR & HTS)
    • dcent-provider
  • D'CENT BIOMETRIC WALLET FOR Mobile
    • D'CENT SDK for Mobile Environment
    • dcent-biometric-sdk-android
      • Setup
      • Initialize
      • Device & Accrouts Info
      • Address & XPUB
      • Bitcoin
      • Ethereum & EVM compatible
      • Klaytn
      • XRPL
      • Binance
      • Stellar
      • Tron
      • Cardano
      • Hedera
      • Stacks
      • Solana
      • Conflux
      • Polkadot
      • Cosmos
      • Tezos
      • Vechain
      • Near
      • Havah
      • Algorand
    • dcent-biometric-sdk-ios
      • Setup
      • Initialize
      • Device & Accrouts Info
      • Address & XPUB
      • Bitcoin
      • Ethereum & EVM compatible
      • Klaytn
      • XRPL
      • Binance
      • Stellar
      • Tron
      • Cardano
      • Hedera
      • Stacks
      • Solana
      • Conflux
      • Polkadot
      • Cosmos
      • Tezos
      • Vechain
      • Near
      • Havah
      • Algorand
  • D'CENT Integrated Packages
    • Web3Modal
    • web3-onboard
  • Misc.
    • Logo & Brand Guideline
Powered by GitBook
On this page
  • Sign Transaction
  • getEthereumSignedTransaction()
  • getTokenSignedTransaction()
  • Ethereum Signed Message
  • Signed Data
  • Signed Message

Was this helpful?

  1. D'CENT biometric wallet for PC
  2. dcent-web-connector

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 DcentWebConnector.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 DcentWebConnector.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 DcentWebConnector.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"
        }
    }
}
PreviousAddress & XPUBNextKlaytn

Last updated 1 year ago

Was this helpful?