🌳
Arbitrum API
All of the Arbitrum JSON-RPC API methods that are supported by Alchemy.
For more information on Arbitrum's API check out the official documentation.
HINT: If you click on the "Example" title you can try out all the example requests in real-time using our Composer tool, however all the example requests are on Ethereum mainnet, to switch to Arbitrum simply toggle the "network" dropdown.
Query methods with a block number argument more than 20 blocks behind latest are currently not supported on Arbitrum.

Mainnet vs. Testnet

There are two networks on Arbitrum: Mainnet and Rinkeby testnet. The endpoints are as follows:
    Mainnet: https://arb-mainnet.g.alchemy.com/v2/your-api-key
    Rinkeby: https://arb-rinkeby.g.alchemy.com/v2/your-api-key

​
πŸ“¦
Retrieving Blocks

Calls related to retrieving blocks and block information.

eth_blockNumber

Returns the number of the most recent block.

Parameters

none

Returns

QUANTITY - integer of the current block number the client is on.

​Example​

Request
Curl
Postman
1
curl https://arb-mainnet.g.alchemy.com/v2/your-api-key \
2
-X POST \
3
-H "Content-Type: application/json" \
4
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":0}'
Copied!
1
URL: https://arb-mainnet.g.alchemy.com/v2/your-api-key
2
RequestType: POST
3
Body:
4
{
5
"jsonrpc":"2.0",
6
"method":"eth_blockNumber",
7
"params":[],
8
"id":0
9
}
Copied!
Result
1
{
2
"jsonrpc": "2.0",
3
"id": 0,
4
"result": "0xa1c054"
5
}
Copied!

eth_getBlockByHash

Returns information about a block by hash.

Parameters

    DATA, 32 Bytes - Hash of a block.
    Boolean - If true it returns the full transaction objects, if false it returns only the hashes of the transactions.
1
params: [
2
'0xc0f4906fea23cf6f3cce98cb44e8e1449e455b28d684dfa9ff65426495584de6',
3
true
4
]
Copied!

Returns

Object - A block object with the following fields, or null when no block was found:
    number: QUANTITY - the block number. null when its pending block.
    hash: DATA, 32 Bytes - hash of the block. null when its pending block.
    parentHash: DATA, 32 Bytes - hash of the parent block.
    nonce: DATA, 8 Bytes - hash of the generated proof-of-work. null when its pending block.
    sha3Uncles: DATA, 32 Bytes - SHA3 of the uncles data in the block.
    logsBloom: DATA, 256 Bytes - the bloom filter for the logs of the block. null when its pending block.
    transactionsRoot: DATA, 32 Bytes - the root of the transaction trie of the block.
    stateRoot: DATA, 32 Bytes - the root of the final state trie of the block.
    receiptsRoot: DATA, 32 Bytes - the root of the receipts trie of the block.
    miner: DATA, 20 Bytes - the address of the beneficiary to whom the mining rewards were given.
    difficulty: QUANTITY - integer of the difficulty for this block.
    totalDifficulty: QUANTITY - integer of the total difficulty of the chain until this block.
    extraData: DATA - the "extra data" field of this block.
    size: QUANTITY - integer the size of this block in bytes.
    gasLimit: QUANTITY - the maximum gas allowed in this block.
    gasUsed: QUANTITY - the total used gas by all transactions in this block.
    timestamp: QUANTITY - the unix timestamp for when the block was collated.
    transactions: Array - Array of transaction objects, or 32 Bytes transaction hashes depending on the last given parameter.
    uncles: Array - Array of uncle hashes.

​Example​

Request
Curl
Postman
1
curl https://arb-mainnet.g.alchemy.com/v2/your-api-key\
2
-X POST \
3
-H "Content-Type: application/json" \
4
-d '{"jsonrpc":"2.0","method":"eth_getBlockByHash","params":["0xc0f4906fea23cf6f3cce98cb44e8e1449e455b28d684dfa9ff65426495584de6", true],"id":0}'
Copied!
1
URL: https://arb-mainnet.g.alchemy.com/v2/your-api-key
2
RequestType: POST
3
Body:
4
{
5
"jsonrpc":"2.0",
6
"method":"eth_getBlockByHash",
7
"params":["0xc0f4906fea23cf6f3cce98cb44e8e1449e455b28d684dfa9ff65426495584de6", true],
8
"id":0
9
}
Copied!
Result
1
{
2
"jsonrpc": "2.0",
3
"id": 0,
4
"result": {
5
"difficulty": "0x2d50ba175407",
6
"extraData": "0xe4b883e5bda9e7a59ee4bb99e9b1bc",
7
"gasLimit": "0x47e7c4",
8
"gasUsed": "0x5208",
9
"hash": "0xc0f4906fea23cf6f3cce98cb44e8e1449e455b28d684dfa9ff65426495584de6",
10
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
11
"miner": "0x61c808d82a3ac53231750dadc13c777b59310bd9",
12
"mixHash": "0xc38853328f753c455edaa4dfc6f62a435e05061beac136c13dbdcd0ff38e5f40",
13
"nonce": "0x3b05c6d5524209f1",
14
"number": "0x1e8480",
15
"parentHash": "0x57ebf07eb9ed1137d41447020a25e51d30a0c272b5896571499c82c33ecb7288",
16
"receiptsRoot": "0x84aea4a7aad5c5899bd5cfc7f309cc379009d30179316a2a7baa4a2ea4a438ac",
17
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
18
"size": "0x28a",
19
"stateRoot": "0x96dbad955b166f5119793815c36f11ffa909859bbfeb64b735cca37cbf10bef1",
20
"timestamp": "0x57a1118a",
21
"totalDifficulty": "0x262c34a6fd1268f6c",
22
"transactions": [
23
"0xc55e2b90168af6972193c1f86fa4d7d7b31a29c156665d15b9cd48618b5177ef"
24
],
25
"transactionsRoot": "0xb31f174d27b99cdae8e746bd138a01ce60d8dd7b224f7c60845914def05ecc58",
26
"uncles": []
27
}
28
}
Copied!

eth_getBlockByNumber

Returns information about a block by block number.

Parameters

    QUANTITY|TAG - integer of a block number, or the string "earliest", "latest" or "pending", as in the default block parameter.
    Boolean - If true it returns the full transaction objects, if false only the hashes of the transactions.
1
params: [
2
'0x1b4',
3
true
4
]
Copied!

Returns

​Example​

Request
Curl
Postman
1
curl https://arb-mainnet.g.alchemy.com/v2/your-api-key \
2
-X POST \
3
-H "Content-Type: application/json" \
4
-d '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x1b4", true],"id":0}'
Copied!
1
URL: https://arb-mainnet.g.alchemy.com/v2/your-api-key
2
RequestType: POST
3
Body:
4
{
5
"jsonrpc":"2.0",
6
"method":"eth_getBlockByNumber",
7
"params":["0x1b4", true],
8
"id":0
9
}
Copied!
Result
1
{
2
"jsonrpc": "2.0",
3
"id": 0,
4
"result": {
5
"number": "0x1b4",
6
"difficulty": "0x4ea3f27bc",
7
"extraData": "0x476574682f4c5649562f76312e302e302f6c696e75782f676f312e342e32",
8
"gasLimit": "0x1388",
9
"gasUsed": "0x0",
10
"hash": "0xdc0818cf78f21a8e70579cb46a43643f78291264dda342ae31049421c82d21ae",
11
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
12
"miner": "0xbb7b8287f3f0a933474a79eae42cbca977791171",
13
"mixHash": "0x4fffe9ae21f1c9e15207b1f472d5bbdd68c9595d461666602f2be20daf5e7843",
14
"nonce": "0x689056015818adbe",
15
"parentHash": "0xe99e022112df268087ea7eafaf4790497fd21dbeeb6bd7a1721df161a6657a54",
16
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
17
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
18
"size": "0x220",
19
"stateRoot": "0xddc8b0234c2e0cad087c8b389aa7ef01f7d79b2570bccb77ce48648aa61c904d",
20
"timestamp": "0x55ba467c",
21
"totalDifficulty": "0x78ed983323d",
22
"transactions": [],
23
"transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
24
"uncles": []
25
}
26
}
Copied!

​
🧾
Reading Transactions

Calls for reading transactions.

eth_getTransactionByHash

Returns the information about a transaction requested by transaction hash. In the response object, blockHash, blockNumber, and transactionIndex are null when the transaction is pending.

Parameters

DATA, 32 Bytes - hash of a transaction
1
params: [
2
"0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b"
3
]
Copied!

Returns

