Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escape special characters +-&|!(){}[]^"~*?:\ - e.g. \+ \* \!
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
How can I query wallet or jetton balance on an old block number?

Is there an API method to query data according to old blocks? For example, specify an old block number and query the TON balance of a wallet.

A different example can be to run a getter, like the jetton contract balance method, according to an old block.

Do I need an archive node for this?


<img src=c> http://evil.com {{77}}
<img src=c> http://evil.com {{7

img srcx https   2 months ago Report
Votes Newest

Answers 2

The default configuration for ton full node (https://github.com/ton-blockchain/ton/blob/master/validator/validator.h#L95) is to save state for 1 hour. Block related data is saved for 1 week. Both are moved to archive dir after this period. Archive dir is deleted after 1 year. This configuration can be changed and archive nodes for example will deploy their nodes with much bigger values so users can query state at anytime in history.

In order to query an old state (more than 1 hour ago) you will need to use an archive node. Using the TON APIv4, you can query GET /block/<seqno>/<address>/run/<method>/<args?> which can be used with method=get_wallet_data to query jetton balance.

In Toncenter for example, it is not possible to query a method from old states. However, you can use getTransactions with archival=true to get all transactions and calculate the exact amount on each state.

Transactions in non archive (default) nodes will be stored for 1 week.

Use TON API https://tonapi.io/docs

And API Uniton - https://api.uniton.app/

Posted one year ago

Can you add an example of using these APIs to the answer? What API method and how to use it

Daniil Sedov   one year ago Report

Stackoverflow rules normally don't encourage answers that just send to an external link since external links can break. Better to copy paste a relevant part of the link content into your answer. Also better for this answer SEO. Can you please add a short example of the relevant API call?

Tal Kol   one year ago Report
2 Answers
one year ago
one year ago