Skip to content
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 know whether the transaction succeeded or failed #77

Open
qzmer1104 opened this issue Nov 8, 2024 · 7 comments
Open

How to know whether the transaction succeeded or failed #77

qzmer1104 opened this issue Nov 8, 2024 · 7 comments

Comments

@qzmer1104
Copy link

qzmer1104 commented Nov 8, 2024

一、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
image
I'll get the tx chain

https://testnet.tonviewer.com/transaction/60da2e9798291fd32a1400e90ef32f5b2878f9d9d18237c6a5deadd4f5fcd1b8

And if I use first tx of tx chain like【60da2e9798291fd32a1400e90ef32f5b2878f9d9d18237c6a5deadd4f5fcd1b8】
image

https://testnet.toncenter.com/api/v3/transactions?hash=60da2e9798291fd32a1400e90ef32f5b2878f9d9d18237c6a5deadd4f5fcd1b8&limit=10&offset=0&sort=desc

I can get the result

image

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。

@neodix42
Copy link
Owner

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

@neodix42
Copy link
Owner

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()));
}

@Jjkjl
Copy link

Jjkjl commented Nov 23, 2024

Help me for life

@Jjkjl
Copy link

Jjkjl commented Nov 24, 2024

Can you help me?

1 similar comment
@Jjkjl
Copy link

Jjkjl commented Dec 2, 2024

Can you help me?

@neodix42
Copy link
Owner

neodix42 commented Dec 2, 2024

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.

@Jjkjl
Copy link

Jjkjl commented Dec 2, 2024

Please don't hack my system. I just want help. I will be glad if you help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants