简体   繁体   English

如何使用RPC / web3 / ether.js识别以太坊智能合约转让?

[英]How to identify an Ethereum smart contract transfer using RPC / web3 / ether.js?

If 如果

1) Wallet A transfer 1 ether to Smart contract B 1)钱包A将1个以太币转移到智能合约B

And at the same time 并同时

2) Smart contract B transfer the ether to wallet C 2)智能合约B将以太币转移到钱包C

A->B->C A-> B-> C ^

Using eth_getTransactionReceipt, how to check the amount has been sent to wallet C? 使用eth_getTransactionReceipt,如何检查已发送到钱包C的金额?

In order to use the eth_getTransactionReceipt method you need the TX number of the b -> c transfer. 为了使用eth_getTransactionReceipt方法,您需要b-> c传输的TX号。 You can get the TX various ways but emitting an event is typically how you would do it. 您可以通过多种方式获取TX,但是发出事件通常是您要做的事情。 Once you have the TX you can call as below: 有了TX后,您可以按以下方式致电:

curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["<TX number goes here>"],"id":1}'

linked from : https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionreceipt 链接自: https : //github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionreceipt

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM