-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to query the transaction detail which have the internal transfer by json-rpc api? #12697
Comments
Good question, I'm not sure if there's a more efficient way to do this but here's my take on how you can get the full internal trace information: First I need to find where the message was executed with $ curl -s -X POST -H "Content-Type: application/json" --data '{"method":"Filecoin.StateSearchMsg","params":[[],{"/":"bafy2bzacecy4adusijbg6qdjx6w7aifgkbrkgst2ovu42zghrupgy22g5sek6"},-1,false],"id":2,"jsonrpc":"2.0"}' http://127.0.0.1:1234/rpc/v1
{"id":2,"jsonrpc":"2.0","result":{"Message":{"/":"bafy2bzacecy4adusijbg6qdjx6w7aifgkbrkgst2ovu42zghrupgy22g5sek6"},"Receipt":{"ExitCode":0,"Return":"g/UAQA==","GasUsed":10986123,"EventsRoot":null},"ReturnDec":null,"TipSet":[{"/":"bafy2bzacecnv2vfsyjb6clcwojmxqv2nxoc5576v5p4mls6ynpaa7tuhkolu2"},{"/":"bafy2bzaceblf5v2k2z7g2mqleih5ut73dincvxvdct7exgash5c7ll3omnn32"}],"Height":3751470}} So I know the tipset where the message was executed, but I need the parent state of epoch $ curl -s -X POST -H "Content-Type: application/json" --data '{"method":"Filecoin.ChainGetTipSet","params":[[{"/":"bafy2bzacecnv2vfsyjb6clcwojmxqv2nxoc5576v5p4mls6ynpaa7tuhkolu2"},{"/":"bafy2bzaceblf5v2k2z7g2mqleih5ut73dincvxvdct7exgash5c7ll3omnn32"}]],"id":2,"jsonrpc":"2.0"}' http://127.0.0.1:1234/rpc/v1 | jq '.result.Blocks[0].Parents' -c
[{"/":"bafy2bzacebpmxy7lnchw2j4jz2xde7jlhssv76fzsvkuh74m2u63rgx3i6hsm"},{"/":"bafy2bzacedzbv67vgie3so7vtf24tlaelrdiedpg36ecnixtl4mezd5yofene"},{"/":"bafy2bzaceddojcd4lkjs4jbto575fdbre6ztanllzvbpd7ihsvqn43f6vrxhg"},{"/":"bafy2bzaced7nl2ifbj5pv7l2jqgyk6ljjbuvneykhv3pvdbeuhpp46icwhwfg"},{"/":"bafy2bzaceapgmimjbfmhm42rahwsbmkzetu7lqmz4tdsc4clzc6ppu76oqf5w"}] Now I have the tipset of the parent state so I can replay the transaction and see what happened, using $ curl -s -X POST -H "Content-Type: application/json" --data '{"method":"Filecoin.StateReplay","params":[[{"/":"bafy2bzacebpmxy7lnchw2j4jz2xde7jlhssv76fzsvkuh74m2u63rgx3i6hsm"},{"/":"bafy2bzacedzbv67vgie3so7vtf24tlaelrdiedpg36ecnixtl4mezd5yofene"},{"/":"bafy2bzaceddojcd4lkjs4jbto575fdbre6ztanllzvbpd7ihsvqn43f6vrxhg"},{"/":"bafy2bzaced7nl2ifbj5pv7l2jqgyk6ljjbuvneykhv3pvdbeuhpp46icwhwfg"},{"/":"bafy2bzaceapgmimjbfmhm42rahwsbmkzetu7lqmz4tdsc4clzc6ppu76oqf5w"}],{"/":"bafy2bzacecy4adusijbg6qdjx6w7aifgkbrkgst2ovu42zghrupgy22g5sek6"}],"id":2,"jsonrpc":"2.0"}' http://127.0.0.1:1234/rpc/v1 | jq
... If I [
{
"Msg": {
"From": "f02260507",
"To": "f03024609",
"Value": "1000000000000000000000",
"Method": 0,
"Params": null,
"ParamsCodec": 0,
"GasLimit": 10878208,
"ReadOnly": false
},
"MsgRct": {
"ExitCode": 0,
"Return": null,
"ReturnCodec": 0
},
...
] If you're going to be rigorous about this then you'd want to look at all of the subcalls, there may be more than one, and you'd want to (a) look at the exit code of the original message to see that it's And to achieve all this you'll obviously need to have access to a node that has history that far back, since you're looking at a message from March. Does that help? |
Checklist
Latest release
, the most recent RC(release canadiate) for the upcoming release or the dev branch(master), or have an issue updating to any of these.Lotus component
Lotus Version
Repro Steps
1.I want to query the internal transfer detail in transaction,like:
https://filscan.io/message/bafy2bzacecy4adusijbg6qdjx6w7aifgkbrkgst2ovu42zghrupgy22g5sek6/#trade
There is a internal transfer,send 1000fil from f02260507 to f03024609
2. I try to call "Filecoin.ChainGetMessage",but don't return internal transfer detail,So any other json-rpc api to use?
Describe the Bug
~
Logging Information
The text was updated successfully, but these errors were encountered: