⚠️Blast API (blastapi.io) ends Oct 31. Migrate to Dwellir and skip Alchemy's expensive compute units.
Switch Today →
Skip to main content

eth_signTransaction

Signs a transaction that can be submitted to the network at a later time using with eth_sendRawTransaction on Avalanche C-Chain.

Parameters

  1. Object - The transaction object
    • from: DATA, 20 Bytes - The address the transaction is sent from.
    • to: DATA, 20 Bytes - (optional when creating new contract) The address the transaction is directed to.
    • gas: QUANTITY - (optional, default: 90000) Integer of the gas provided for the transaction execution.
    • gasPrice: QUANTITY - (optional, default: To-Be-Determined) Integer of the gasPrice used for each paid gas.
    • value: QUANTITY - (optional) Integer of the value sent with this transaction.
    • data: DATA - The compiled code of a contract OR the hash of the invoked method signature and encoded parameters.
    • nonce: QUANTITY - (optional) Integer of a nonce.
{
"jsonrpc": "2.0",
"method": "eth_signTransaction",
"params": [
{
"from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"gas": "0x76c0",
"gasPrice": "0x9184e72a000",
"value": "0x9184e72a"
}
],
"id": 1
}

Returns

Object - The signed transaction object.

Implementation Example

curl -X POST https://api-avalanche-mainnet-archive.n.dwellir.com/YOUR_API_KEY/ext/bc/C/rpc \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_signTransaction",
"params": [
{
"from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"gas": "0x76c0",
"gasPrice": "0x9184e72a000",
"value": "0x9184e72a"
}
],
"id": 1
}'

Response Example

{
"id": 1,
"jsonrpc": "2.0",
"result": {
"raw": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675",
"tx": {
"hash": "0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b",
"nonce": "0x0",
"blockHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"blockNumber": "0x0",
"transactionIndex": "0x0",
"from": "0x407d73d8a49eeb85d32cf465507dd71d507100c1",
"to": "0x85h43d8a49eeb85d32cf465507dd71d507100c1",
"value": "0x7f110",
"gas": "0x7f110",
"gasPrice": "0x09184e72a000",
"input": "0x603880600c6000396000f300603880600c6000396000f3603880600c6000396000f360"
}
}
}

Note: This method requires access to the private key for the 'from' address and returns the signed transaction that can be broadcast later.


Need help? Contact our support team or check the Avalanche documentation.