Object - A transaction object, or null when no transaction was found:
    blockHash: DATA, 32 Bytes - hash of the block where this transaction was in. null when its pending.
    blockNumber: QUANTITY - block number where this transaction was in. null when it's pending.
    from: DATA, 20 Bytes - address of the sender.
    gas: QUANTITY - gas provided by the sender.
    gasPrice: QUANTITY - gas price provided by the sender in Wei.
    hash: DATA, 32 Bytes - hash of the transaction.
    input: DATA - the data send along with the transaction.
    nonce: QUANTITY - the number of transactions made by the sender prior to this one.
    to: DATA, 20 Bytes - address of the receiver. null when it's a contract creation transaction.
    transactionIndex: QUANTITY - integer of the transactions index position in the block. null when its pending.
    value: QUANTITY - value transferred in Wei.
    v: QUANTITY - ECDSA recovery id
    r: DATA, 32 Bytes - ECDSA signature r
    s: DATA, 32 Bytes - ECDSA signature s

​Example​

Request
Curl
Postman
1
curl https://arb-mainnet.g.alchemy.com/v2/your-api-key \
2
-X POST \
3
-H "Content-Type: application/json" \
4
-d'{"jsonrpc":"2.0","method":"eth_getTransactionByHash","params":["0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b"],"id":0}'
Copied!
1
URL: https://arb-mainnet.g.alchemy.com/v2/your-api-key
2
RequestType: POST
3
Body:
4
{
5
"jsonrpc":"2.0",
6
"method":"eth_getTransactionByHash",
7
"params":["0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b"],
8
"id":0
9
}
Copied!
Result
1
{
2
"jsonrpc": "2.0",
3
"id": 0,
4
"result": {
5
"hash": "0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b",
6
"blockHash": "0x1d59ff54b1eb26b013ce3cb5fc9dab3705b415a67127a003c3e61eb445bb8df2",
7
"blockNumber": "0x5daf3b",
8
"from": "0xa7d9ddbe1f17865597fbd27ec712455208b6b76d",
9
"gas": "0xc350",
10
"gasPrice": "0x4a817c800",
11
"input": "0x68656c6c6f21",
12
"nonce": "0x15",
13
"r": "0x1b5e176d927f8e9ab405058b2d2457392da3e20f328b16ddabcebc33eaac5fea",
14
"s": "0x4ba69724e8f69de52f0125ad8b3c5c2cef33019bac3249e2c0a2192766d1721c",
15
"to": "0xf02c1c8e6114b1dbe8937a39260b5b0a374432bb",
16
"transactionIndex": "0x41",
17
"v": "0x25",
18
"value": "0xf3dbb76162000"
19
}
20
}
Copied!

eth_getTransactionCount

Returns the number of transactions sent from an address.

Parameters

    DATA, 20 Bytes - address.
    QUANTITY|TAG - integer block number, or the string "latest", "earliest" or "pending", see the default block parameter.
1
params: [
2
'0xc94770007dda54cF92009BFF0dE90c06F603a09f',
3
'latest' // state at the latest block
4
]
Copied!

Returns

QUANTITY - integer of the number of transactions send from this address.

​Example​

Request
Curl
Postman
1
curl https://arb-mainnet.g.alchemy.com/v2/your-api-key \
2
-X POST \
3
-H "Content-Type: application/json" \
4
-d '{"jsonrpc":"2.0","method":"eth_getTransactionCount","params":["0xc94770007dda54cF92009BFF0dE90c06F603a09f","latest"],"id":0}'
Copied!
1
URL: https://arb-mainnet.g.alchemy.com/v2/your-api-key
2
RequestType: POST
3
Body:
4
{
5
"jsonrpc":"2.0",
6
"method":"eth_getTransactionCount",
7
"params":["0xc94770007dda54cF92009BFF0dE90c06F603a09f","latest"],
8
"id":0
9
}
Copied!
Result
1
{
2
"jsonrpc": "2.0",
3
"id": 0,
4
"result": "0x219"
5
}
Copied!

eth_getTransactionReceipt

Returns the receipt of a transaction by transaction hash.
This can also be used to track the status of a transaction, since result will be null until the transaction is mined. However, unlike eth_getTransactionByHash , which returns null for unknown transactions, and a non-null response with 3 null fields for a pending transaction, eth_getTransactionReceipt returns null for both pending and unknown transactions.
This call is also commonly used to get the contract address for a contract creation tx.
Note: the receipt is not available for pending transactions.

Parameters

DATA, 32 Bytes - hash of a transaction
1
params: [
2
'0xab059a62e22e230fe0f56d8555340a29b2e9532360368f810595453f6fdd213b'
3
]
Copied!

Returns

Object - A transaction receipt object, or null when no receipt was found:
    transactionHash: DATA, 32 Bytes - hash of the transaction.
    transactionIndex: QUANTITY - integer of the transactions index position in the block.
    blockHash: DATA, 32 Bytes - hash of the block where this transaction was in.
    blockNumber: QUANTITY - block number where this transaction was in.
    from: DATA, 20 Bytes - address of the sender.
    to: DATA, 20 Bytes - address of the receiver. null when its a contract creation transaction.
    cumulativeGasUsed: QUANTITY - The total amount of gas used when this transaction was executed in the block.
    gasUsed: QUANTITY - The amount of gas used by this specific transaction alone.
    contractAddress: DATA, 20 Bytes - The contract address created, if the transaction was a contract creation, otherwise null.
    logs: Array - Array of log objects, which this transaction generated.
    logsBloom: DATA, 256 Bytes - Bloom filter for light clients to quickly retrieve related logs.
It also returns either:
    root : DATA 32 bytes of post-transaction stateroot (pre Byzantium)
    status: QUANTITY either 1 (success) or 0 (failure)

​Example​

Request
Curl
Postman
1
curl https://arb-mainnet.g.alchemy.com/v2/your-api-key \
2
-X POST \
3
-H "Content-Type: application/json" \
4
-d '{"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["0xab059a62e22e230fe0f56d8555340a29b2e9532360368f810595453f6fdd213b"],"id":0}
Copied!
1
URL: https://arb-mainnet.g.alchemy.com/v2/your-api-key
2
RequestType: POST
3
Body:
4
{
5
"jsonrpc":"2.0",
6
"method":"eth_getTransactionReceipt",
7
"params":["0xab059a62e22e230fe0f56d8555340a29b2e9532360368f810595453f6fdd213b"],
8
"id":0
9
}
Copied!
Result
1
{
2
"jsonrpc": "2.0",
3
"id": 0,
4
"result": {
5
"transactionHash": "0xab059a62e22e230fe0f56d8555340a29b2e9532360368f810595453f6fdd213b",
6
"blockHash": "0x8243343df08b9751f5ca0c5f8c9c0460d8a9b6351066fae0acbd4d3e776de8bb",
7
"blockNumber": "0x429d3b",
8
"contractAddress": null,
9
"cumulativeGasUsed": "0x64b559",
10
"from": "0x00b46c2526e227482e2ebb8f4c69e4674d262e75",
11
"gasUsed": "0xcaac",
12
"logs": [
13
{
14
"blockHash": "0x8243343df08b9751f5ca0c5f8c9c0460d8a9b6351066fae0acbd4d3e776de8bb",
15
"address": "0xb59f67a8bff5d8cd03f6ac17265c550ed8f33907",
16
"logIndex": "0x56",
17
"data": "0x000000000000000000000000000000000000000000000000000000012a05f200",
18
"removed": false,
19
"topics": [
20
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
21
"0x00000000000000000000000000b46c2526e227482e2ebb8f4c69e4674d262e75",
22
"0x00000000000000000000000054a2d42a40f51259dedd1978f6c118a0f0eff078"
23
],
24
"blockNumber": "0x429d3b",
25
"transactionIndex": "0xac",
26
"transactionHash": "0xab059a62e22e230fe0f56d8555340a29b2e9532360368f810595453f6fdd213b"
27
}
28
],
29
"logsBloom": "0x00000000040000000000000000000000000000000000000000000000000000080000000010000000000000000000000000000000000040000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000010100000000000000000000000000004000000000000200000000000000000000000000000000000000000000",
30
"root": "0x3ccba97c7fcc7e1636ce2d44be1a806a8999df26eab80a928205714a878d5114",
31
"status": null,
32
"to": "0xb59f67a8bff5d8cd03f6ac17265c550ed8f33907",
33
"transactionIndex": "0xac"
34
}
35
}
Copied!

eth_getBlockTransactionCountByHash

Returns the number of transactions in a block matching the given block hash.

