-
Notifications
You must be signed in to change notification settings - Fork 15
feat: transactions #1314
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
Merged
Merged
feat: transactions #1314
Changes from 11 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
6ac937f
transaction overview demo
Shvandre 5271181
fix by codex
Shvandre 39c5d49
Merge branch 'main' into trans-ord
Shvandre 2277eb9
fmt
Shvandre 4b9c0a4
added traces stub
Shvandre a9bc7ec
fix link
Shvandre 94289ba
fix language name
Shvandre 357a3c1
fmt
Shvandre b258c65
removed stub
Shvandre 99241d0
ai review
Shvandre 4bca62d
ai review
Shvandre 38fefe1
Update foundations/messages/ordinary-tx.mdx
anton-trunov 010454c
move transaction-overview.mdx to messages/overview
anton-trunov 256bab8
linkrot
anton-trunov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| --- | ||
| title: "Transactions overview" | ||
| --- | ||
|
|
||
| A transaction is a record that stores every state change of a contract. A contract's state cannot be changed without a transaction. Each transaction has the following structure: | ||
|
|
||
| ```tlb | ||
| transaction$0111 | ||
| account_addr:bits256 | ||
| lt:uint64 | ||
| prev_trans_hash:bits256 | ||
| prev_trans_lt:uint64 | ||
| now:uint32 | ||
| outmsg_cnt:uint15 | ||
| orig_status:AccountStatus | ||
| end_status:AccountStatus | ||
| ^[ | ||
| in_msg:(Maybe ^(Message Any)) | ||
| out_msgs:(HashmapE 15 ^(Message Any)) | ||
| ] | ||
| total_fees:CurrencyCollection | ||
| state_update:^(HASH_UPDATE Account) | ||
| description:^TransactionDescr | ||
| = Transaction; | ||
Shvandre marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ``` | ||
|
|
||
| Transactions implement the concept of `AccountChain` described in the [TON Blockchain whitepaper](/foundations/whitepapers/tblkch#1-2-1-the-infinite-sharding-paradigm-isp-applied-to-blockchain-block-and-state). Each account state can be interpreted as a separate blockchain, so transactions follow a strict order defined by the `prev_trans_hash` field. Thanks to the TON consensus protocol, a transaction becomes final when the first masterchain block references it by storing the hash of the corresponding `ShardChain` state, which in turn stores the hash of the `AccountChain` state. | ||
|
|
||
| Because transactions form the `AccountChain`, each one carries a logical timestamp, `lt`, that strictly increases with every new transaction of the account. The `now` field stores the Unix time when the transaction was created. | ||
|
|
||
| The `state_update` field is a [Merkle update](/foundations/serialization/merkle-update) that captures the difference between the previous and current state of the account. The [contract status](/foundations/status) before and after the transaction is duplicated for convenience. | ||
|
|
||
| Other fields, such as `in_msg`, `out_msgs`, and `outmsg_cnt`, relate to the [messages](/foundations/messages/overview) processed and emitted during the transaction. A trace may start from a transaction rather than a message, in which case `in_msg` is `Nothing`. However, a trace cannot continue without messages: if it contains `n` transactions it must contain at least `n-1` messages. Consequently, a trace can include at most one non-ordinary transaction, because messages can trigger only an [ordinary transaction](/foundations/messages/ordinary-tx). | ||
|
|
||
| The `total_fees` field stores the total number of [fees](/foundations/fees) paid by the transaction. These fees may eventually be paid in extra currencies, but that feature is not implemented yet. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.