Premiers pas avec TheRPC
Ethereum/Core API/eth_getTransactionReceipt

eth_getTransactionReceipt

The eth_getTransactionReceipt method returns the receipt of a transaction, which contains critical information about transaction execution results, including success or failure, gas used, generated events (logs), and deployed contract addresses. The receipt is only available for transactions that have been included in a block.

Use Cases

  • Verifying transaction success or failure
  • Monitoring gas consumption
  • Contract deployment verification
  • Event/log extraction
  • Transfer confirmation
  • Smart contract state change verification
  • Transaction fee calculation
  • Transaction finality confirmation

Method Details

This method returns the transaction receipt object using the transaction's unique hash.

Paramètres:

The hash of the transaction

Retours:

The transaction receipt object, or null if the transaction is pending/not found

Hash of the block containing this transaction

Block number containing this transaction (hex)

Contract address created (if contract creation), otherwise null

Total gas used in the block up to and including this transaction (hex)

The actual gas price paid per unit of gas (hex)

Address of the sender

Gas used by this specific transaction (hex)

Array of log objects generated by this transaction

Bloom filter for light clients to quickly retrieve related logs

Transaction status: 1 (success) or 0 (failure)

Address of the receiver, null for contract creation transactions

Hash of the transaction

Transaction's index position in the block

Transaction type (0=legacy, 1=EIP2930, 2=EIP1559)

Response Example

{
	"jsonrpc": "2.0",
	"id": 1,
	"result": {
		"blockHash": "0x5f35e7deaad2ff7a25c46b7df81a5d834f6c2725e49e868402f6958e979aaa5a",
		"blockNumber": "0x1197fa5",
		"contractAddress": null,
		"cumulativeGasUsed": "0x2eac11",
		"effectiveGasPrice": "0xb4c7a080",
		"from": "0x95222290dd7278aa3ddd389cc1e1d165cc4bafe5",
		"gasUsed": "0x860a",
		"logs": [
			{
				"address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
				"topics": [
					"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
					"0x00000000000000000000000095222290dd7278aa3ddd389cc1e1d165cc4bafe5",
					"0x00000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f5640"
				],
				"data": "0x00000000000000000000000000000000000000000000000000000000007a1200",
				"blockNumber": "0x1197fa5",
				"transactionHash": "0xbb3a336e3f823ec18197f1e13ee875700f08f03e2cab75f0d0b118dabb44cba0",
				"transactionIndex": "0xdb",
				"blockHash": "0x5f35e7deaad2ff7a25c46b7df81a5d834f6c2725e49e868402f6958e979aaa5a",
				"logIndex": "0x133",
				"removed": false
			}
		],
		"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000020000000000000000000800000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000",
		"status": "0x1",
		"to": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
		"transactionHash": "0xbb3a336e3f823ec18197f1e13ee875700f08f03e2cab75f0d0b118dabb44cba0",
		"transactionIndex": "0xdb",
		"type": "0x2"
	}
}

Understanding Status Codes

  • 0x1: Transaction succeeded
  • 0x0: Transaction failed (reverted)

Key Fields in Transaction Receipts

  • status: Indicates transaction success or failure
  • contractAddress: Contains the address of a newly deployed contract (null for regular transactions)
  • gasUsed: Amount of gas actually consumed by the transaction
  • logs: Events emitted during transaction execution
  • effectiveGasPrice: The actual price paid per unit of gas

Common Event Signatures

  • ERC20 Transfer: 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef
  • ERC20 Approval: 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925
  • ERC721 Transfer: 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef (same as ERC20)

Important Notes

  • Transaction receipts are only available for transactions that have been included in a block
  • The receipt provides the definitive status of a transaction (success or failure)
  • For contract deployments, the new contract address is included in the receipt
  • Event logs can be used to track state changes triggered by the transaction
  • Gas used in the receipt provides the actual gas consumption (useful for fee calculation)

See also

Aidez-nous à nous améliorer !
Partagez cette page et aidez-nous à créer un produit encore meilleur pour vous.