Polygon API
Below you will find the standard Polygon JSON-RPC calls that are compatible with Alchemy.
For more information on Polygon's API check out the official documentation.
NOTE: Not all standard Ethereum methods are supported by Polygon. Likewise, not all Polygon methods are currently supported on Alchemy. For the full list of supported Polygon methods, check out the official documentation.

Mainnet vs. Testnet

There are two networks on Polygon: Mainnet and Mumbai testnet. The endpoints are as follows:
  • Mainnet: https://polygon-mainnet.g.alchemy.com/v2/your-api-key
  • Mumbai: https://polygon-mumbai.g.alchemy.com/v2/your-api-key

πŸ“¦ Retrieving Block

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.
Request
Curl
Postman
1
curl https://polygon-mainnet.g.alchemyapi.io/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://polygon-mainnet.g.alchemyapi.io/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
"id": 0,
3
"result": "0xf93d16",
4
"jsonrpc": "2.0"
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.
Request
Curl
Postman
1
curl https://polygon-mainnet.g.alchemyapi.io/v2/your-api-key \
2
-X POST \
3
-H "Content-Type: application/json" \
4
-d '{"jsonrpc":"2.0","method":"eth_getBlockByHash","params":["0xe2885b25d0863ce4df48facee18d5dd4b4be7366abc59133c2de66ab57d7b71e", true],"id":0}'
Copied!
1
URL: https://polygon-mainnet.g.alchemyapi.io/v2/your-api-key
2
RequestType: POST
3
Body:
4
{
5
"jsonrpc":"2.0",
6
"method":"eth_getBlockByHash",
7
"params":["0xe2885b25d0863ce4df48facee18d5dd4b4be7366abc59133c2de66ab57d7b71e", true],
8
"id":0
9
}
Copied!
Result
1
{
2
"jsonrpc": "2.0",
3
"id": 0,
4
"result": {
5
"difficulty": "0x13",
6
"extraData": "0xd783010a0383626f7288676f312e31352e35856c696e7578000000000000000029adbbaf99a3f97b2baefa11e865cf9d74435716ef8618caaa388619f5ae7d8e5d2cadab0cd2f5becd4ebf7d48f5584c9e414c2a4a6ea2bc6ea8f02dbf5675cd01",
7
"gasLimit": "0x1385aa8",
8
"gasUsed": "0x1380a56",
9
"hash": "0xe2885b25d0863ce4df48facee18d5dd4b4be7366abc59133c2de66ab57d7b71e",
10
"logsBloom": "0x3eb4221d73001e540126a703d8666026b3480983cccc083c04ba806267cc27149835341b440290711abcd3188b4c1da12b84cd48131caa0860a6c1d136bebe8a89918c04184b6e00827328c802a23ca738981432097c0300823b0d34d0d0c6c4682508ecdaf0b4190deb480c4b5a9ca01db86eacca08c5f1d7d0d2f6245c099a010967474dcab60810d55c224564a88b0b29fcdba123000a78643a750604e002f68930330062607a9eaa05ca59a60a4e4449de00f2bb86708121d1093ac8415b18048416334214e80491cc6613434e0272df878498eab4320239d4d77881fbc433d0ca83051d010128102226cd58a248cb008e2240fcd658148169358e502d53",
11
"miner": "0x0000000000000000000000000000000000000000",
12
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
13
"nonce": "0x0000000000000000",
14
"number": "0xf93d47",
15
"parentHash": "0x745ffd6d21e961040b0821f93be0f9533d2f01f87289abe78af4d8052a4c5528",
16
"receiptsRoot": "0xc9cb68ece0290f11a0c3e96e8c7ef52bc0b7a6f0543360c4967400750c2ea23f",
17
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
18
"size": "0xf747",
19
"stateRoot": "0xdd45900534469c5fcbf7b9ac3a56639e2ff6821500804347a5b9332bfa880813",
20
"timestamp": "0x60dcae89",
21
"totalDifficulty": "0xa4be87e",
22
"transactions": [
23
{
24
"blockHash": "0xe2885b25d0863ce4df48facee18d5dd4b4be7366abc59133c2de66ab57d7b71e",
25
"blockNumber": "0xf93d47",
26
"from": "0x8a18a2fee7dc9c2002e21fda8c10f0feb0abf05e",
27
"gas": "0x61899",
28
"gasPrice": "0x17a27db936",
29
"hash": "0x78f825c7d0c09709b82a54b170887d000c58408725cd8d44d10df3382fc5fa1c",
30
"input": "0xf98a9e410000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000007b0900000000000000f5a20b000000002791bca1f2de4661ed88a30c99a7a9449aa841741e00f38a214f0f8c02b5b1f5b93fe646a4390e842a2d1e014395bb4d53f0f9fe088a7b1a0c2924e4eab7712f1e01d4deec3fd8578887ba3cd6549e188307033600d91e01f36ad6a25ed157b896ce5178ffd82ee6203d760d0000000000",
31
"nonce": "0xa9ee",
32
"to": "0xeee49495242da9e0bdbe29a7098388cea8348de4",
33
"transactionIndex": "0x0",
34
"value": "0x0",
35
"type": "0x0",
36
"v": "0x136",
37
"r": "0x8aa119caab9667a1cad06f6fdaf1d01ee80b3c50cf5b53a71dcaff557dfb9b24",
38
"s": "0x305482180355f212cad7a07fda4ce4e1832f1c3013316b660c647f3e5f8c231b"
39
}
40
...
41
],
42
"transactionsRoot": "0xe3394943ac8e86ee3f0112719f1f4e9eb229b7221792a4279c2bdb390bce1ba3",
43
"uncles": []
44
}
45
}
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

