bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 16쪽 중 12쪽
t to ADNL, the TON overlay networks usually do not support
sending datagrams to arbitrary other nodes. Instead, some semipermanent
links are established between some nodes (called neighbors with respect to
the overlay network under consideration), and messages are usually forwarded
along these links (i.e., from a node to one of its neighbors). In this way, a
TON overlay network is a (usually not full) subgraph inside the (full) graph
of the ADNL network.
Links to neighbors in TON overlay networks can be implemented using
dedicated peer-to-peer ADNL channels (cf. 3.1.5 ).
Each node of an overlay network maintains a list of neighbors (with re-
spect to the overlay network), containing their abstract addresses (which
they use to identify them in the overlay network) and some link data (e.g.,
the ADNL channel used to communicate with them).
3.3.3. Private and public overlay networks. Some overlay networks
are public , meaning that any node can join them at will. Other are private ,
meaning that only certain nodes can be admitted (e.g., those that can prove
91
3.3. Overlay Networks and Multicasting Messages
their identities as validators.) Some private overlay networks can even be un-
known to the general public. The information about such overlay networks
is made available only to certain trusted nodes; for example, it can be en-
crypted with a public key, and only nodes having a copy of the corresponding
private key will be able to decrypt this information.
3.3.4. Centrally controlled overlay networks. Some overlay networks
are centrally controlled , by one or several nodes, or by the owner of some
widely-known public key. Others are decentralized , meaning that there are
no specic nodes responsible for them.
3.3.5. Joining an overlay network. When a node wants to join an over-
lay network, it rst must learn its 256-bit network identier , usually equal
to sha256 of the description of the overlay networka TL-serialized object
(cf. 2.2.5 ) which may contain, for instance, the central authority of the over-
lay network (i.e., its public key and perhaps its abstract address, 33 ) a string
with the name of the overlay network, a TON Blockchain shard identier if
this is an overlay network related to that shard, and so on.
Sometimes it is possible to recover the overlay network description start-
ing from the network identier, simply by looking it up in the TON DHT. In
other cases (e.g., for private overlay networks), one must obtain the network
description along with the network identier.
3.3.6. Locating one member of the overlay network. After a node
learns the network identier and the network description of the overlay net-
work it wants to join, it must locate at least one node belonging to that
network.
This is also needed for nodes that do not want to join the overlay network,
but want just to communicate with it; for example, there might be an overlay
network dedicated to collecting and propagating transaction candidates for
a specic shardchain, and a client might want to connect to any node of this
network to suggest a transaction.
The method used for locating members of an overlay network is dened in
the description of that network. Sometimes (especially for private networks)
one must already know a member node to be able to join. In other cases, the
abstract addresses of some nodes are contained in the network description.
A more exible approach is to indicate in the network description only the
33 Alternatively, the abstract address might be stored in the DHT as explained in 3.2.12 .
92
3.3. Overlay Networks and Multicasting Messages
central authority responsible for the network, and then the abstract addresses
will be available through values of certain DHT keys, signed by that central
authority.
Finally, truly decentralized public overlay networks can use the dis-
tributed torrent-tracker mechanism described in 3.2.10 , also implemented
with the aid of the TON DHT.
3.3.7. Locating more members of the overlay network. Creating
links. Once one node of the overlay network is found, a special query may be
sent to that node requesting a list of other members, for instance, neighbors
of the node being queried, or a random selection thereof.
This enables the joining member to populate her adjacency or neighbor
list with respect to the overlay network, by selecting some newly-learned
network nodes and establishing links to them (i.e., dedicated ADNL point-
to-point channels, as outlined in 3.3.2 ). After that, special messages are
sent to all neighbors indicating that the new member is ready to work in the
overlay network. The neighbors include their links to the new member in
their neighbor lists.
3.3.8. Maintaining the neighbor list. An overlay network node must
update its neighbor list from time to time. Some neighbors, or at least links
(channels) to them, may stop responding; in this case, these links must be
marked as suspended, some attempts to reconnect to such neighbors must
be made, and, if these attempts fail, the links must be destroyed.
On the other hand, every node sometimes requests from a randomly cho-
sen neighbor its list of neighbors (or some random selection thereof), and uses
it to partially update its own neighbor list, by adding some newly-discovered
nodes to it, and removing some of the old ones, either randomly or depending
on their response times and datagram loss statistics.
3.3.9. The overlay network is a random subgraph. In this way, the
overlay network becomes a random subgraph inside the ADNL network. If
the degree of each vertex is at least three (i.e., if each node is connected to
at least three neighbors), this random graph is known to be connected with a
probability almost equal to one. More precisely, the probability of a random
graph with n vertices being dis connected is exponentially small, and this
probability can be completely neglected if, say, n≥ 20. (Of course, this does
not apply in the case of a global network partition, when nodes on dierent
sides of the partition have no chance to learn about each other.) On the
93
3.3. Overlay Networks and Multicasting Messages
other hand, if n is smaller than 20, it would suce to require each vertex to
have, say, at least ten neighbors.
3.3.10. TON overlay networks are optimized for lower latency. TON
overlay networks optimize the random network graph generated by the pre-
vious method as follows. Every node tries to retain at least three neighbors
with the minimal round-trip time, changing this list of fast neighbors very
rarely. At the same time, it also has at least three other slow neighbors that
are chosen completely randomly, so that the overlay network graph would al-
ways contain a random subgraph. This is required to maintain connectivity
and prevent splitting of the overlay network into several unconnected regional
subnetworks. At least three intermediate neighbors, which have intermedi-
ate round-trip times, bounded by a certain constant (actually, a function of
the round-trip times of the fast and the slow neighbors), are also chosen and
retained.
In this way, the graph of an overlay network still maintains enough ran-
domness to be connected, but is optimized for lower latency and higher
throughput.
3.3.11. Gossip protocols in an overlay network. An overlay network
is often used to run one of the so-called gossip protocols , which achieve some
global goal while letting every node interact only with its neighbors. For
example, there are gossip protocols to construct an approximate list of all
members of a (not too large) overlay network, or to compute an estimate of
the number of members of an (arbitrarily large) overlay network, using only
a bounded amount of memory at each node (cf. [15, 4.4.3] or [1] for details).
3.3.12. Overlay network as a broadcast domain. The most impor-
tant gossip protocol running in an overlay network is the broadcast protocol ,
intended to propagate broadcast messages generated by any node of the net-
work, or perhaps by one of the designated sender nodes, to all other nodes.
There are in fact several broadcast protocols, optimized for dierent use
cases. The simplest of them receives new broadcast messages and relays them
to all neighbors that have not yet sent a copy of that message themselves.
3.3.13. More sophisticated broadcast protocols. Some applications
may warrant more sophisticated broadcast protocols. For instance, for broad-
casting messages of substantial size, it makes sense to send to the neighbors
not the newly-received message itself, but its hash (or a collection of hashes
94
3.3. Overlay Networks and Multicasting Messages
of new messages). The neighbor may request the message itself after learning
a previously unseen message hash, to be transferred, say, using the reliable
large datagram protocol (RLDP) discussed in 3.1.9 . In this way, the new
message will be downloaded from one neighbor only.
3.3.14. Checking the connectivity of an overlay network. The con-
nectivity of an overlay network can be checked if there is a known node (e.g.,
the owner or the creator of the overlay network) that must be in this
overlay network. Then the node in question simply broadcasts from time
to time short messages containing the current time, a sequence number and
its signature. Any other node can be sure that it is still connected to the
overlay network if it has received such a broadcast not too long ago. This
protocol can be extended to the case of several well-known nodes; for exam-
ple, they all will send such broadcasts, and all other nodes will expect to
receive broadcasts from more than half of the well-known nodes.
In the case of an overlay network used for propagating new blocks (or
just new block headers) of a specic shardchain, a good way for a node to
check connectivity is to keep track of the most recent block received so far.
Because a block is normally generated every ve seconds, if no new block
is received for more than, say, thirty seconds, the node probably has been
disconnected from the overlay network.
3.3.15. Streaming broadcast protocol. Finally, there is a streaming
broadcast protocol for TON overlay networks, used, for example, to propa-
gate block candidates among validators of some shardchain (shardchain task
group), who, of course, create a private overlay network for that purpose.
The same protocol can be used to propagate new shardchain blocks to all
full nodes for that shardchain.
This protocol has already been outlined in 2.6.10 : the new (large) broad-
cast message is split into, say, N one-kilobyte chunks; the sequence of these
chunks is augmented to M≥N chunks by means of an erasure code such as
the ReedSolomon or a fountain code (e.g., the RaptorQ code [9] [14]), and
these M chunks are streamed to all neighbors in ascending chunk number
order. The participating nodes collect these chunks until they can recover
the original large message (one would have to successfully receive at least N
of the chunks for this), and then instruct their neighbors to stop sending new
chunks of the stream, because now these nodes can generate the subsequent
chunks on their own, having a copy of the original message. Such nodes
continue to generate the subsequent chunks of the stream and send them to
95
3.3. Overlay Networks and Multicasting Messages
their neighbors, unless the neighbors in turn indicate that this is no longer
necessary.
In this way, a node does not need to download a large message in its
entirety before propagating it further. This minimizes broadcast latency,
especially when combined with the optimizations described in 3.3.10 .
3.3.16. Constructing new overlay networks based on existing ones.
Sometimes one does not want to construct an overlay network from scratch.
Instead, one or several previously existing overlay networks are known, and
the membership of the new overlay network is expected to overlap signi-
cantly with the combined membership of these overlay networks.
An important example arises when a TON shardchain is split in two, or
two sibling shardchains are merged into one (cf. 2.7 ). In the rst case, the
overlay networks used for propagating new blocks to full nodes must be con-
structed for each of the new shardchains; however, each of these new overlay
networks can be expected to be contained in the block propagation network
of the original shardchain (and comprise approximately half its members).
In the second case, the overlay network for propagating new blocks of the
merged shardchain will consist approximately of the union of members of the
two overlay networks related to the two sibling shardchains being merged.
In such cases, the description of the new overlay network may contain an
explicit or implicit reference to a list of related existing overlay networks. A
node wishing to join the new overlay network may check whether it is already
a member of one of these existing networks, and query its neighbors in these
networks whether they are interested in the new network as well. In case
of a positive answer, new point-to-point channels can be established to such
neighbors, and they can be included in the neighbor list for the new overlay
network.
This mechanism does not totally supplant the general mechanism de-
scribed in 3.3.6 and 3.3.7 ; rather, both are run in parallel and are used to
populate the neighbor list. This is needed to prevent inadvertent splitting of
the new overlay network into several unconnected subnetworks.
3.3.17. Overlay networks within overlay networks. Another interest-
ing case arises in the implementation of TON Payments (a lightning net-
work for instant o-chain value transfers; cf. 5.2 ). In this case, rst an
overlay network containing all transit nodes of the lightning network is con-
structed. However, some of these nodes have established payment channels
in the blockchain; they must always be neighbors in this overlay network, in
96
3.3. Overlay Networks and Multicasting Messages
addition to any random neighbors selected by the general overlay network
algorithms described in 3.3.6 , 3.3.7 and 3.3.8 . These permanent links
to the neighbors with established payment channels are used to run specic
lightning network protocols, thus eectively creating an overlay subnetwork
(not necessarily connected, if things go awry) inside the encompassing (al-
most always connected) overlay network.
97
4.1. TON Ser vice Implementation Strategies
4 TON Services and Applications
We have discussed the TON Blockchain and TON Networking technologies
at some length. Now we explain some ways in which they can be combined
to create a wide range of services and applications, and discuss some of the
services that will be provided by the TON Project itself, either from the very
beginning or at a later time.
4.1 TON Service Implementation Strategies
We start with a discussion of how dierent blockchain and network-related
applications and services may be implemented inside the TON ecosystem.
First of all, a simple classication is in order:
4.1.1. Applications and services. We will use the words application
and service interchangeably. However, there is a subtle and somewhat
vague distinction: an application usually provides some services directly to
human users, while a service is usually exploited by other applications and
services. For example, TON Storage is a service, because it is designed to
keep les on behalf of other applications and services, even though a human
user might use it directly as well. A hypothetical Facebook in a blockchain
(cf. 2.9.13 ), if made available through the TON Network (i.e., implemented
as a ton-service), would rather be an application , even though some bots
might access it automatically without human intervention.
4.1.2. Location of the application: on-chain, o-chain or mixed. A
service or an application designed for the TON ecosystem needs to keep its
data and process that data somewhere. This leads to the following classi-
cation of applications (and services):
On-chain applications (cf. 4.1.4 ): All data and processing are in the
TON Blockchain.
O-chain applications (cf. 4.1.5 ): All data and processing are outside
the TON Blockchain, on servers available through the TON Network.
Mixed applications (cf. 4.1.6 ): Some, but not all, data and processing
are in the TON Blockchain; the rest are on o-chain servers available
through the TON Network.
98
4.1. TON Ser vice Implementation Strategies
4.1.3. Centralization: centralized and decentralized, or distributed,
applications. Another classication criterion is whether the application
(or service) relies on a centralized server cluster, or is really distributed
(cf. 4.1.8 ). All on-chain applications are automatically decentralized and
distributed. O-chain and mixed applications may exhibit dierent degrees
of centralization.
Now let us consider the above possibilities in more detail.
4.1.4. Pure on-chain applications: distributed applications, or
dapps, residing in the blockchain. One of the possible approaches,
mentioned in 4.1.2 , is to deploy a distributed application (commonly ab-
breviated as dapp) completely in the TON Blockchain, as one smart con-
tract or a collection of smart contracts. All data will be kept as part of the
permanent state of these smart contracts, and all interaction with the project
will be done by means of (TON Blockchain) messages sent to or received from
these smart contracts.
We have already discussed in 2.9.13 that this approach has its drawbacks
and limitations. It has its advantages, too: such a distributed application
needs no servers to run on or to store its data (it runs in the blockchain
i.e., on the validators' hardware), and enjoys the blockchain's extremely high
(Byzantine) reliability and accessibility. The developer of such a distributed
application does not need to buy or rent any hardware; all she needs to do is
develop some software (i.e., the code for the smart contracts). After that, she
will eectively rent the computing power from the validators, and will pay
for it in TON coins, either herself or by putting this burden on the shoulders
of her users.
4.1.5. Pure network services: ton-sites and ton-services. Another
extreme option is to deploy the service on some servers and make it available
to the users through the ADNL protocol described in 3.1 , and maybe some
higher level protocol such as the RLDP discussed in 3.1.9 , which can be used
to send RPC queries to the service in any custom format and obtain answers
to these queries. In this way, the service will be totally o-chain, and will
reside in the TON Network, almost without using the TON Blockchain.
The TON Blockchain might be used only to locate the abstract address
or addresses of the service, as outlined in 3.2.12 , perhaps with the aid of a
service such as the TON DNS (cf. 4.3.1 ) to facilitate translation of domain-
like human-readable strings into abstract addresses.
99
4.1. TON Ser vice Implementation Strategies
To the extent the ADNL network (i.e., the TON Network) is similar to
the Invisible Internet Project ( I 2P ), such (almost) purely network services
are analogous to the so-called eep-services (i.e., services that have an I 2P -
address as their entry point, and are available to clients through the I 2P
network). We will say that such purely network services residing in the TON
Network are ton-services.
An eep-service may implement HTTP as its client-server protocol; in
the TON Network context, a ton-service might simply use RLDP (cf. 3.1.9 )
datagrams to transfer HTTP queries and responses to them. If it uses the
TON DNS to allow its abstract address to be looked up by a human-readable
domain name, the analogy to a web site becomes almost perfect. One might
even write a specialized browser, or a special proxy (ton-proxy) that is run
locally on a user's machine, accepts arbitrary HTTP queries from an ordinary
web browser the user em프로젝트로 돌아가기