我使用以下方式查询交易结果:
curl http://localhost:3000/tendermint/tx?hash=0xCDD76608F774BD29CDED2EBD30E94FB66CEF73A9
然后在返回的 JSON 对象中获取交易内容 'tx'。
// tx was extracted from the above returned JSON object
let tx = 'AAABF3siZnJvbSI6eyJhbW91bnQiOjEwMCwicHVia2V5IjoiOmJhc2U2NDpBNmZUNjFvRnlLNG1HZExnd21xSU5ubE55c1NIQ1BDRm9vb2Jod1BTamY2UCIsInNlcXVlbmNlIjowLCJzaWduYXR1cmUiOiI6YmFzZTY0OjFGdmZvZUlLTWlDd1A2NE9IVHd2MHhjeGk3elVBRUNRTkc1NnpnR1lYdkV2UEMvallTcGUvZjVsM0pjRHRNQUl0bHNZMGtrSEZrbHNxTW82Tm9Qa0xBPT0ifSwidG8iOlt7ImFkZHJlc3MiOiJEVkFTNnFzSkxQM3lkUFd0UndkaXNIaXFmVkdtYW1UWVkiLCJhbW91bnQiOjEwMH1dfQAACMs'
我用它解码
let value = Buffer.from(tx, 'base64').toString('utf-8')
console.log(value)
然后它打印以下结果,其中最后包含乱码:
{"from":{"amount":100,"pubkey":":base64:A6fT61oFyK4mGdLgwmqINnlNysSHCPCFooobhwPSjf6P","sequence":0,"signature":":base64:1FvfoeIKMiCwP64OHTwv0xcxi7zUAECQNG56zgGYXvEvPC/jYSpe/f5l3JcDtMAItlsY0kkHFklsqMo6NoPkLA=="},"to":[{"address":"DVAS6qsJLP3ydPWtRwdisHiqfVGmamTYY","amount":100}]�
解码交易的正确方法是什么?
- - - - - - - 更多细节 - - - - - - - - - - -
我正在使用 Lotion 来构建我的应用程序。非常感谢 Chandrika 的回答。