How to know whether the transaction succeeded or failed
Opened this issue · 7 comments
一、After send Tx。We get this
ExtMessageInfo emi = hotWallet.send(walletV3Config);
and then
RawTransactions rawTransactions = tonlib.getRawTransactions(address, null, emi.getHash(), 1);
And what's going on?
二、toncenter api
I find a api
https://testnet.toncenter.com/api/v3/index.html#/blockchain/api_v3_get_transactions
and but both of hash or hash2 cann't get result。
String hash = emi.getHash();// like MXDm8Mp50J6/oMYu13xlkRgmIPGwCLwTYSu0MtMFT/w=
// or
String hash2 = Utils.base64ToHexString(tx); // 3170e6f0ca79d09ebfa0c62ed77c6591182620f1b008bc13612bb432d3054ffc
But if I search by use hash or hash2 through testnet.tonview.com
I'll get the tx chain
https://testnet.tonviewer.com/transaction/60da2e9798291fd32a1400e90ef32f5b2878f9d9d18237c6a5deadd4f5fcd1b8
And if I use first tx of tx chain like【60da2e9798291fd32a1400e90ef32f5b2878f9d9d18237c6a5deadd4f5fcd1b8】
https://testnet.toncenter.com/api/v3/transactions?hash=60da2e9798291fd32a1400e90ef32f5b2878f9d9d18237c6a5deadd4f5fcd1b8&limit=10&offset=0&sort=desc
I can get the result
And Then question is:
1、If I use tonlib, How to know whether the transaction succeeded or failed
2、If I use the tonview api,How to get the param 60da2e9798291fd32a1400e90ef32f5b2878f9d9d18237c6a5deadd4f5fcd1b8 through ExtMessageInfo。
Hi,
ExtMessageInfo contains a hash of external message. Right after the message has been sent, this hash does not exist in the blockchain. After some time you can use tonlib.getRawTransactions() to retrieve a list of transactions that also contains IN and OUT messages. The hash initially returned by .send() - is a cell hash of IN message.
Unfortunately, Message structure within RawTransactions does not contain this hash of the message, which means you cannot get it hash with the help of tonlib. For that to fix I created a PR.
The same applies to fields aborted, skipped and etc - these are not part of tonlib response. In ton4j you can use lite-client wrapper to get block's or transaction's dumps, here are some examples
I would like correct myself on this:
"The same applies to fields aborted, skipped and etc - these are not part of tonlib response. "
I was wrong, after looking carefully I found that you can obtain transaction information by deserialization data field of RawTransaction:
RawTransactions rawTransactions = tonlib.getRawTransactions(address.toRaw(), null, null, 3);
for (RawTransaction tx : rawTransactions.getTransactions()) {
Transaction transaction = Transaction.deserialize(CellSlice.beginParse(CellBuilder.beginCell().fromBocBase64(tx.getData()).endCell()));
}
Help me for life
Can you help me?
Can you help me?
yes, the PR ton-blockchain/ton#1379 has been merged to testnet, within two weeks will be a new release and I will provide a demo code on how to find out whether msg has been delivered to a blockchain, and some guidelines on how to see if tx is successful.
Please don't hack my system. I just want help. I will be glad if you help.