You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/v3/concepts/dive-into-ton/ton-blockchain/blockchain-of-blockchains.md
+14-14Lines changed: 14 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -9,19 +9,19 @@ Terms '**smart contract**', '**account**', and '**actor**' are used interchangea
9
9
10
10
Let's consider one smart contract.
11
11
12
-
In TON, it is a _thing_ with properties like `address`, `code`, `data`, `balance` and others. In other words, it is an object that has some _storage_ and _behavior_.
12
+
In TON, it is a _thing_ with properties like `address`, `code`, `data`, `balance` and others. In other words, it is an object with some _storage_ and _behavior_.
13
13
That behavior has the following pattern:
14
14
* something happens (the most common situation is that a contract gets a message)
15
15
* contract handles that event according to its own properties by executing its `code` in TON Virtual Machine.
16
-
* contract modifies its own properties (`code`, `data` and others)
16
+
* contract modifies its own properties (`code`, `data`, and others)
17
17
* contract optionally generates outgoing messages
18
18
* contract goes into standby mode until the next event occurs
19
19
20
20
A combination of these steps is called a **transaction**. It is important that events are handled one by one, thus _transactions_ are strictly ordered and cannot interrupt each other.
21
21
22
22
This behavior pattern is well known and called 'Actor'.
23
23
24
-
### The lowest level: Account Chain
24
+
### The lowest level: AccountChain
25
25
26
26
A sequence of _transactions_`Tx1 -> Tx2 -> Tx3 -> ....` may be called a **chain**. And in the considered case it is called **AccountChain** to emphasize that it is _the chain_ of a single account of transactions.
27
27
@@ -39,36 +39,36 @@ Now let's consider many accounts. We can get a few _AccountChains_ and store the
39
39
40
40
Note that since a _ShardChain_ consists of easily distinguished _AccountChains_, we can easily split it. That way if we have 1 _ShardChain_ which describes events that happen with 1 million accounts and there are too many transactions per second to be processed and stored in one node, so we just divide (or **split**) that chain into two smaller _ShardChains_ with each chain accounting for half a million accounts and each chain processed on a separate subset of nodes.
41
41
42
-
Analogously, if some shards became too unoccupied they can be **merged** into one bigger shard.
42
+
Analogously, if some shards become too unoccupied, they can be **merged** into one bigger shard.
43
43
44
44
There are obviously two limiting cases: when the shard contains only one account (and thus cannot be split further) and when the shard contains all accounts.
45
45
46
46
Accounts can interact with each other by sending messages. There is a special mechanism of routing which move messages from outgoing queues to corresponding incoming queues and ensures that 1) all messages will be delivered 2) messages will be delivered consecutively (the message sent earlier will reach the destination earlier).
47
47
48
48
:::info SIDE NOTE
49
-
To make splitting and merging deterministic, an aggregation of AccountChains into shards is based on the bit-representation of account addresses. For example, address looks like `(shard prefix, address)`. That way, all accounts in the shardchain will have exactly the same binary prefix (for instance all addresses will start with `0b00101`).
49
+
To make splitting and merging deterministic, an aggregation of AccountChains into shards is based on the bit-representation of account addresses. For example, address looks like `(shard prefix, address)`. That way, all accounts in the shardchain will have exactly the same binary prefix (for instance, all addresses will start with `0b00101`).
50
50
:::
51
51
52
52
53
53
## Blockchain
54
54
55
-
An aggregation of all shards which contains all accounts behaving by one set of rules is called a **Blockchain**.
55
+
An aggregation of all shards, which contains all accounts behaving by one set of rules, is called a **Blockchain**.
56
56
57
-
In TON there can be many sets of rules and thus many blockchains which operate simultaneously and can interact with each other by sending messages crosschain in the same way that accounts of one chain can interact with each other.
57
+
In TON, there can be many sets of rules, and thus, many blockchains which operate simultaneously and can interact with each other by sending messages cross-chain in the same way that accounts of one chain can interact with each other.
58
58
59
-
### Workchain: Blockchain with your own rules
59
+
### WorkChain: Blockchain with your own rules
60
60
61
-
If you want to customize rules of the group of Shardchains, you could create a **Workchain**. A good example is to make a workchain that works on the base of EVM to run Solidity smart contracts on it.
61
+
If you want to customize rules of the group of ShardChains, you could create a **WorkChain**. A good example is to make a workchain that works on the base of EVM to run Solidity smart contracts on it.
62
62
63
63
64
64
Theoretically, everyone in community can create own workchain. In fact, it's pretty complicated task to build it, after that to pay (expensive) price of creating it and receive 2/3 of votes from validators to approve creation of your Workchain.
65
65
66
-
TON allows creating up to `2^32` workchains, each subdivided to up to `2^60` shards.
66
+
TON allows creation of up to `2^32` workchains, each subdivided into up to `2^60` shards.
67
67
68
-
Nowadays, there are only 2 workchains in TON: MasterChain and BaseChain.
68
+
Nowadays, there are only two workchains in TON: MasterChain and BaseChain.
69
69
70
-
BaseChain is used for everyday transactions between actors because it's pretty cheap, while MasterChain have a crucial function for TON, so let's cover what does it do!
70
+
BaseChain is used for everyday transactions between actors because it's pretty cheap, while MasterChain has a crucial function for TON.
71
71
72
-
### Masterchain: Blockchain of Blockchains
72
+
### MasterChain: Blockchain of Blockchains
73
73
74
-
There is a necessity for the synchronization of message routing and transaction execution. In other words, nodes in the network need a way to fix some 'point' in a multichain state and reach a consensus about that state. In TON, a special chain called **MasterChain** is used for that purpose. Blocks of _masterchain_ contain additional information (latest block hashes) about all other chains in the system, thus any observer unambiguously determines the state of all multichain systems at a single masterchain block.
74
+
There is a necessity for the synchronization of message routing and transaction execution. In other words, nodes in the network need a way to fix some 'point' in a multichain state and reach a consensus about that state. In TON, a special chain called **MasterChain** is used for that purpose. Blocks of _MasterChain_ contain additional information (latest block hashes) about all other chains in the system, thus any observer unambiguously determines the state of all multichain systems at a single MasterChain block.
0 commit comments