Request
Curl
Postman
1
curl https://polygon-mainnet.g.alchemyapi.io/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://polygon-mainnet.g.alchemyapi.io/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
"difficulty": "0x7",
6
"extraData": "0xd58301090083626f7286676f312e3133856c696e757800000000000000000000e14198dde4da0ea1015e9d38ad288f5ba62cf8d1b9a98ccd02fb6f75553ee51c70caa1c376cf4a937c644cae060effe8bf25409cef9ecd25013a608b3a51cbef00",
7
"gasLimit": "0xe984c2",
8
"gasUsed": "0x0",
9
"hash": "0xa284f649d7d9a3c0dea48e3bf3d295767a4893902e61d27e1590d4cece691b6f",
10
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
11
"miner": "0x0000000000000000000000000000000000000000",
12
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
13
"nonce": "0x0000000000000000",
14
"number": "0x1b4",
15
"parentHash": "0x9481d3bb2bbe842f0e4703cb5be094d95650fe8345b4da5642ed27bec3acd0d5",
16
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
17
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
18
"size": "0x260",
19
"stateRoot": "0x01b797385461764bd56336dd5e810f3d57529d47bcbf3260c7d9c770bf6c5af4",
20
"timestamp": "0x5ed28d86",
21
"totalDifficulty": "0xbed",
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
"0x4ec492e0ba174ddca1324e9867c4e4c10a6eca6a1f77b56a19de875ae869b195"
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
Request
Curl
Postman
1
curl https://polygon-mainnet.g.alchemyapi.io/v2/your-api-key \
2
-X POST \
3
-H "Content-Type: application/json" \
4
-d'{"jsonrpc":"2.0","method":"eth_getTransactionByHash","params":["0x4ec492e0ba174ddca1324e9867c4e4c10a6eca6a1f77b56a19de875ae869b195,"id":0}'
Copied!
1
URL: https://polygon-mainnet.g.alchemyapi.io/v2/your-api-key
2
RequestType: POST
3
Body:
4
{
5
"jsonrpc":"2.0",
6
"method":"eth_getTransactionByHash",
7
"params":["0x4ec492e0ba174ddca1324e9867c4e4c10a6eca6a1f77b56a19de875ae869b195"],
8
"id":0
9
}
Copied!
Result
1
{
2
"jsonrpc": "2.0",
3
"id": 0,
4
"result": {
5
"blockHash": "0xb5acef6bbf84c1c0ec7a5009757e3a09ee25ec129b564d11fb976ce75f426c59",
6
"blockNumber": "0xd7b488",
7
"from": "0x7b5fc677cf27a807adf2ebcef72db3b935df6c0a",
8
"gas": "0xb352c",
9
"gasPrice": "0x9502f900",
10
"hash": "0x4ec492e0ba174ddca1324e9867c4e4c10a6eca6a1f77b56a19de875ae869b195",
11
"input": "0x405cec6700000000000000000000000024cf788254bb130bacb6ff519ef875b1d4b0008e000000000000000000000000ab45c5a4b0c941a2f231c04c3f49182e1a25405200000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000046000000000000000000000000000000000000000000000000000000009502f900000000000000000000000000000000000000000000000000000000000004ffa0000000000000000000000000000000000000000000000000000000000000104f0000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000048000000000000000000000000000000000000000000000000000000000000002a434ee9791000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000010000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000044095ea7b3000000000000000000000000750fd34fbb97abe5492338a3918552291a799ca0000000000000000000000000000000000000000000000000000000002114a0c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000750fd34fbb97abe5492338a3918552291a799ca000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000006440993b26000000000000000000000000000000000000000000000000000000002114a0c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005fd8004400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041dc112fa5131cb8f424321830c246c7aec27a5f86968d6eaace1926600716676633ec1f49b2d2eaea0ba7c10d9d97922f13e92002ab2e0610fc17d6ff3e4c60761b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
12
"nonce": "0x3059e",
13
"to": "0xd216153c06e857cd7f72665e0af1d7d82172f494",
14
"transactionIndex": "0x4",
15
"value": "0x0",
16
"type": "0x0",
17
"v": "0x1c",
18
"r": "0x39aeddb2b67676e65e7d6f43fd57c731e17534fcfea0eb40d37be1224a8bb8f0",
19
"s": "0x284defe0787533fc62c637acd2d9e89b2609350c1c26fd4dbb5386242e85a795"
20
}
21
}
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
'0x0e11795884b28b08f9978bb85938280967cda041',
3
'latest' // state at the latest block
4
]
Copied!