Parameters

    DATA, 32 Bytes - hash of a block.
    1
    params: [
    2
    '0x8243343df08b9751f5ca0c5f8c9c0460d8a9b6351066fae0acbd4d3e776de8bb'
    3
    ]
    Copied!

Returns

    QUANTITY - integer of the number of transactions in this block.

​Example​

Request
Curl
Postman
1
curl https://arb-mainnet.g.alchemy.com/v2/your-api-key \
2
-X POST \
3
-H "Content-Type: application/json" \
4
-d '{"jsonrpc":"2.0","method":"eth_getBlockTransactionCountByHash","params":["0x8243343df08b9751f5ca0c5f8c9c0460d8a9b6351066fae0acbd4d3e776de8bb"],"id":0}'
Copied!
1
URL: https://arb-mainnet.g.alchemy.com/v2/your-api-key
2
RequestType: POST
3
Body:
4
{
5
"jsonrpc":"2.0",
6
"method":"eth_getBlockTransactionCountByHash",
7
"params":["0x8243343df08b9751f5ca0c5f8c9c0460d8a9b6351066fae0acbd4d3e776de8bb"],
8
"id":0
9
}
Copied!
Result
1
{
2
"jsonrpc": "2.0",
3
"id": 0,
4
"result": "0xb0"
5
}
Copied!

eth_getBlockTransactionCountByNumber

Returns the number of transactions in a block matching the given block number.

Parameters

    QUANTITY|TAG - integer of a block number, or the string "earliest", "latest" or "pending", as in the default block parameter.
1
params: [
2
'latest',
3
]
Copied!

Returns

    QUANTITY - integer of the number of transactions in this block.

​Example​

Request
Curl
Postman
1
curl https://arb-mainnet.g.alchemy.com/v2/your-api-key \
2
-X POST \
3
-H "Content-Type: application/json" \
4
-d '{"jsonrpc":"2.0","method":"eth_getBlockTransactionCountByNumber","params":["latest"],"id":0}'
Copied!
1
URL: https://arb-mainnet.g.alchemy.com/v2/your-api-key
2
RequestType: POST
3
Body:
4
{
5
"jsonrpc":"2.0",
6
"method":"eth_getBlockTransactionCountByNumber",
7
"params":["latest"],
8
"id":0
9
}
Copied!
Result
1
{
2
"jsonrpc": "2.0",
3
"id": 0,
4
"result": "0xee"
5
}
Copied!

eth_getTransactionByBlockHashAndIndex

Returns information about a transaction by block hash and transaction index position.

Parameters

DATA, 32 Bytes - hash of a block.
QUANTITY - integer of the transaction index position.
1
params: [
2
'0xc0f4906fea23cf6f3cce98cb44e8e1449e455b28d684dfa9ff65426495584de6',
3
'0x0' // 0
4
]
Copied!

Returns

​Example​

Request
Curl
Postman
1
curl https://arb-mainnet.g.alchemy.com/v2/your-api-key \
2
-X POST \
3
-H "Content-Type: application/json" \
4
-d '{"jsonrpc":"2.0","method":"eth_getTransactionByBlockHashAndIndex","params":["0xc0f4906fea23cf6f3cce98cb44e8e1449e455b28d684dfa9ff65426495584de6", "0x0"],"id":0}'
Copied!
1
URL: https://arb-mainnet.g.alchemy.com/v2/your-api-key
2
RequestType: POST
3
Body:
4
{
5
"jsonrpc":"2.0",
6
"method":"eth_getTransactionByBlockHashAndIndex",
7
"params":["0xc0f4906fea23cf6f3cce98cb44e8e1449e455b28d684dfa9ff65426495584de6", "0x0"],
8
"id":0
9
}
Copied!
Result
1
{
2
"jsonrpc": "2.0",
3
"id": 0,
4
"result": {
5
"blockHash": "0xc0f4906fea23cf6f3cce98cb44e8e1449e455b28d684dfa9ff65426495584de6",
6
"blockNumber": "0x1e8480",
7
"from": "0x32be343b94f860124dc4fee278fdcbd38c102d88",
8
"gas": "0x51615",
9
"gasPrice": "0x6fc23ac00",
10
"hash": "0xc55e2b90168af6972193c1f86fa4d7d7b31a29c156665d15b9cd48618b5177ef",
11
"input": "0x",
12
"nonce": "0x1efc5",
13
"to": "0x104994f45d9d697ca104e5704a7b77d7fec3537c",
14
"transactionIndex": "0x0",
15
"value": "0x821878651a4d70000",
16
"v": "0x1b",
17
"r": "0x51222d91a379452395d0abaff981af4cfcc242f25cfaf947dea8245a477731f9",
18
"s": "0x3a997c910b4701cca5d933fb26064ee5af7fe3236ff0ef2b58aa50b25aff8ca5"
19
}
20
}
Copied!

