getTransaction 与 getTransactionReceipt
getTransaction vs getTransactionReceipt
web3库中web3.eth.getTransaction
和web3.eth.getTransactionReceipt
两种方法有什么区别?我试图阅读此文档 https://web3js.readthedocs.io/en/v1.2.0/web3-eth.html#gettransactionreceipt 但我不清楚其中的区别。
收据仅适用于 开采的 交易。但正因为如此,它包含了更多的属性:
status
- 成功或还原
gasUsed
- 此 tx 单独使用的气体量
cumulativeGasUsed
- 此交易及其内部交易使用的气体量
logs
- 交易产生的事件日志列表
常规 getTransaction
允许您获取 [=] 交易的详细信息(例如 from
、to
、data
和 value
) 26=]尚未开采。可能的用例:您仅从外部来源获得 transactionHash
,需要找出收件人并且不知道交易是否已被挖掘。
所以它们都可以在不同的情况下使用。
web3库中web3.eth.getTransaction
和web3.eth.getTransactionReceipt
两种方法有什么区别?我试图阅读此文档 https://web3js.readthedocs.io/en/v1.2.0/web3-eth.html#gettransactionreceipt 但我不清楚其中的区别。
收据仅适用于 开采的 交易。但正因为如此,它包含了更多的属性:
status
- 成功或还原gasUsed
- 此 tx 单独使用的气体量cumulativeGasUsed
- 此交易及其内部交易使用的气体量logs
- 交易产生的事件日志列表
常规 getTransaction
允许您获取 [=] 交易的详细信息(例如 from
、to
、data
和 value
) 26=]尚未开采。可能的用例:您仅从外部来源获得 transactionHash
,需要找出收件人并且不知道交易是否已被挖掘。
所以它们都可以在不同的情况下使用。