Skip to main content

EthSigner API methods

caution
  • All JSON-RPC HTTP examples use the default host and port endpoint http://127.0.0.1:8545. If using the --http-listen-host or --http-listen-port options, update the endpoint.
  • The examples use Hyperledger Besu, but any Ethereum client can be used.

EEA methods

eea_sendTransaction

Creates and signs a private transaction using the signing key.

EthSigner submits the signed transaction to Besu using eea_sendRawTransaction.

note

Besu uses a Transaction Manager to implement privacy. Tessera is the Transaction Manager used in this documentation but EthSigner can be used with other Transaction Managers.

Parameters

Transaction object for private transactions:

KeyTypeRequired/OptionalValue
fromData, 20 bytesRequiredAddress of the sender. Must be the address of the keystore account.
toData, 20 bytesNot required for contract creationnull for contract creation transaction. Contract address for contract invocation transactions.
gasQuantityOptionalGas provided by the sender. Default is 90000.
gasPriceQuantityOptionalGas price provided by the sender in Wei. Default is 0.
nonceQuantityOptionalNumber of transactions sent from the from account before this one.
dataQuantityOptionalCompiled contract code or hash of the invoked method signature and encoded parameters.
privateFromData, 20 bytesRequiredTessera address of the sender
privateFor or privacyGroupIdArray of data or dataRequiredTessera addresses of recipients or privacy group ID
restrictionStringRequiredMust be restricted
tip

Submitting a transaction with the same nonce as a pending transaction and a higher gas price replaces the pending transaction with the new one. Use priv_getTransactionCount to calculate the nonce.

If not attempting to replace a pending transaction, do not include the nonce in the private transaction object and nonce management is handled automatically.

note

If a non-zero value is included in the transaction object, an error is returned. Ether transfers cannot be private transactions.

Returns

result : data - Transaction hash

info
curl -X POST --data '{"jsonrpc":"2.0","method":"eea_sendTransaction","params":[{"from": "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73","data": "0x608060405234801561001057600080fd5b5060dc8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680633fa4f24514604e57806355241077146076575b600080fd5b348015605957600080fd5b50606060a0565b6040518082815260200191505060405180910390f35b348015608157600080fd5b50609e6004803603810190808035906020019092919050505060a6565b005b60005481565b80600081905550505600a165627a7a723058202bdbba2e694dba8fff33d9d0976df580f57bff0a40e25a46c398f8063b4c00360029", "privateFrom": "negmDcN2P4ODpqn/6WkJ02zT/0w0bjhGpkZ8UP6vARk=","privateFor": ["g59BmTeJIn7HIcnq8VQWgyh/pDbvbt2eyP0Ii60aDDw="],"restriction": "restricted"}], "id":1}' http://127.0.0.1:8545

Eth methods

eth_accounts

Returns the account address with which EthSigner is signing transactions. That is, the account of the signing key.

Returns multiple accounts if multiple signers are configured.

Parameters

None

Returns

Array of data : Account address with which EthSigner is signing transactions.

info
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_accounts","params":[],"id":1}' http://127.0.0.1:8545

eth_sendTransaction

Creates and signs a transaction using the signing key.

EthSigner submits the signed transaction to Besu using eth_sendRawTransaction.

Parameters

Transaction object:

KeyTypeRequired/OptionalValue
fromData, 20 bytesRequiredAddress of the sender.
toData, 20 bytesOptional for contract creationAddress of the receiver. null if a contract creation transaction.
gasQuantityOptionalGas provided by the sender. Default is 90000.
gasPriceQuantityOptionalGas price provided by the sender in Wei. Default is 0.
nonceQuantityOptionalNumber of transactions made by the sender before this one. Must be specified if using GoQuorum.
valueQuantityOptionalValue transferred in Wei.
dataQuantityOptionalCompiled contract code or hash of the invoked method signature and encoded parameters.
tip

Submitting a transaction with the same nonce as a pending transaction and a higher gas price replaces the pending transaction with the new one.

Returns

result : data - 32-byte transaction hash

info
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_sendTransaction","params":[{"from": "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73","to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567","gas": "0x7600","gasPrice": "0x9184e72a000","value": "0x9184e72a"}], "id":1}' http://127.0.0.1:8545

eth_sign

Calculates an Ethereum specific signature using sign(keccak256("\x19Ethereum Signed Message:\n" + len(message) + message)))."

Adds a prefix to the message that makes the calculated signature recognizable as an Ethereum specific signature. This prevents misuse where a malicious DApp signs arbitrary data (for example a transaction) and uses the signature to impersonate the victim.

Parameters

DATA : 20-byte account address

DATA : data string to sign

Returns

DATA : Signature

info
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_sign","params":["0x78e6e236592597c09d5c137c2af40aecd42d12a2", "0x2eadbe1f"], "id":1}' http://127.0.0.1:8545

eth_signTransaction

Signs a transaction that can be submitted to Besu at a later time using eth_sendRawTransaction.

Parameters

Transaction object:

KeyTypeRequired/OptionalValue
fromData, 20 bytesRequiredAddress of the sender.
toData, 20 bytesOptional for contract creationAddress of the receiver. null if a contract creation transaction.
gasQuantityOptionalGas provided by the sender. Default is 90000.
gasPriceQuantityOptionalGas price provided by the sender in Wei. Default is 0.
nonceQuantityOptionalNumber of transactions made by the sender before this one. Must be specified if using GoQuorum.
valueQuantityOptionalValue transferred in Wei.
dataQuantityOptionalCompiled contract code or hash of the invoked method signature and encoded parameters.

Returns

result : data - The signed transaction object.

info
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_signTransaction","params":[{"from": "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73","to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567","gas": "0x7600","gasPrice": "0x9184e72a000","value": "0x9184e72a", "nonce":"0x46"}], "id":1}' http://127.0.0.1:8545