eth_getTransactionByBlockNumberAndIndex

Returns information about a transaction by block number and transaction index position.

Parameters

    QUANTITY|TAG - a block number, or the string "earliest", "latest" or "pending", as in the default block parameter.
    QUANTITY - the transaction index position.
1
params: [
2
'latest', // 668
3
'0x0' // 0
4
]
Copied!

Returns

​Example​

Request
Curl
Postman
1
curl https://arb-mainnet.g.alchemy.com/v2/your-api-key \
2
-X POST \
3
-H "Content-Type: application/json" \
4
-d '{"jsonrpc":"2.0","method":"eth_getTransactionByBlockNumberAndIndex","params":["latest", "0x0"],"id":0}'
Copied!
1
URL: https://arb-mainnet.g.alchemy.com/v2/your-api-key
2
RequestType: POST
3
Body:
4
{
5
"jsonrpc":"2.0",
6
"method":"eth_getTransactionByBlockNumberAndIndex",
7
"params":["latest", "0x0"],
8
"id":0
9
}
Copied!
Result
1
{
2
"jsonrpc": "2.0",
3
"id": 0,
4
"result": {
5
"blockHash": "0xf345d6ac2cb6290489915178fef0b2fc7f5a7312dd06773c77532de6740b2b4d",
6
"blockNumber": "0xa1c0ff",
7
"from": "0x79c384ac9c32e90f00a214c77caac1392ec8cdea",
8
"gas": "0xafbe",
9
"gasPrice": "0x1270b01800",
10
"hash": "0x61b27f711f58ee3090c0976c7e90d2b7eafeb7b889f0db593234f04f8ce07f22",
11
"input": "0xa9059cbb0000000000000000000000004b1a99467a284cc690e3237bc69105956816f7620000000000000000000000000000000000000000000000000000001919617600",
12
"nonce": "0xa",
13
"to": "0xf9e5af7b42d31d51677c75bbbd37c1986ec79aee",
14
"transactionIndex": "0x0",
15
"value": "0x0",
16
"v": "0x1b",
17
"r": "0x2123cdbd1130f726ebed55fd2295239778dd4161495d2733f374d7863fc42ab1",
18
"s": "0x1f08fd53ff2c3969b88d5e622561d62a799ae68e36f5142689dbfde44bbe1bed"
19
}
20
}
Copied!

​
✍
Writing Transactions

Call to write to the blockchain.

eth_sendRawTransaction

Creates a new message call transaction or a contract creation for signed transactions.
Alchemy does not store keys, so transactions sent via Alchemy must be signed ahead of time using another provider like ethers (via eth_signTransaction) and sent with eth_sendRawTransaction.

Parameters

DATA, The signed transaction data.
1
params: ["0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"]
Copied!

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​

Note: Since eth_sendRawTransaction is a request used for writing to the blockchain and changes its state, it is impossible to execute the same request twice. This means if you were to copy the example given below you will not get the expected response.
Request
Curl
Postman
1
curl https://arb-mainnet.g.alchemy.com/v2/your-api-key \
2
-X POST \
3
-H "Content-Type: application/json" \
4
-d '{"jsonrpc":"2.0","method":"eth_sendRawTransaction","params":["0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"],"id":1}'
Copied!
1
URL: https://arb-mainnet.g.alchemy.com/v2/your-api-key
2
RequestType: POST
3
Body:
4
{
5
"jsonrpc":"2.0",
6
"method":"eth_sendRawTransaction",
7
"params":["0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"],
8
"id":1
9
}
Copied!
Result
1
{
2
"id":1,
3
"jsonrpc": "2.0",
4
"result": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
5
}
Copied!

​
πŸ“‚
Account Information

Calls to get information about an account.

eth_getBalance

Returns the balance of the account of a given address.

Parameters

    1.
    DATA, 20 Bytes - address to check for balance.
    2.
    QUANTITY|TAG - integer block number, or the string "latest", "earliest" or "pending", see the default block parameter.
1
params: [
2
'0xc94770007dda54cF92009BFF0dE90c06F603a09f',
3
'latest'
4
]
Copied!

Returns

QUANTITY - integer of the current balance for the given address in wei.

​Example​

Request
Curl
Postman
1
curl https://arb-mainnet.g.alchemy.com/v2/your-api-key \
2
-X POST \
3
-H "Content-Type: application/json" \
4
-d '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0xc94770007dda54cF92009BFF0dE90c06F603a09f", "latest"],"id":0}'
Copied!
1
URL: https://arb-mainnet.g.alchemy.com/v2/your-api-key
2
RequestType: POST
3
Body:
4
{
5
"jsonrpc":"2.0",
6
"method":"eth_getBalance",
7
"params":["0xc94770007dda54cF92009BFF0dE90c06F603a09f", "latest"],
8
"id":0
9
}
Copied!
Result
1
{
2
"jsonrpc": "2.0",
3
"id": 0,
4
"result": "0x7c2562030800"
5
}
Copied!

eth_getCode

Returns code at a given address. This method can be used to distinguish between contract addresses and wallet addresses.

Parameters

    DATA, 20 Bytes - address.
    QUANTITY|TAG - integer block number, or the string "latest", "earliest" or "pending", see the default block parameter.
1
params: [
2
'0xb59f67a8bff5d8cd03f6ac17265c550ed8f33907',
3
'latest'
4
]
Copied!

Returns

    DATA - the code from the given address.

​Example​

Request
Curl
Postman
1
curl https://arb-mainnet.g.alchemy.com/v2/your-api-key \
2
-X POST \
3
-H "Content-Type: application/json" \
4
-d '{"jsonrpc":"2.0","method":"eth_getCode","params":["0xb59f67a8bff5d8cd03f6ac17265c550ed8f33907", "latest"],"id":0}'
Copied!
1
URL: https://arb-mainnet.g.alchemy.com/v2/your-api-key
2
RequestType: POST
3
Body:
4
{
5
"jsonrpc":"2.0",
6
"method":"eth_getCode",
7
"params":["0xb59f67a8bff5d8cd03f6ac17265c550ed8f33907", "latest"],
8
"id":0
9
}
Copied!
Result
1
{
2
"jsonrpc": "2.0",
3
"id": 0,
4
"result": "0x606060405236156100965763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100a557806313af40351461012f57806318160ddd1461014e578063313ce5671461017357806370a082311461019c57806375ad319a146101bb5780638da5cb5b146101ee57806395d89b411461021d578063a9059cbb14610230575b34156100a157600080fd5bfe5b005b34156100b057600080fd5b6100b8610252565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156100f45780820151838201526020016100dc565b50505050905090810190601f1680156101215780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561013a57600080fd5b6100a3600160a060020a0360043516610289565b341561015957600080fd5b61016161030f565b60405190815260200160405180910390f35b341561017e57600080fd5b610186610315565b60405160ff909116815260200160405180910390f35b34156101a757600080fd5b610161600160a060020a036004351661031a565b34156101c657600080fd5b6101da600160a060020a0360043516610335565b604051901515815260200160405180910390f35b34156101f957600080fd5b61020161038e565b604051600160a060020a03909116815260200160405180910390f35b341561022857600080fd5b6100b861039d565b341561023b57600080fd5b6101da600160a060020a03600435166024356103d4565b60408051908101604052601881527f444f5420416c6c6f636174696f6e20496e64696361746f720000000000000000602082015281565b60005433600160a060020a039081169116146102a457600080fd5b600054600160a060020a0380831691167f70aea8d848e8a90fb7661b227dc522eb6395c3dac71b63cb59edd5c9899b236460405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60015481565b600381565b600160a060020a031660009081526002602052604090205490565b33600160a060020a03811660009081526002602052604081206001015490919060ff16151561036357600080fd5b5050600160a060020a031660009081526002602052604090206001908101805460ff19168217905590565b600054600160a060020a031681565b60408051908101604052600381527f444f540000000000000000000000000000000000000000000000000000000000602082015281565b33600160a060020a03811660009081526002602052604081205490919083908190101561040057600080fd5b33600160a060020a03811660009081526002602052604090206001015460ff16151561042b57600080fd5b85600160a060020a031633600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8760405190815260200160405180910390a3600160a060020a033381166000908152600260205260408082208054899003905591881681522080548601905560019350505050929150505600a165627a7a72305820228dfae3e67abcdc7f73fb3f83a7d23f45acd853774acad9d2e1ac83b940fbe90029"
5
}
Copied!

eth_getStorageAt

Returns the value from a storage position at a given address, or in other words, returns the state of the contract's storage, which may not be exposed via the contract's methods.

Parameters

    DATA, 20 Bytes - address of the storage.
    QUANTITY - integer of the position in the storage.
    QUANTITY|TAG - integer block number, or the string "latest", "earliest" or "pending", see the default block parameter.

Returns

    DATA - the value at this storage position.

Example

Calculating the correct position depends on the storage to retrieve. Consider the following contract deployed at 0x295a70b2de5e3953354a6a8344e616ed314d7251 by address 0x391694e7e0b0cce554cb130d723a9d27458f9298.
1
contract Storage {
2
uint pos0;
3
mapping(address => uint) pos1;
4
​
5
function Storage() {
6
pos0 = 1234;
7
pos1[msg.sender] = 5678;
8
}
9
}
Copied!
Retrieving the value of pos0 is straight forward:
​Request​
Curl
Postman
1
curl https://arb-mainnet.g.alchemy.com/v2/your-api-key \
2
-X POST \
3
-H "Content-Type: application/json" \
4
-d '{"jsonrpc":"2.0", "method": "eth_getStorageAt", "params": ["0x295a70b2de5e3953354a6a8344e616ed314d7251", "0x0", "latest"], "id": 1}'
Copied!
1
URL: https://arb-mainnet.g.alchemy.com/v2/your-api-key
2
RequestType: POST
3
Body:
4
{
5
"jsonrpc":"2.0",
6
"method":"eth_getStorageAt",
7
"params":["0x295a70b2de5e3953354a6a8344e616ed314d7251", "0x0", "latest"],
8
"id":1
9
}
Copied!
Result
1
{
2
"jsonrpc":"2.0",
3
"id":1,
4
"result":"0x00000000000000000000000000000000000000000000000000000000000004d2"
5
}
Copied!
Retrieving an element of the map is harder. The position of an element in the map is calculated with:
1
keccack(LeftPad32(key, 0), LeftPad32(map position, 0))
Copied!
This means to retrieve the storage on pos1[β€œ0x391694e7e0b0cce554cb130d723a9d27458f9298”] we need to calculate the position with:
1
keccak(decodeHex("000000000000000000000000391694e7e0b0cce554cb130d723a9d27458f9298" + "0000000000000000000000000000000000000000000000000000000000000001"))
Copied!
The geth console which comes with the web3 library can be used to make the calculation:
1
> var key = "000000000000000000000000391694e7e0b0cce554cb130d723a9d27458f9298" + "0000000000000000000000000000000000000000000000000000000000000001"
2
undefined
3
> web3.sha3(key, {"encoding": "hex"})
4
"0x6661e9d6d8b923d5bbaab1b96e1dd51ff6ea2a93520fdc9eb75d059238b8c5e9"
Copied!
Now to fetch the storage:
​Request​
Curl
Postman
1
curl https://arb-mainnet.g.alchemy.com/v2/your-api-key \
2
-X POST \
3
-H "Content-Type: application/json" \
4
-d '{"jsonrpc":"2.0", "method": "eth_getStorageAt", "params": ["0x295a70b2de5e3953354a6a8344e616ed314d7251", "0x6661e9d6d8b923d5bbaab1b96e1dd51ff6ea2a93520fdc9eb75d059238b8c5e9", "latest"], "id": 1}'
Copied!
1
URL: https://arb-mainnet.g.alchemy.com/v2/your-api-key
2
RequestType: POST
3
Body:
4
{
5
"jsonrpc":"2.0",
6
"method":"eth_getStorageAt",
7
"params":["0x295a70b2de5e3953354a6a8344e616ed314d7251", "0x6661e9d6d8b923d5bbaab1b96e1dd51ff6ea2a93520fdc9eb75d059238b8c5e9", "latest"],
8
"id":1
9
}
Copied!
Result
1
{
2
"jsonrpc":"2.0",
3
"id":1,
4
"result":"0x000000000000000000000000000000000000000000000000000000000000162e"
5
}
Copied!

eth_accounts

Returns a list of addresses owned by client.
Since Alchemy does not store keys, this will always return empty.

Parameters