For AI agents: a documentation index is available at /llms.txt. Markdown versions of pages are available by appending .md to any documentation URL.
Skip to main content

Transaction methods

These methods retrieve transactions and transaction receipts.

eth_getTransactionByBlockHashAndIndex

Returns transaction information for the specified block hash and transaction index position.

Parameters

  • block: string - 32-byte hash of a block.

  • index: string - Integer representing the transaction index position.

Returns

  • Transaction object, or null when there is no transaction.

    • accessList: array - (Optional) List of addresses and storage keys the transaction plans to access. Used in ACCESS_LIST transactions and may be used in EIP1559 transactions.

    • blockHash: data, 32 bytes - Hash of the block containing this transaction. null when transaction is pending.

    • blockNumber: quantity - Block number of the block containing this transaction. null when transaction is pending.

    • blockTimestamp: quantity - Hex-encoded Unix timestamp (in seconds) of the block containing this transaction. null when transaction is pending.

    • chainId: quantity - Chain ID.

    • from: data, 20 bytes - Address of the sender.

    • gas: quantity - Gas provided by the sender.

    • gasPrice: quantity - (Optional) Gas price, in Wei, provided by the sender. Used only in non-EIP1559 transactions.

    • maxPriorityFeePerGas: quantity, integer - (Optional) Maximum fee, in Wei, the sender is willing to pay per gas above the base fee. Used only in EIP1559 transactions.

    • maxFeePerGas: quantity, integer - (Optional) Maximum total fee (base fee + priority fee), in Wei, the sender is willing to pay per gas. Used only in EIP1559 transactions.

    • hash: data, 32 bytes - Hash of the transaction.

    • input: data - Data sent with the transaction to create or invoke a contract.

    • nonce: quantity - Number of transactions made by the sender before this one.

    • to: data, 20 bytes - Address of the receiver. null if a contract creation transaction.

    • transactionIndex: quantity, integer - Index position of the transaction in the block. null when transaction is pending.

    • transactionType: string - Transaction type.

    • 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

curl -X POST http://127.0.0.1:8545/ \
-H "Content-Type: application/json" \
--data '{
"jsonrpc": "2.0",
"method": "eth_getTransactionByBlockHashAndIndex",
"params": [
"0xbf137c3a7a1ebdfac21252765e5d7f40d115c2757e4a4abee929be88c624fdb7",
"0x2"
],
"id": 1
}'

eth_getTransactionByBlockNumberAndIndex

Returns transaction information for the specified block number and transaction index position.

Parameters

  • blockNumber: string - Hexadecimal integer representing a block number, or one of the string tags latest, earliest, pending, finalized, or safe, as described in block parameter.

    note

    pending returns the same value as latest.

  • index: string - Transaction index position.

Returns

  • Transaction object, or null when there is no transaction.

    • accessList: array - (Optional) List of addresses and storage keys the transaction plans to access. Used in ACCESS_LIST transactions and may be used in EIP1559 transactions.

    • blockHash: data, 32 bytes - Hash of the block containing this transaction. null when transaction is pending.

    • blockNumber: quantity - Block number of the block containing this transaction. null when transaction is pending.

    • blockTimestamp: quantity - Hex-encoded Unix timestamp (in seconds) of the block containing this transaction. null when transaction is pending.

    • chainId: quantity - Chain ID.

    • from: data, 20 bytes - Address of the sender.

    • gas: quantity - Gas provided by the sender.

    • gasPrice: quantity - (Optional) Gas price, in Wei, provided by the sender. Used only in non-EIP1559 transactions.

    • maxPriorityFeePerGas: quantity, integer - (Optional) Maximum fee, in Wei, the sender is willing to pay per gas above the base fee. Used only in EIP1559 transactions.

    • maxFeePerGas: quantity, integer - (Optional) Maximum total fee (base fee + priority fee), in Wei, the sender is willing to pay per gas. Used only in EIP1559 transactions.

    • hash: data, 32 bytes - Hash of the transaction.

    • input: data - Data sent with the transaction to create or invoke a contract.

    • nonce: quantity - Number of transactions made by the sender before this one.

    • to: data, 20 bytes - Address of the receiver. null if a contract creation transaction.

    • transactionIndex: quantity, integer - Index position of the transaction in the block. null when transaction is pending.

    • transactionType: string - Transaction type.

    • 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

