Monad — web3, net, eth (3/3)
API reference for Monad. All methods ->
eth_getTransactionReceipt
Returns the receipt of a transaction by transaction hash.
The receipt is not available for pending transactions.
Parameters
-
id(integer; required): a request ID (example: 1). -
jsonrpc(string; required): a JSON RPC spec used (example: 2.0). -
method(string; required): a method used for the request. -
params(array; required):<string>(data, 32 bytes): a hash of the transaction.
Returns
-
object: a transaction receipt object, or null when no receipt was found:-
transactionHash(string; data, 32 bytes): a hash of the transaction. -
transactionIndex(string; quantity): the transactions index position in the block. -
blockHash(string; data, 32 bytes): a hash of the block containing the transaction. -
blockNumber(string; quantity): a number of the block containing the transaction. -
from(string; data, 20 bytes): an address of the sender. -
to(string; data, 20 bytes): an address of the receiver; null when it's a contract creation transaction. -
cumulativeGasUsed(string; quantity): the total amount of gas used when this transaction was executed in the block. -
effectiveGasPrice(string; quantity): the sum of the base fee and tip paid per unit of gas. -
gasUsed(string; quantity): the amount of gas used by this specific transaction alone. -
contractAddress(string; data, 20 bytes): the contract address created, if the transaction was a contract creation, otherwise null. -
logs(array): an array of log objects, which this transaction generated. -
logsBloom(string; data, 256 bytes): a bloom filter for light clients to quickly retrieve related logs. -
type(string; data): the transaction type,0x00for legacy transactions,0x01for access list types,0x02for dynamic fees. It also returns either of the following:root(string; data, 32 bytes): a post-transaction stateroot (pre Byzantium).status(string; quantity): either 1 (success) or 0 (failure).
-
Request example
curl -X POST https://rpc.ankr.com/monad_testnet/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getTransactionReceipt",
"params": ["0x3046af51d494bd8f0c1158440e3cf75980897aede6267aa82e9af67474725fe7"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"result": {
"type": "0x2",
"status": "0x1",
"cumulativeGasUsed": "0xdf2eaf",
"logs": [
{
"address": "0x3a98250f98dd388c211206983453837c8365bdc1",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x00000000000000000000000088b96af200c8a9c35442c8ac6cd3d22695aae4f0",
"0x000000000000000000000000882dd2862a4b22651be47ea63f233594173b12d8"
],
"data": "0x00000000000000000000000000000000000000000000000029049483e6b9d6bd",
"blockHash": "0xc1f2a7e6e0f976dd2afc85e8c7ea08d0a3d75eed4ebd8b3b99992424e1400148",
"blockNumber": "0x190080d",
"blockTimestamp": "0x68751573",
"transactionHash": "0x3046af51d494bd8f0c1158440e3cf75980897aede6267aa82e9af67474725fe7",
"transactionIndex": "0x64",
"logIndex": "0x104",
"removed": false
},
{
"address": "0x88b96af200c8a9c35442c8ac6cd3d22695aae4f0",
"topics": [
"0x5d7a6c346454f5c536b7f52655e780f6db27b15b489f80f2dbb288c9e4f366bd",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000003a98250f98dd388c211206983453837c8365bdc1"
],
"data": "0x0000000000000000000000000000000000000000000000000000000000008ca00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000029a2241af62c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffff5433e2b3d8211706e6102aa9471000000000000000000000000000000000000000000000000283f5b136909bd68000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000029a2241af62c0000ffffffffffffffffffffffffffffffffffffffffffffffffd6fb6b7c19462943",
"blockHash": "0xc1f2a7e6e0f976dd2afc85e8c7ea08d0a3d75eed4ebd8b3b99992424e1400148",
"blockNumber": "0x190080d",
"blockTimestamp": "0x68751573",
"transactionHash": "0x3046af51d494bd8f0c1158440e3cf75980897aede6267aa82e9af67474725fe7",
"transactionIndex": "0x64",
"logIndex": "0x105",
"removed": false
}
],
"logsBloom": "0x00000000000000000000000000000004000000000000200000000000000000000000000000000000000000000000000000000180000000000000000000000000000000000000000000000008000000020000000000000000100000000000000000000000020000000000000000000800000000000000000000040010000000000000000000000000000800000000000800000000000004000000000000000000000000000100000000000000000002000100000000001000000000000000000000000002000000000100000000000000000000000000000000000000000028000000000080000000000000000000000000000000000000000000000000000020",
"transactionHash": "0x3046af51d494bd8f0c1158440e3cf75980897aede6267aa82e9af67474725fe7",
"transactionIndex": "0x64",
"blockHash": "0xc1f2a7e6e0f976dd2afc85e8c7ea08d0a3d75eed4ebd8b3b99992424e1400148",
"blockNumber": "0x190080d",
"gasUsed": "0x1986b",
"effectiveGasPrice": "0xba43b7400",
"from": "0x882dd2862a4b22651be47ea63f233594173b12d8",
"to": "0x88b96af200c8a9c35442c8ac6cd3d22695aae4f0",
"contractAddress": null
},
"id": 1
}
eth_getLogs
Returns an array of all logs matching a given filter object.
Parameters
-
id(integer; required): a request ID (example: 1). -
jsonrpc(string; required): a JSON RPC spec used (example: 2.0). -
method(string; required): a method used for the request. -
params(array; required):-
object: the filter options:-
fromBlock(string; quantity|tag; optional; default: "latest"): either the block number or one of the following block tags:latest: for the last mined block.earliest: for the lowest numbered block available on the client.pending: for not yet mined transactions.
-
toBlock(string; quantity|tag; optional; default: "latest"): either the block number or one of the following block tags:latest: for the last mined block.earliest: for the lowest numbered block available on the client.pending: for not yet mined transactions.
-
address(array of strings; data, 20 bytes; optional): a contract address or a list of addresses from which logs should originate. -
topics(array of strings; data; optional): an array of 32 bytes data topics. Topics are order-dependent. Each topic can also be an array of data with "or" options. -
blockhash(string; data, 32 bytes; optional; future): with the addition of EIP-234,blockHashwill be a new filter option which restricts the logs returned to the single block with the 32-byte hash blockHash. Using blockHash is equivalent tofromBlock = toBlock = the blocknumber with hash blockHash. IfblockHashis present in the filter criteria, then neitherfromBlocknortoBlockare allowed.
-
-
Returns
removed(string; tag):truewhen the log was removed, due to a chain reorganization;falseif it's a valid log.logIndex(string; quantity): the log index position in the block; null when it's a pending log.transactionIndex(string; quantity): the transactions index position log was created from; null when it's a pending log.transactionHash(string; data, 32 bytes): a hash of the transactions this log was created from; null when it's a pending log.blockHash(string; data, 32 bytes): a hash of the block containing the log; null when it's pending; null when it's a pending log.blockNumber(string; quantity): the number of the block containing the log; null when it's pending; null when it's a pending log.address(string; data, 20 bytes): an address from which this log originated.data(string; data): contains one or more 32 bytes non-indexed arguments of the log.topics(array of strings; data): an array of 0 to 4 32 bytes data of indexed log arguments. (In solidity: The first topic is the hash of the signature of the event (e.g. Deposit(address,bytes32,uint256)), except you declared the event with the anonymous specifier.)
Request example
curl -X POST https://rpc.ankr.com/monad_testnet/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getLogs",
"params": [
{
"fromBlock": "0x190080D",
"toBlock": "0x190080E"
}
],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"result": [
{
"address": "0x760afe86e5de5fa0ee542fc7b7b713e1c5425701",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x0000000000000000000000008a02e49db7df0ef30adbd0d72341c2d1cba7a030",
"0x0000000000000000000000008e9a1cad0685f1d9dcc869673169097eab45907e"
],
"data": "0x000000000000000000000000000000000000000000000000016345785d8a0000",
"blockHash": "0xc1f2a7e6e0f976dd2afc85e8c7ea08d0a3d75eed4ebd8b3b99992424e1400148",
"blockNumber": "0x190080d",
"blockTimestamp": "0x68751573",
"transactionHash": "0xe73a70c55d0141a29f6fa7fb4a149dd745911328007a8c44ec13b64b9047eb85",
"transactionIndex": "0x1",
"logIndex": "0x0",
"removed": false
},
{
"address": "0x88b8e2161dedc77ef4ab7585569d2415a1c1055d",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x0000000000000000000000008a02e49db7df0ef30adbd0d72341c2d1cba7a030",
"0x0000000000000000000000008e9a1cad0685f1d9dcc869673169097eab45907e"
],
"data": "0x00000000000000000000000000000000000000000000000000000000000336a3",
"blockHash": "0xc1f2a7e6e0f976dd2afc85e8c7ea08d0a3d75eed4ebd8b3b99992424e1400148",
"blockNumber": "0x190080d",
"blockTimestamp": "0x68751573",
"transactionHash": "0xe73a70c55d0141a29f6fa7fb4a149dd745911328007a8c44ec13b64b9047eb85",
"transactionIndex": "0x1",
"logIndex": "0x1",
"removed": false
}
],
"id": 1
}