Free TON blockchain needs all newly created blocks to be validated. This work is performed for reward by the Validator. However, becoming a validator requires substantial cryptocurrency deposits that might far exceed an individual validator budget. DePool Smart Contract solves this problem. It provides pooling of deposits from different contributors to participate in the creation of PoS blocks.
Terminology
Elector is a smart contract that conducts elections of a validator, counts “votes” and announces the election results.
DePool Proxy is a smart contract that delivers messages between DePool and Elector, since they are on different systems and cannot communicate directly.
Participant — an assistant, sponsor investor of the validator.
Validator is software that launches a blockchain node. Each DePool only works with one node.
Validator wallet is the financial minimum of the validator, a guarantee that they can be elected and receive rewards.
Stake is the participant’s share so that the validator can be elected. Stakes have a minimum threshold in DePool.
Investment round starts with investing the stakes in DePool and finishes when DePol returns them back to the participants.
Architecture
DePool receives investment stakes from Participants, allocate the pool funds to a validator in order to participate in elections. After the end of the election, DePool rewards the Participants.
DePool has a limited time for accepting stakes — until the expiration of the Elector timer. Timer contract is used to call DePool.
DePool Helper asks Timer to call it periodically and transmits every call from Timer to DePool.
DePool must be linked to a validator wallet to participate in elections on behalf of the latter.
When Elector unfreezes validator stakes, DePool returns its stake back with round rewards: 25% goes to Validator wallet balance, 5% goes to DePool itself, and 70% is distributed among all Participants in the investment round.
Procedure
1. Preliminary (RoundStep.Pooling) — the round is ready to receive stakes from Participants.
2. Step «Waiting for Elector Request» (RoundStep.WaitingValidatorRequest) — waiting for an election request from Validator wallet.
3. «Waiting for a stake to be accepted» (RoundStep.WaitingIfStakeAccepted) — an election request has been received from the Validator wallet. Now DePool attaches the round stake to the request, passes it to the Elector and waits for a response.
4. «Waiting for validation start» (RoundStep.WaitingValidationStart) — if the stake is accepted, then the Validator has become a candidate. The voter counts the votes to find out if the Validator won the election.
6. «Waiting for stake unfreezing » (RoundStep.WaitingUnfreeze).
7. «Waiting for reward» (RoundStep.WaitingReward) — Elector returned the steaks to DePool. Now DePool needs to ask Elector to distribute rewards to the Participants.
8. «Completion» (RoundStep.Completing) — after processing all stakes for the round, DePool rewards Participants.