curl -X POST http://127.0.0.1:8545/ \
-H "Content-Type: application/json" \
--data '{
"jsonrpc": "2.0",
"method": "eth_getTransactionByBlockNumberAndIndex",
"params": [
"0x1442e",
"0x2"
],
"id": 1
}'

eth_getTransactionByHash

Returns transaction information for the specified transaction hash.

Parameters

  • transaction: string - 32-byte transaction hash.

Returns

  • Transaction object, or null when there is no transaction.

    • accessList: array - (Optional) List of addresses and storage keys the transaction plans to access. Used in ACCESS_LIST transactions and may be used in EIP1559 transactions.

    • blockHash: data, 32 bytes - Hash of the block containing this transaction. null when transaction is pending.

    • blockNumber: quantity - Block number of the block containing this transaction. null when transaction is pending.

    • blockTimestamp: quantity - Hex-encoded Unix timestamp (in seconds) of the block containing this transaction. null when transaction is pending.

    • chainId: quantity - Chain ID.

    • from: data, 20 bytes - Address of the sender.

    • gas: quantity - Gas provided by the sender.

    • gasPrice: quantity - (Optional) Gas price, in Wei, provided by the sender. Used only in non-EIP1559 transactions.

    • maxPriorityFeePerGas: quantity, integer - (Optional) Maximum fee, in Wei, the sender is willing to pay per gas above the base fee. Used only in EIP1559 transactions.

    • maxFeePerGas: quantity, integer - (Optional) Maximum total fee (base fee + priority fee), in Wei, the sender is willing to pay per gas. Used only in EIP1559 transactions.

    • hash: data, 32 bytes - Hash of the transaction.

    • input: data - Data sent with the transaction to create or invoke a contract.

    • nonce: quantity - Number of transactions made by the sender before this one.

    • to: data, 20 bytes - Address of the receiver. null if a contract creation transaction.

    • transactionIndex: quantity, integer - Index position of the transaction in the block. null when transaction is pending.

    • transactionType: string - Transaction type.

    • 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

curl -X POST http://127.0.0.1:8545/ \
-H "Content-Type: application/json" \
--data '{
"jsonrpc": "2.0",
"method": "eth_getTransactionByHash",
"params": [
"0xa52be92809541220ee0aaaede6047d9a6c5d0cd96a517c854d944ee70a0ebb44"
],
"id": 53
}'

eth_getTransactionBySenderAndNonce

Returns transaction information for the specified sender address and nonce.

note

To return transactions included in blocks, this method requires the sender and nonce index. The index is enabled by default; you can disable it using --tx-sender-nonce-index-enabled. If the index is disabled, this method only returns information for pending transactions.

Parameters

  • address: string - 20-byte sender address.

  • nonce: string - Hexadecimal integer representing the transaction nonce.

Returns

  • Transaction object, or null when there is no transaction.

    • accessList: array - (Optional) List of addresses and storage keys the transaction plans to access. Used in ACCESS_LIST transactions and may be used in EIP1559 transactions.

    • blockHash: data, 32 bytes - Hash of the block containing this transaction. null when transaction is pending.

    • blockNumber: quantity - Block number of the block containing this transaction. null when transaction is pending.

    • blockTimestamp: quantity - Hex-encoded Unix timestamp (in seconds) of the block containing this transaction. null when transaction is pending.

    • chainId: quantity - Chain ID.

    • from: data, 20 bytes - Address of the sender.

    • gas: quantity - Gas provided by the sender.

    • gasPrice: quantity - (Optional) Gas price, in Wei, provided by the sender. Used only in non-EIP1559 transactions.

    • maxPriorityFeePerGas: quantity, integer - (Optional) Maximum fee, in Wei, the sender is willing to pay per gas above the base fee. Used only in EIP1559 transactions.

    • maxFeePerGas: quantity, integer - (Optional) Maximum total fee (base fee + priority fee), in Wei, the sender is willing to pay per gas. Used only in EIP1559 transactions.

    • hash: data, 32 bytes - Hash of the transaction.

    • input: data - Data sent with the transaction to create or invoke a contract.

    • nonce: quantity - Number of transactions made by the sender before this one.

    • to: data, 20 bytes - Address of the receiver. null if a contract creation transaction.

    • transactionIndex: quantity, integer - Index position of the transaction in the block. null when transaction is pending.

    • transactionType: string - Transaction type.

    • 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

