andrarchy cross-posted this post in Koinos last year


Fogata - mining pools for koinos

in #koinoslast year

There is almost two months since the mainnet launch of koinos blockchain. The performance has been outstanding since then. No issues with the block production or downtimes. Koinos Group has also locked the system contracts, meaning that they don't have control over them anymore and now all the updates to the blockchain must be done using the governance system.

In terms of decentralization there are around 30 block producers. However, 4 of them control 75% of the production, which is high but at the same time normal because the blockchain is very new.

Decentralization is a key aspect of blockchain technology. It refers to the distribution of power or influence among multiple parties, rather than being concentrated in a single entity. When it comes to blockchain networks, decentralization is typically achieved through the use of nodes, which are computers that participate in the network by validating transactions and adding them to the blockchain.

One way to increase decentralization in koinos blockchain is to allocate more tokens for block production. This allocation consist in burning koin in order to generate Virtual Hash Power (VHP). The block producers are chosen by the network based on the number of tokens they hold. And they receive back the invested koins as they are mining blocks.

Allocating more tokens for block production can help to decentralize the network by increasing the number of validators and spreading the influence among them. This can make the network more resilient to attacks or censorship, as it would require a larger number of validators to act in concert in order to compromise the network.

However, not all people are willing to run a node because of the tech resources and the maintenance efforts required to run it. This is where mining pools come into place. A mining pool is a group of people that join forces in a single block producer. The more mining pools has the network the more decentralized it is.

Right now there is 1 mining pool in koinos, burnkoin, which is managed by Luke Willis and Kui. Its performance has been very good and it has helped to join forces to secure the network.

Now it's time to create more mining pools to take network decentralization to the next level in order to bring more security and reliability to the network. Let's introduce FOGATA.


https://fogata.io

fogata in dark.png

Fogata is not just a mining pool, it's a pool of mining pools. It's a tool to create, interact and list different mining pools in koinos blockchain. From the infrastructure point of view each mining pool has the same infrastructure as solo mining: It requires a node running the koinos blockchain configured for block production. The difference is that the producer is controlled by a smart contract. So, each mining pool has a smart contract.

This smart contract defines how a group of people can collaborate together to have a common address holding Virtual Hash Power (VHP), and use this VHP to produce blocks. The contract gives the production rights to a specific account, the node operator, who is responsible for providing the hardware and run the node for block production. And this node operator receives a certain percentage of the profits made by the pool. The rest of the profits are distributed to the participants of the pool, and optionally to specific accounts defined as "beneficiaries" (like the sponsors contract, which will be explained later on).

Owner of a pool

The creator of a mining pool is called the Owner and he can define the following parameters for the pool:

  • Name and description.
  • Node operator: The owner registers the public key of the node operator in the PoB contract.
  • Percentages for participants: Rewards to the people joining the pool.
  • Percentages for beneficiaries: Profits destinated to the node operator and/or other entities.
  • Reburn period: This defines the frequency of the reburns, and it also calculates the amount of KOIN that each user can withdraw.

Also, in testnet and in the launch of the first fogata pool in the mainnet, the owner has the option to pause the contract, which stops payments, deposits, and withdrawals, and it will be used only to resolve bugs in the first month. After that, the pauser will be removed (and the upgradability of the contract will be locked as well).

Stake

The participants can send KOIN or VHP to the pool. In the case of KOIN, it is burned in order to get VHP. In return they will receive a token defining the stake in the pool. This token is not transferrable and it's used to calculate the rewards for each user. The rewards are proportional to the stake.

Unstake

The participants can unstake at any time. And this unstake can be in VHP or KOIN. In the case of KOIN, the contract defines a limit depending on the stake of the user to guarantee that all participants can get KOIN before burning it again.

Reburn period and distribution of KOIN

One of the challenges in the design for the pools was the logic to distribute KOINs to the participants. Some of the important points desired in fogata are:

  • It must define a limit of withdrawal of KOIN for each user depending on the stake.
  • It needs to take into account only the stake used during the block production. That is, if the user stakes more KOIN or VHP in the last instant, this change should not be taken into account in the current distribution of KOIN, but in a next period.
  • The pool should be able to scale to thousands of participants. Then it cannot use for/while loops in this distribution because transactions are rejected by the blockchain after reaching some limit of computation. Note: The distribution to beneficiaries is an exception and it can use loops because it is expected to use a small number of beneficiaries.

The resultant design in Fogata to meet these requirements is the following:

  • The contract has a reburn period.
  • It takes a snapshot of the stakes on each period (similar to the snapshots taken in the ERC20 tokens, which do not use loops).
  • It takes a snapshot of the KOINs mined on each period.
  • The KOINs mined in a previous period are distributed in the next period based on the snapshot of the stakes. When a user checks the balance, these KOINs are calculated and the user has the option to withdraw them or not.
  • The user can withdraw small amounts of KOIN. Then the contract counts the withrawn koin on each account to be able to make the comparison with the limit of KOIN for that period.
  • At the end of the period, the KOINs that were not withdrawn are burned, and the counters are reset to zero for the next period.

Sponsors contract and Vapor

In Fogata we also want to fund projects that help to grow of koinos blockchain. For this reason it was created "Sponsors", which is a project that receives KOINs from the community in order to create a common fund for different projects/proposals related to koinos blockchain. In return, the contract mints VAPOR for the contributor, which is the governance token that will define which projects will receive the funds through a voting system.

