{"content":{"title":"How to use eth_getTransactionReceipt?","body":"From the first day the EVM launched, there were logs saving **the transaction detail information** onto Ethereum blockchain. These logs indicate the counterparty of the transaction, the token the transaction triggered on, the events the transaction exposed out, the data the transaction attached onto the blockchain etc.\r\n\r\nThe logs, named receipts, are important as it is **the transaction proof** which could be verified and identified by any body using the pre-defined encoding-decoding spec of EVM. Usually there are 2 methods to get 2 different kinds of granularity log data. One is **eth_getTransactionReceipt**, the other is **eth_getBlockReceipts**. ***eth_getTransactionReceipt is used to get one transaction’s receipt log, while eth_getBlockReceipts is used to get all transactions’ receipt logs in a block***. We will introduce eth_getTransactionReceipt in this artical, eth_getBlockReceipts is same, but a list.\r\n\r\n## How to use eth_getTransactionReceipt?\r\n\r\nRPC eth_getTransactionReceipt is an interface to interact with EVM node to retrieve information of one transaction, so you have to call it from a local node or node service provider. Here is the curl syntax using [**Tokenview node service**](https://services.tokenview.io/docs?type=nodeService).\r\n\r\n```\r\ncurl -H \"Content-Type:application/json\" -X POST --data '{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionReceipt\",\"params\":[\"0x855aff97389df84541994e8133b15c01570d844a005035bc8bcc68ecd186f388\"],\"id\":1}' https://services.tokenview.io/vipapi/nodeservice/eth?apikey={apikey}\r\n```\r\n\r\nThe input parameter is the transaction hash, an archive node can return all the receipts of all transactions happened on blockchain, and a full node can only return the latest transactions in latest x blocks, in it x depends on the configration of the full node.\r\n\r\nBelow is the normal response of this RPC. The result\\[‘log’]\\[{array_index}]\\[‘topics’] tells what function is called, what parameters are input into the function, result\\[‘log’]\\[{array_index}]\\[‘data’] tells the undefined parameter part.\r\n\r\n```\r\n{\r\n    \"jsonrpc\":\"2.0\",\r\n    \"id\":1,\r\n    \"result\":{\r\n        \"blockHash\":\"0x330c5980143835f1b4683d2546556157cf20874d7ad1e4490c6d43ac07d1a2ac\",\r\n        \"blockNumber\":\"0x101b6fe\",\r\n        \"contractAddress\":null,\r\n        \"cumulativeGasUsed\":\"0x1da47\",\r\n        \"effectiveGasPrice\":\"0x9228e3f44\",\r\n        \"from\":\"0x1cad683486c7c6f3a21d9a522e5d5cbb02d9c35e\",\r\n        \"gasUsed\":\"0x1da47\",\r\n        \"logs\":[\r\n            {\r\n                \"address\":\"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\",\r\n                \"topics\":[\r\n                    \"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef\",\r\n                    \"0x00000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f5640\",\r\n                    \"0x000000000000000000000000280027dd00ee0050d3f9d168efd6b40090009246\"\r\n                ],\r\n                \"data\":\"0x0000000000000000000000000000000000000000000000000000000ea945ebaa\",\r\n                \"blockNumber\":\"0x101b6fe\",\r\n                \"transactionHash\":\"0x855aff97389df84541994e8133b15c01570d844a005035bc8bcc68ecd186f388\",\r\n                \"transactionIndex\":\"0x0\",\r\n                \"blockHash\":\"0x330c5980143835f1b4683d2546556157cf20874d7ad1e4490c6d43ac07d1a2ac\",\r\n                \"logIndex\":\"0x0\",\r\n                \"removed\":false\r\n            },\r\n            {\r\n                \"address\":\"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\",\r\n                \"topics\":[\r\n                    \"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef\",\r\n                    \"0x000000000000000000000000280027dd00ee0050d3f9d168efd6b40090009246\",\r\n                    \"0x00000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f5640\"\r\n                ],\r\n                \"data\":\"0x000000000000000000000000000000000000000000000001f0a591a58d8d6000\",\r\n                \"blockNumber\":\"0x101b6fe\",\r\n                \"transactionHash\":\"0x855aff97389df84541994e8133b15c01570d844a005035bc8bcc68ecd186f388\",\r\n                \"transactionIndex\":\"0x0\",\r\n                \"blockHash\":\"0x330c5980143835f1b4683d2546556157cf20874d7ad1e4490c6d43ac07d1a2ac\",\r\n                \"logIndex\":\"0x1\",\r\n                \"removed\":false\r\n            },\r\n            {\r\n                \"address\":\"0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640\",\r\n                \"topics\":[\r\n                    \"0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67\",\r\n                    \"0x000000000000000000000000280027dd00ee0050d3f9d168efd6b40090009246\",\r\n                    \"0x000000000000000000000000280027dd00ee0050d3f9d168efd6b40090009246\"\r\n                ],\r\n                \"data\":\"0xfffffffffffffffffffffffffffffffffffffffffffffffffffffff156ba1456000000000000000000000000000000000000000000000001f0a591a58d8d60000000000000000000000000000000000000005d1a8c54a104574892942ca7de000000000000000000000000000000000000000000000000010bf798ba50c260d50000000000000000000000000000000000000000000000000000000000031373\",\r\n                \"blockNumber\":\"0x101b6fe\",\r\n                \"transactionHash\":\"0x855aff97389df84541994e8133b15c01570d844a005035bc8bcc68ecd186f388\",\r\n                \"transactionIndex\":\"0x0\",\r\n                \"blockHash\":\"0x330c5980143835f1b4683d2546556157cf20874d7ad1e4490c6d43ac07d1a2ac\",\r\n                \"logIndex\":\"0x2\",\r\n                \"removed\":false\r\n            }\r\n        ],\r\n        \"logsBloom\":\"0x00000000010000000000000000000000000000020000000000000000040000000000000000000000000008000000000002000000080020000000000000000000000000000000000808000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000800000000000000000000000000000000000000000000010100000000000000000000000000000000200000000000000000000000000000000000002000000008000000000002000000000000000000002000000000000000000000000000000000000000200000000000000010000000000000000000000000000000000000000000\",\r\n        \"status\":\"0x1\",\r\n        \"to\":\"0x280027dd00ee0050d3f9d168efd6b40090009246\",\r\n        \"transactionHash\":\"0x855aff97389df84541994e8133b15c01570d844a005035bc8bcc68ecd186f388\",\r\n        \"transactionIndex\":\"0x0\",\r\n        \"type\":\"0x2\"\r\n    }\r\n}\r\n```\r\n\r\n[Tokenview](https://tokenview.io/) already showed these logs on their [transaction page](https://eth.tokenview.io/en/tx/0x855aff97389df84541994e8133b15c01570d844a005035bc8bcc68ecd186f388), check the first part of the result\\[‘log’]\\[0], **address** is 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48, **topics\\[0]** is the function, **topics\\[1]** and **topics\\[2]** are the parameters of the function, **data** is the undefined parameter.\r\n\r\n![](https://img.learnblockchain.cn/attachments/2024/01/BYeXzJGm65b9bc93bd850.png)\r\n\r\nSwitch back to the **Transaction Info** on that page, 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 is [USDC](https://eth.tokenview.io/en/token/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48), the function is **Transfer**, and the token transfer happened from **0x88e6** to **0x2800**, the data is the value transferred, 62969473962 is the raw data of USDC, divided by USDC’s decimal 6, equals to 62969.473962.\r\n\r\n![](https://img.learnblockchain.cn/attachments/2024/01/CP6Gna7L65b9bcac6b92f.png)\r\n\r\nWell done, you’ve got the core of eth_getTransactionReceipt, a must-have skill for indexing services.\r\n\r\nTokenview is a general multi-crypto blockchain explorer, and it is also a Developer Platform. You would be able to query your wallet balance, the transaction list on your wallet with end-user, and you also get the detail data from Blockchain APIs provided by [Tokenview Developer Platform](https://services.tokenview.io/)."},"author":{"user":"https://learnblockchain.cn/people/12284","address":null},"history":null,"timestamp":1706671417,"version":1}