Returns

QUANTITY - integer of the number of transactions send from this address.
Request
Curl
Postman
1
curl https://polygon-mainnet.g.alchemyapi.io/v2/your-api-key \
2
-X POST \
3
-H "Content-Type: application/json" \
4
-d '{"jsonrpc":"2.0","method":"eth_getTransactionCount","params":["0x0e11795884b28b08f9978bb85938280967cda041","latest"],"id":0}'
Copied!
1
URL: https://polygon-mainnet.g.alchemyapi.io/v2/your-api-key
2
RequestType: POST
3
Body:
4
{
5
"jsonrpc":"2.0",
6
"method":"eth_getTransactionCount",
7
"params":["0x0e11795884b28b08f9978bb85938280967cda041","latest"],
8
"id":0
9
}
Copied!
Result
1
{
2
"jsonrpc": "2.0",
3
"id": 0,
4
"result": "0xb6d7"
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
'0x9ee9891518b06f4b5bf76a4bef4ba6d93e8d38a17b7aaad492f5555865da7dbb'
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)
Request
Curl
Postman
1
curl https://polygon-mainnet.g.alchemyapi.io/v2/your-api-key \
2
-X POST \
3
-H "Content-Type: application/json" \
4
-d '{"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["0x9ee9891518b06f4b5bf76a4bef4ba6d93e8d38a17b7aaad492f5555865da7dbb"],"id":0}
Copied!
1
URL: https://polygon-mainnet.g.alchemyapi.io/v2/your-api-key
2
RequestType: POST
3
Body:
4
{
5
"jsonrpc":"2.0",
6
"method":"eth_getTransactionReceipt",
7
"params":["0x9ee9891518b06f4b5bf76a4bef4ba6d93e8d38a17b7aaad492f5555865da7dbb"],
8
"id":0
9
}
Copied!
Result
1
{
2
"jsonrpc": "2.0",
3
"id": 0,
4
"result": {
5
"blockHash": "0x6357724a8ccd4dc6f175267395466c005be8ca70f1a67d2232774e8b0fb968ae",
6
"blockNumber": "0xf8ff26",
7
"contractAddress": null,
8
"cumulativeGasUsed": "0x24cf9c",
9
"from": "0x0e11795884b28b08f9978bb85938280967cda041",
10
"gasUsed": "0x303ab",
11
"logs": [
12
{
13
"address": "0x4d97dcd97ec945f40cf65f87097ace5ea0476045",
14
"topics": [
15
"0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb",
16
"0x000000000000000000000000cf5cea15e49b33b70a0bef2d42a46425c54c80a1",
17
"0x000000000000000000000000cf5cea15e49b33b70a0bef2d42a46425c54c80a1",
18
"0x0000000000000000000000000000000000000000000000000000000000000000"
19
],
20
"data": "0x000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002cb4e96cda2b16481b25e3d2b2cab2bd5c74e15de2495d5f78aa3b3fab67f94b87815b4e593d58ca91f171be3dd89ee2005a61df0a00445b8411dda6564c36ed0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000067d109f00000000000000000000000000000000000000000000000000000000067d109f",
21
"blockNumber": "0xf8ff26",
22
"transactionHash": "0x9ee9891518b06f4b5bf76a4bef4ba6d93e8d38a17b7aaad492f5555865da7dbb",
23
"transactionIndex": "0xc",
24
"blockHash": "0x6357724a8ccd4dc6f175267395466c005be8ca70f1a67d2232774e8b0fb968ae",
25
"logIndex": "0x63",
26
"removed": false
27
}
28
],
29
"logsBloom": "0x04000000020000000000000000000000000000000000000000000000002040000000000000000000000000000000000010008000000000000000000100000040000000000000000000000008000600800000000000000000002100000002000000000000020000000000000000000800000000000800000180000112000000000001000002000000000080000000000000100000020010000000000000000000200000000400800000000000000001000000000000000000000000000000024000000042000000000001800000000000000404000400000000180000000020000800008000000000040000000000000000000020000000000000000002100002",
30
"status": "0x1",
31
"to": "0xd216153c06e857cd7f72665e0af1d7d82172f494",
32
"transactionHash": "0x9ee9891518b06f4b5bf76a4bef4ba6d93e8d38a17b7aaad492f5555865da7dbb",
33
"transactionIndex": "0xc",
34
"type": "0x0"
35
}
36
}
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
    '0xbb63603be7a656f34e7a8fa41cb610f33a6c9e74536159a7676fc00eed072d90'
    3
    ]
    Copied!