vapor-icon.png

Tokenomics of VAPOR: 100% of VAPOR tokens are minted through contributions of KOIN. Before March 1st of 2023, the ratio will be 20:1 (20 VAPOR of each KOIN contributed). After that, this ratio will decrease constantly until March 1st of 2024, where the ratio will be 1:1 (1 VAPOR for each KOIN contributed). And it will continue with this ratio after that.

The owner of each mining pool can set Sponsors as one of the beneficiaries and define the percentage. This is optional. If it is defined then the pool will send part of the rewards there and the VAPOR generated will be distributed to the participants of the pool (using the snapshot of the stakes). In this way, the participants of the pool will be the ones that will decide which projects will be funded.

Note: The Sponsors contract is not yet ready. For the moment it only has the VAPOR token with its tokenomics. The final implementation will be done in the future and its design will be similar to the Hive Proposal System.

Mana for block production

The contract has an extra feature that allows to the owner to insert a certain amount of KOINs in the pool to be used for the consumption of mana during the block production. In this way, the pool will not have to use the mana of the KOINs mined, and they can be distributed.

List of pools

In Fogata, the pool parameters are not hardcoded in the code but are saved in the storage of the contract. This design makes it easy configurable, then it is possible to deploy different contracts with different configurations using the same WASM compilation.

The website of Fogata allows different entities to launch their own pool, and list all of these pools in the main page.

image.png

Each pool shows the final APY after removing the contribution to Sponsors and node operator fees. The percentage to Sponsors is also displayed using the VAPOR symbol, and the pools with the highest percentages will be in the top list.

Testing period

Fogata has been tested in Harbinger (the testnet of koinos blockchain) with good results. There were some bugs identified and they were fixed.

For the mainnet, Fogata will start with 2 pools. And these pools will have extra powers for the Owners in a period of 1 month. This power includes the ability to update the contract or pause deposits/withdrawals. And it will be used only to resolve critical bugs or add extra features that can be identified.

After 1 month these powers will be removed from the contracts. And Fogata will be open so others can submit their own pools.

Team behind Fogata

  • @jga - Leader. Developer of the smart contracts.
  • Psidentity. Developer of the website.

FAQs

  1. I'm block producer in koinos blockchain. What are the advantages of setting a pool in Fogata?
    You can earn more KOINs because you can set a fee to the users that join to your pool. So your earnings are the same plus these fees.

  2. Is the contract audited?
    No. Koinos blockchain is very new so we are in a very early stage where there are no auditors. The code is provided with a MIT License. However, I gained enough experience in koinos to the point that I helped to Koinos Group to identify different bugs in the core and system contracts (for instance, one that could be gamed in PoB contract for extra earnings and that was solved using delays). Of course this is not a guarantee that Fogata is free of bugs but it's done with rigor and it has been tested in the testnet with good results.

  3. What is the role of the contract in the governance system of Koinos blockchain?
    The creator of the pool is free to define how to vote for proposals in the governance system. For the moment there is no an internal voting system implemented in the pool but this will be added in future releases.

  4. What is the difference between Fogata mining pools and Burnkoin in terms of earnings and APY?
    Fogata has a logic to control the limits of KOIN that each user can withdraw. This is to guarantee that all users can withdraw KOIN frequently without having to depend on KoinDX to trade VHP for KOIN. The APY is defined by each pool. The webpage will show the APY of each one in the list so each user can make a comparison before joining a pool.

  5. Can I contribute directly to Sponsors contract and get VAPOR without being involved in a mining pool?
    Yes. Anyone can contribute to Sponsors. And the amount of VAPOR received follows the same logic. You can do it through the sponsors contract in koinosblocks.

  6. Can I remove my contribution to Sponsors?
    No. Once the transfer is done the contribution can not be removed.

  7. What are the requisites to be in the list of approved mining pools?
    Since any contract can be submitted to Fogata, all pools are verified before adding them to the list of approved pools to protect the users.
    The contract must: 1) use a valid Fogata version. 2) delegate all authorizations to the authorize function. And 3) have only 1 implementation, that is, no previous contracts (this is to prevent manipulation of the storage data).
    This is the default configuration when using the Fogata webpage to deploy new pools.

  8. Is it possible to upgrade a contract to a new version of Fogata?
    The authorize function doesn't allow to upgrade the contract. Then it is necessary to deploy a new contract and notify the users to move to the new one.

  9. Is the code open source?
    Yes. The contract can be found in https://github.com/joticajulian/fogata and the webpage in https://github.com/tenonedesign/fogata-ui.

Acknowledgments

Many thanks to Psidentity for working in the website. His work has allowed to speed up the release of Fogata. Thanks to Karlos for the design of the logos. And thanks to Andrew, Ron, Moto, Ron, IssacDozier, Imjwalker, Amikob, and the private sponsors for their support in Github Sponsors.

If you like this work please consider becoming an sponsor in https://github.com/sponsors/joticajulian or send a donation to 1z629tURV9KAK6Q5yqFDozwSHeWshxXQe.

Join a pool today 🚀 fogata.io is a valuable resource for people looking to contribute to the decentralization of the Koinos network and earn rewards for their efforts.

Sort:  

Dear @andrarchy,
Our previous proposal expired end of December and the Hivebuzz project is not funded anymore. May we ask you to review and support our new proposal (https://peakd.com/me/proposals/248)?
Thank you for your help!