Skip to main content
Reown Docs

Ethereum

Ethereum JSON-RPC Methods
4 min read

personal_sign#

The sign method calculates an Ethereum specific signature with:sign(keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))).

By adding a prefix to the message makes the calculated signature recognizable as an Ethereum specific signature. This prevents misuse where a malicious DApp can sign arbitrary data (e.g. transaction) and use the signature to impersonate the victim.

Note See ecRecover to verify the signature.

Parameters#

message, account

  1. DATA, N Bytes - message to sign.
  2. DATA, 20 Bytes - address.

Returns#

DATA: Signature

Example#

eth_sign#

The sign method calculates an Ethereum specific signature with: sign(keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))).

By adding a prefix to the message makes the calculated signature recognizable as an Ethereum specific signature. This prevents misuse where a malicious DApp can sign arbitrary data (e.g. transaction) and use the signature to impersonate the victim.

Note the address to sign with must be unlocked.

Parameters#

account, message

  1. DATA, 20 Bytes - address.
  2. DATA, N Bytes - message to sign.

Returns#

DATA: Signature

Example#

An example how to use solidity ecrecover to verify the signature calculated with eth_sign can be found here. The contract is deployed on the testnet Ropsten and Rinkeby.

eth_signTypedData#

Calculates an Ethereum-specific signature in the form of keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))

By adding a prefix to the message makes the calculated signature recognizable as an Ethereum specific signature. This prevents misuse where a malicious DApp can sign arbitrary data (e.g. transaction) and use the signature to impersonate the victim.

Note the address to sign with must be unlocked.

Parameters#

account, message

  1. DATA, 20 Bytes - address.
  2. DATA, N Bytes - message to sign containing type information, a domain separator, and data

Example Parameters#

Returns#

DATA: Signature

Example#

eth_sendTransaction#

Creates new message call transaction or a contract creation, if the data field contains code.

Parameters#

  1. Object - The transaction object
  2. from: DATA, 20 Bytes - The address the transaction is send from.
  3. to: DATA, 20 Bytes - (optional when creating new contract) The address the transaction is directed to.
  4. data: DATA - The compiled code of a contract OR the hash of the invoked method signature and encoded parameters. For details see Ethereum Contract ABI
  5. gas: QUANTITY - (optional, default: 90000) Integer of the gas provided for the transaction execution. It will return unused gas.
  6. gasPrice: QUANTITY - (optional, default: To-Be-Determined) Integer of the gasPrice used for each paid gas
  7. value: QUANTITY - (optional) Integer of the value sent with this transaction
  8. nonce: QUANTITY - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce.

Example Parameters#

Returns#

DATA, 32 Bytes - the transaction hash, or the zero hash if the transaction is not yet available.

Use eth_getTransactionReceipt to get the contract address, after the transaction was mined, when you created a contract.

Example#

eth_signTransaction#

Signs a transaction that can be submitted to the network at a later time using with eth_sendRawTransaction

Parameters#

  1. Object - The transaction object
  2. from: DATA, 20 Bytes - The address the transaction is send from.
  3. to: DATA, 20 Bytes - (optional when creating new contract) The address the transaction is directed to.
  4. data: DATA - The compiled code of a contract OR the hash of the invoked method signature and encoded parameters. For details see Ethereum Contract ABI
  5. gas: QUANTITY - (optional, default: 90000) Integer of the gas provided for the transaction execution. It will return unused gas.
  6. gasPrice: QUANTITY - (optional, default: To-Be-Determined) Integer of the gasPrice used for each paid gas
  7. value: QUANTITY - (optional) Integer of the value sent with this transaction
  8. nonce: QUANTITY - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce.

Example Parameters#

Returns#

DATA - the signed transaction data

Example#

eth_sendRawTransaction#

Creates new message call transaction or a contract creation for signed transactions.

Parameters#

  1. DATA, the signed transaction data.

Returns#

DATA, 32 Bytes - the transaction hash, or the zero hash if the transaction is not yet available.

Use eth_getTransactionReceipt to get the contract address, after the transaction was mined, when you created a contract.

Example#