curl -X POST http://127.0.0.1:8545/ \
-H "Content-Type: application/json" \
--data '{
"jsonrpc": "2.0",
"method": "eth_getTransactionBySenderAndNonce",
"params": [
"0xfe3b557e8fb62b89f4916b721be55ceb828dbd73",
"0x1"
],
"id": 53
}'

eth_getTransactionReceipt

Returns the receipt of a transaction by transaction hash. Receipts for pending transactions are not available.

If you enabled revert reason, the receipt includes available revert reasons in the response.

Parameters

  • transaction: string - 32-byte hash of a transaction.

Returns

  • Transaction receipt object, or null when there is no receipt.

    • blockHash: data, 32 bytes - Hash of block containing this transaction.

    • blockNumber: quantity - Block number of block containing this transaction.

    • blockTimestamp: quantity - Hex-encoded unix timestamp (in seconds) of the block that includes this transaction.

    • contractAddress: data, 20 bytes - Contract address created, if contract creation transaction, otherwise, null. A failed contract creation transaction still produces a contract address value.

    • cumulativeGasUsed: quantity - Total amount of gas used by previous transactions in the block and this transaction.

    • effectiveGasPrice: quantity - The actual value per gas deducted from the sender's account.

    • from: data, 20 bytes - Address of the sender.

    • gasUsed: quantity - Amount of gas used by this specific transaction.

    • logs: array - Array of log objects generated by this transaction.

      • removed: tag - true if log removed because of a chain reorganization. false if a valid log.

      • logIndex: quantity, integer - Log index position in the block. null when log is pending.

      • transactionIndex: quantity, integer - Index position of the starting transaction for the log. null when log is pending.

      • transactionHash: data, 32 bytes - Hash of the starting transaction for the log. null when log is pending.

      • blockHash: data, 32 bytes - Hash of the block that includes the log. null when log is pending.

      • blockNumber: quantity - Number of block that includes the log. null when log is pending.

      • blockTimestamp: quantity - Hex-encoded unix timestamp (in seconds) of the block that includes the log.

      • address: data, 20 bytes - Address the log originated from.

      • data: data - Non-indexed arguments of the log.

      • topics: array of data, 32 bytes each - Event signature hash and 0 to 3 indexed log arguments.

    • logsBloom: data, 256 bytes - Bloom filter for light clients to quickly retrieve related logs.

    • status: quantity - Either 0x0 (failure), 0x1 (success), or 0x2 (invalid).

    • to: data, 20 bytes - Address of the receiver, if sending ether, otherwise, null.

    • transactionHash: data, 32 bytes - Hash of the transaction.

    • transactionIndex: quantity, integer - Index position of transaction in the block.

    • transactionType: string - Transaction type.

    • revertReason: string - ABI-encoded string that displays the reason for reverting the transaction. Only available if revert reason is enabled.

    • type: quantity - Transaction type, 0x00 for legacy transactions, 0x01 for access list types, 0x02 for dynamic fees, and 0x03 for blob transactions.

    • root: data, 32 bytes - Pre-Byzantium transactions return this field instead of status. Post-transaction state root.

Example

curl -X POST http://127.0.0.1:8545/ \
-H "Content-Type: application/json" \
--data '{
"jsonrpc": "2.0",
"method": "eth_getTransactionReceipt",
"params": [
"0x504ce587a65bdbdb6414a0c6c16d86a04dd79bfcc4f2950eec9634b30ce5370f"
],
"id": 53
}'