Returns

  • QUANTITY - integer of the number of transactions in this block.
Request
Curl
Postman
1
curl https://polygon-mainnet.g.alchemyapi.io/v2/your-api-key \
2
-X POST \
3
-H "Content-Type: application/json" \
4
-d '{"jsonrpc":"2.0","method":"eth_getBlockTransactionCountByHash","params":["0xbb63603be7a656f34e7a8fa41cb610f33a6c9e74536159a7676fc00eed072d90"],"id":0}'
Copied!
1
URL: https://polygon-mainnet.g.alchemyapi.io/v2/your-api-key
2
RequestType: POST
3
Body:
4
{
5
"jsonrpc":"2.0",
6
"method":"eth_getBlockTransactionCountByHash",
7
"params":["0xbb63603be7a656f34e7a8fa41cb610f33a6c9e74536159a7676fc00eed072d90"],
8
"id":0
9
}
Copied!
Result
1
{
2
"jsonrpc": "2.0",
3
"id": 0,
4
"result": "0xaa"
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.
Request
Curl
Postman
1
curl https://polygon-mainnet.g.alchemyapi.io/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://polygon-mainnet.g.alchemyapi.io/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": "0x146"
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
'0xbb63603be7a656f34e7a8fa41cb610f33a6c9e74536159a7676fc00eed072d90',
3
'0x0' // 0
4
]
Copied!

Returns

Request
Curl
Postman
1
curl https://polygon-mainnet.g.alchemyapi.io/v2/your-api-key \
2
-X POST \
3
-H "Content-Type: application/json" \
4
-d '{"jsonrpc":"2.0","method":"eth_getTransactionByBlockHashAndIndex","params":["0xbb63603be7a656f34e7a8fa41cb610f33a6c9e74536159a7676fc00eed072d90", "0x0"],"id":0}'
Copied!
1
URL: https://polygon-mainnet.g.alchemyapi.io/v2/your-api-key
2
RequestType: POST
3
Body:
4
{
5
"jsonrpc":"2.0",
6
"method":"eth_getTransactionByBlockHashAndIndex",
7
"params":["0xbb63603be7a656f34e7a8fa41cb610f33a6c9e74536159a7676fc00eed072d90", "0x0"],
8
"id":0
9
}
Copied!
Result
1
{
2
"jsonrpc": "2.0",
3
"id": 0,
4
"result": {
5
"blockHash": "0xbb63603be7a656f34e7a8fa41cb610f33a6c9e74536159a7676fc00eed072d90",
6
"blockNumber": "0xf93fba",
7
"from": "0x5604fdedd03bfb5e9331a44ba67cd2aa3c99276d",
8
"gas": "0x4bd12",
9
"gasPrice": "0xe8d4a51000",
10
"hash": "0x45e81b15ce93fc99af5ea6631fc0416515fbb2bd982fb6f9ef7ad66027e85e21",
11
"input": "0x38ed1739000000000000000000000000000000000000000000000000000000000301c1fa00000000000000000000000000000000000000000022057090352a28bb23ac7e00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000005604fdedd03bfb5e9331a44ba67cd2aa3c99276d00000000000000000000000000000000000000000000000000000000c1b96bbc00000000000000000000000000000000000000000000000000000000000000030000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841740000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf1270000000000000000000000000aaa5b9e6c589642f98a1cda99b9d024b8407285a",
12
"nonce": "0x3d",
13
"to": "0xa5e0829caced8ffdd4de3c43696c57f7d7a678ff",
14
"transactionIndex": "0x0",
15
"value": "0x0",
16
"type": "0x0",
17
"v": "0x136",
18
"r": "0x52903fb1e680b74b775c4415b16bc77f6f8f511c80826679452900061cbd5d97",
19
"s": "0x2cc237b42925f108fcfa351fade6717f2473708f89affca8f7fab6d78c013107"
20
}
21
}
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

