IPFS is a storage system designed to store precious data of all mankind for perpetual data storage, therefore, whether it is IPFS or Filecoin, its characteristics lie in storage. However, Swarm is different. Swarm mainly serves the storage of DApp data on the Ethernet network, and the focus is on the storage of hot data, so the focus of Swarm is on traffic.
The flow reward mechanism is exactly one of the core mechanisms of Swarm. Today, we will try to talk about Swarm’s traffic mechanism, SWAP, in easy-to-understand language.
SWAP-Swarm’s traffic reward
The SWAP protocol is the core protocol of Swarm, a peer-to-peer bookkeeping protocol whose main feature is data exchange (traffic flow), divided into two main parts: bookkeeping and settlement, as stated in the white paper: “The SWAP protocol allows directly connected nodes to pay each other, or provide payment commitments”.
SWAP has four main features.
- Account services for nodes to pay each other and provide payment commitments
- Sending checks when payment thresholds are exceeded, using automatic payment settlement
- Debt forgiveness in the form of uncashed checks
- Support for starting nodes with zero pledges
Simply put, when a miner joins the Swarm network and becomes a Swarm node, he or she is given an Owner address (which is an ETH address), and at the same time, a chequebook-checkbook is automatically generated for that address.
For example, you are node A and I am node B.
When node A transmits or stores data to node B (when the traffic of data transmission reaches a certain threshold), A will issue a check to B, which we can call a settle. The Swarm network currently has about hundreds of thousands of nodes, and every data interaction and transaction between each node is synchronized to the chequebook.
To understand the whole process, we first need to understand the following three concepts.
On-chain: i.e. data is on-chain, for example, when A issues a check to B, B receives the check and can choose to settle it on-chain.
Off-chain: That is, the data is not on the chain, and is kept off-chain. For example, when B receives a check issued by A, it is not on the chain first, and then it will be on the chain after accumulating a certain number of checks.
Threshold: SWAP has a threshold concept, when the accumulated checks reach a certain threshold, it will use the automatic settlement payment function, if A does not give settlement with B, A will be pulled into B’s blacklist, and A will not be able to connect with B again.
The above diagram is also marked in this way, green is on-chain, pink is off-chain, and on-chain and off-chain can be converted autonomously.
As shown above, when node B has accumulated a certain amount of A’s checks, B will send a request to A’s smart contract to settle the BZZ corresponding to the checks (at this point, it will be transferred from off-chain to on-chain), then A’s checkbook will deduct the corresponding BZZ (for example, 0.5 BZZ), and then the 0.5 BZZ will appear in B’s checkbook, which means that the proceeds of the 0.5 BZZ belong to B owner address.
Then, the settlement status will be synchronized under the chain as well.
From the above, we have described the traffic reward mechanism of Swarm.
The core of Swarm’s traffic reward mechanism lies in the traffic reward obtained by nodes providing broadband transmission data. Nodes can obtain a check for each data transmission, and the number of checks will be automatically settled (or can be actively settled) when the corresponding threshold value is reached, then the nodes can obtain the corresponding reward rewards.
Related Q & A about SWAP
Q: Why do we need a checkbook instead of direct settlement?
A: Swarm network is a huge traffic network, nodes and nodes are transmitting data to each other all the time. Maybe one second node A transmits data to node B, and A needs to pay B. The next second, node B transmits data to node A, at which time B has to pay A.
This back and forth, between A and B, soon get even?
In addition, if all small transactions are directly on the chain and redeemed, the network may need to redeem millions of times a day, which will undoubtedly increase the burden of the network and generate a lot of GAS fees.
By using the checkbook method, we can achieve perfect off-chain bookkeeping and on-chain settlement, which not only improves efficiency but also does not affect miners’ revenue.
Q: What are the penalties if a node does not pay and how to guarantee the network’s completeness?
A: The SWAP protocol has an automatic payment settlement system, which means that the smart contract will automatically send a check when the threshold value is exceeded. As we can see in the figure below, the system is set up with a “Zero balance”, so if one of the parties is in serious “debt”, then the node will be disconnected from the ongoing connection.
As shown above, if B does not pay, B will be labeled as “dishonest”, and if there is continuous unwillingness to pay, B will lose connection with more and more nodes, then B will be “isolated”, and the probability of receiving orders will continue to decline.
Q: Why does the SWAP protocol create an ecological loop for the Swarm network?
A: As mentioned above, if a node chooses to “do evil” and “not pay”, it will be disconnected from other nodes, and if it continues to do so, it will lose connection with many other nodes one after another, and even be “isolated”.
If a node is “isolated” in the network, it means that the node can not get orders in the Swarm network, then it can not get block rewards, since it can not get block rewards, then where is the meaning of node existence?
In summary, the Swarm network itself has set up a relatively complete ecological closed loop.
And this, in turn, is why the core logic of inferring that Swarm nodes do not require a large amount of pledges.
Posted by:CoinYuppie，Reprinted with attribution to:https://coinyuppie.com/analysis-of-swarm-traffic-reward-mechanism/
Coinyuppie is an open information publishing platform, all information provided is not related to the views and positions of coinyuppie, and does not constitute any investment and financial advice. Users are expected to carefully screen and prevent risks.