I have encountered a new question, which is how to scan the blockchain. For example, in the BTC chain, let's say at block height 100, my balance is 1 BTC. Suppose at block height 101, by using "get transactions of block(101)", I retrieve a transaction where I sent out 0.5 BTC. And let's say at block height 102, I receive 1 BTC. At this point, my BTC balance would be 1.5 BTC. This process is straightforward. However, in TON, how can I perform this process? Does anyone know?

Jan 11, 2024, 3:58 AM
What I mean is, how can I traverse all transactions from block x to block y in the TON blockchain? I'm not quite sure about the main chain and workchains, and they all have block numbers. Which block number should I use and how should I use it? That's the question.
https://testnet.tonapi.io/v2/blockchain/masterchain-head

response is the block is
"workchain_id": -1,
"shard": "8000000000000000",
"seqno": 15976190,

https://testnet.tonapi.io/v2/blockchain/transactions/d01e41904329c18fc3a8496fb132178a079f67bd3fa21b90884aa94f78e93473

response is:
"block": "(0,8000000000000000,17275308)",

so why the 15976190 < 17275308
I requested a transaction, and my boss asked me to calculate the number of confirmations for that transaction. Although I know that in TON, once a message is sent, it is considered confirmed, I still need to determine the time difference between the block where the transaction is located and the current latest block.

Confirmations: nowBlockNum - transBlockNum.

However, when I subtract the block number of the transaction on the main chain from the block number on the workchain, I get a negative value. So, how can I calculate the number of confirmations?
Jan 11, 2024, 4:19 AM

© 2024 Draquery.com All rights reserved.