Request
Curl
Postman
1
curl https://polygon-mainnet.g.alchemyapi.io/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://polygon-mainnet.g.alchemyapi.io/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": "0x19ece445ee0ad85d1f07d6852d2722fd47d5c9976ac62d9446842bf767a65bb3",
6
"blockNumber": "0xf94012",
7
"from": "0x9b814233894cd227f561b78cc65891aa55c62ad2",
8
"gas": "0x289ec",
9
"gasPrice": "0x4cd5886400",
10
"hash": "0x44374bfbe757797e181de0a43643a9e5dce9dbb1e7360a04667d4703ac3c7a2b",
11
"input": "0x0c53c51c0000000000000000000000007a2c8466603a4d9ef3a294672d5402b2ebe5826000000000000000000000000000000000000000000000000000000000000000a0b703dab06e91938eb7c85c5261cf8c46c55a6a7f17efc8910d5148f7cf993ac7333d10bd3fadaf8c4f99b729152e10a148aa56e94863e761aef4a3babe4f7cdd000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000044a22cb46500000000000000000000000058807bad0b376efc12f5ad86aac70e78ed67deae000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000",
12
"nonce": "0xf167",
13
"to": "0xa5f1ea7df861952863df2e8d1312f7305dabf215",
14
"transactionIndex": "0x0",
15
"value": "0x0",
16
"type": "0x0",
17
"v": "0x136",
18
"r": "0x9121dd82b8b8e6a2f6fc89ad6b1461b563444d2518cf4bc3301c21d81dd3c740",
19
"s": "0x52f252d1aeff76206d0f21ee9236ab74b6e7452ef0466cd56534646f9d4d7af4"
20
}
21
}
Copied!

Polygon-Bor Methods

Bor specific calls supported on Polygon

bor_getAuthor

Returns address of Author

Parameters

  • block number (in hexadecimal format)

Returns

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

bor_getCurrentValidators

Returns current validators

Parameters

NONE

Returns

AUTHOR - address
Request
Curl
Postman
1
curl https://polygon-mainnet.g.alchemyapi.io/v2/your-api-key \
2
-X POST \
3
-H "Content-Type: application/json" \
4
-d '{"jsonrpc":"2.0","method":"bor_getCurrentValidators","params":[], "id":1}'
Copied!
1
URL: https://polygon-mainnet.g.alchemyapi.io/v2/your-api-key
2
RequestType: POST
3
Body:
4
{
5
"jsonrpc":"2.0",
6
"method":"bor_getCurrentValidators",
7
"params":[],
8
"id":1
9
}
Copied!
Result
1
{
2
"jsonrpc": "2.0",
3
"id": 1,
4
"result": [
5
{
6
"ID": 0,
7
"signer": "0x46a3a41bd932244dd08186e4c19f1a7e48cbcdf4",
8
"power": 1,
9
"accum": -15
10
},
11
{
12
"ID": 0,
13
"signer": "0x6a654ca3bfb5cfb23bf30bafbf96b3b6ec26bb0e",
14
"power": 1,
15
"accum": -21
16
},
17
{
18
"ID": 0,
19
"signer": "0x7c7379531b2aee82e4ca06d4175d13b9cbeafd49",
20
"power": 5,
21
"accum": -8
22
},
23
{
24
"ID": 0,
25
"signer": "0xe77bbfd8ed65720f187efdd109e38d75eaca7385",
26
"power": 2,
27
"accum": 5
28
},
29
{
30
"ID": 0,
31
"signer": "0xf0245f6251bef9447a08766b9da2b07b28ad80b0",
32
"power": 7,
33
"accum": -4
34
}
35
]
36
}
Copied!

bor_getCurrentProposer

Returns current proposer's address

Parameters

NONE

Returns

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

bor_getRootHash

Returns the root hash given a block range
The current supported maximum block range for bor_getRootHash is 32767

Parameters

  • from block number (in int format)
  • to block number (in int format)

Returns

HASH
Request
Curl
Postman
1
curl https://polygon-mainnet.g.alchemyapi.io/v2/your-api-key \
2
-X POST \
3
-H "Content-Type: application/json" \
4
-d '{"jsonrpc":"2.0","method":"bor_getRootHash","params":[1000000, 1032767], "id":1}'
Copied!
1
URL: https://polygon-mainnet.g.alchemyapi.io/v2/your-api-key
2
RequestType: POST
3
Body:
4
{
5
"jsonrpc":"2.0",
6
"method":"bor_getRootHash",
7
"params":[1000000, 1032767],
8
"id":1
9
}
Copied!
Result
1
{
2
"jsonrpc": "2.0",
3
"id": 1,
4
"result": "04b073e17b7186ab4daae17c5e2cc2d5a729cffd102cede41ee458a2d5573994"
5
}
Copied!

eth_getRootHash

Returns the root hash given a block range
The current supported maximum block range for eth_getRootHash is 32767

Parameters

  • from block number (in int format)
  • to block number (in int format)

Returns

HASH
Request
Curl
Postman
1
curl https://polygon-mainnet.g.alchemyapi.io/v2/your-api-key \
2
-X POST \
3
-H "Content-Type: application/json" \
4
-d '{"jsonrpc":"2.0","method":"eth_getRootHash","params":[1000000, 1032767], "id":1}'
Copied!
1
URL: https://polygon-mainnet.g.alchemyapi.io/v2/your-api-key
2
RequestType: POST
3
Body:
4
{
5
"jsonrpc":"2.0",
6
"method":"eth_getRootHash",
7
"params":[1000000, 1032767],
8
"id":1
9
}
Copied!
Result
1
{
2
"jsonrpc": "2.0",
3
"id": 1,
4
"result": "04b073e17b7186ab4daae17c5e2cc2d5a729cffd102cede41ee458a2d5573994"
5
}
Copied!

eth_getSignersAtHash

Returns all signs given a blockhash

Parameters

  • blockhash

Returns

HASH
Request
Curl
Postman
1
curl https://polygon-mainnet.g.alchemyapi.io/v2/your-api-key \
2
-X POST \
3
-H "Content-Type: application/json" \
4
-d '{"jsonrpc":"2.0","method":"bor_getSignersAtHash","params":["0x29fa73e3da83ddac98f527254fe37002e052725a88904bac14f03e919e1e2876"], "id":1'
Copied!
1
URL: https://polygon-mainnet.g.alchemyapi.io/v2/your-api-key
2
RequestType: POST
3
Body:
4
{
5
"jsonrpc":"2.0",
6
"method":"bor_getSignersAtHash",
7
"params":["0x29fa73e3da83ddac98f527254fe37002e052725a88904bac14f03e919e1e2876"],
8
"id":1
9
}
Copied!
Result
1
{
2
"jsonrpc": "2.0",
3
"id": 1,
4
"result": [
5
"0x0375b2fc7140977c9c76d45421564e354ed42277",
6
"0x42eefcda06ead475cde3731b8eb138e88cd0bac3",
7
"0x5973918275c01f50555d44e92c9d9b353cadad54",
8
"0x7fcd58c2d53d980b247f1612fdba93e9a76193e6",
9
"0xb702f1c9154ac9c08da247a8e30ee6f2f3373f41",
10
"0xb8bb158b93c94ed35c1970d610d1e2b34e26652c",
11
"0xf84c74dea96df0ec22e11e7c33996c73fcc2d822"
12
]
13
}
Copied!

eth_getTransactionReceiptsByBlock

Returns all transaction receipts for the given block number or hash

Parameters

block_number in hex OR block_hash

Returns

Array of transaction receipt objects
Request
Curl
Postman
1
curl https://polygon-mainnet.g.alchemyapi.io/v2/your-api-key \
2
-X POST \
3
-H "Content-Type: application/json" \
4
-d '{"jsonrpc":"2.0","method":"eth_getTransactionReceiptsByBlock","params":["0x989689"], "id":1}'
Copied!
1
URL: https://polygon-mainnet.g.alchemyapi.io/v2/your-api-key
2
RequestType: POST
3
Body:
4
{
5
"jsonrpc":"2.0",
6
"method":"eth_getTransactionReceiptsByBlock",
7
"params":["0x989689"],
8
"id":1
9