Creating Trustless Pools and Staking for All
It’s been a long time since I’ve sat down to write a development progress article within LinkPool. That’s not to say we’ve not been busy, rather the contrary. Over the past few months, we’ve had a hugely successful product launch with the Market, started on-boarding new developers and continued working on our staking offering.
This article will focus on our recent progress with our staking contracts, as there’s been considerably huge progress in opening up our pool/staking to 3rd parties, other networks and any generic pooling use-case.
When we first set out to develop a staking platform for Chainlink way back in 2017, it went through a variety of iterations. The first initial PoC was more custodial, moving tokens to team owned wallets that’d be staked on our nodes. We didn’t want to settle for a custodian solution, so we worked with the Chainlink team to understand how we could become trustless resulting in our announcement in early 2018.
Now, we’re happy to announce that with substantial re-work, our staking contracts are completely trustless for any pooling or staking implementation. What does that mean exactly? Well, within the same parent contracts, we can now support staking & pooling for any network or any use-case. This isn’t bound to staking-as-a-service, rather providing audited contracts that can fairly distribute any form of revenue between a set of wallets.
- ICO Pools: People receive a fair amount of a given token based on how much they contribute.
- On-Chain Companies: Distribute revenue to a set of individuals based on an amount of vested stake within the company.
- DAOs: Allowing people to contribute money into a pool that’s invested elsewhere, with any return being then distributed to the people who’ve invested into it.
Additional examples regarding staking support for other networks:
- ETH 2.0: With the move of PoS, we could deploy our contracts on the new chain and support their PoS.
- Cross-Chain Staking: With also leveraging Chainlink within the contracts, we can support cross-chain staking by using oracles to provide wrapped tokens within our contracts that are distributed amongst the stakers for any network.
Keep in mind that these pools are now not just managed by us (LinkPool) as a central entity. Anyone will be able to submit their pooling implementations to us for approval, then they can get added and be shown within our staking app UI like our own pools are.
This means that in the future, rather than our staking app being a central place to stake tokens on LinkPool for Chainlink, you’ll be able to browse many pools. Pools that could be for ETH, pools that can be for DAOs or ICOs like mentioned above. The staking app will become a hub of everything that is poolable, giving a catalogue of trustless implementations that any user can see as an opportunity.
Since anyone can submit their pools to LinkPool, we expect a lot of node operators to take our standard Chainlink implementation and then use it to allow others to stake on their node. Not only does this blow the door wide open for staking on the network in general, it will bolster the security of the Chainlink network for every contract creator who wants to use it. By allowing any Chainlink node to become a pool, we anticipate a significant increase in the amount of LINK collateral which will be locked up in the network. We see this as a win-win scenario for the community.
Open Source and Audited
Before I show an example implementation, it’s worth us commenting on our dedication to the open-source community. As we’ve always stated, our contracts will be made open-source at the time of our full release, and we’ll be providing audit reports to provide a strong level of security guarantee in their use.
This is a huge advantage to the use of our contracts, as anyone who creates a pool implementation has the guarantee that our main contracts they hook into are audited and tested, giving confidence to both developers and end-users while reducing additional expensive audits.
To create a staking/pool contract within the LinkPool staking platform, simply implement the following interface:
Within the interface, there are functions for withdrawal, rewards, locked and penalties. To give a brief summary:
- withdraw: The function an end-user calls if they wish to withdraw their balance from a pool.
- withdrawTo: A function used by the parent contracts for fees. This function should only be called and locked to our parent contract address. It’s called during distribution to send our admin fee to us, and the pool creators’ fee to them.
- rewards: Should return the amount of rewards that are unlocked and are free to be distributed to the stakers in the pool.
- locked: The current amount of value that is currently locked within the pool. In the context of Chainlink, this would return the amount of tokens that are currently locked in active requests that require collateral.
- penalties: The amount of tokens that have been penalised in the pool. If there are penalties returned prior to when rewards are distributed to stakers, the pool enters a re-reimbursement phase where the amount lost has to be transferred back into the pool prior to distributing any rewards.
An example implementation of this interface is the one we’re building for Chainlink:
Note: We will be updating the contracts to be compatible with Solidity 0.5.0.
By the above implementation, you should be able to see how tokens are staked into the pool. By defining a
onTokenTransfer method that confides to the LINK token ERC677 standard, we receive a stake which is then registered with the parent contracts.
The staked amounts are currently stored within the staking implementation as we’re currently awaiting the official implementation of staking from the Chainlink team, but you should be able to picture how we then will hook into those contracts to provide a trustless staking mechanism for any node on the network.
This implementation should help to envision how you can then take this example, and match it to other potential uses for any staking or pooling services using native currency or a token. We’ll also be able to take these contracts and deploy them on any EVM based chain, or any chain that allows the compilation of Solidity for their smart contracts.
Thanks for spending time to read the article, it’s been a privilege and a pleasure to develop these contracts to allow for something that we believe has never been done before. We can’t wait to launch our staking platform in the future, and we look forward to providing more updates in due course.