Introduction

As Ethereum’s implimentation of Casper nears, the network is getting ready to switch to PoS. If you don’t know what PoS is, here’s a quick summary from the Ethereum wiki on Github:

Proof of Stake (PoS) is a category of consensus algorithms for public blockchains that depend on a validator’s economic stake in the network. In proof of work (PoW) based public blockchains (e.g. Bitcoin and the current implementation of Ethereum), the algorithm rewards participants who solve cryptographic puzzles in order to validate transactions and create new blocks (i.e. mining). In PoS-based public blockchains (e.g. Ethereum’s upcoming Casper implementation), a set of validators take turns proposing and voting on the next block, and the weight of each validator’s vote depends on the size of its deposit (i.e. stake). Significant advantages of PoS include security, reduced risk of centralization, and energy efficiency. — Proof of Stake (POS) FAQ on Github

In a nutshell, PoS is an energy efficient and secure alternative to PoW that works by staking (depositing) your ETH. In return, validators are rewarded in ETH for processing transactions on the network and creating new blocks. However, no plans have been made to allow staking with tokens so far.

With the recent rise of Decentralized Exchange (DEX) protocols such as AirSwap and 0x, that got me thinking;

“What if we could stake ERC-20 tokens on the Ethereum blockchain using a DEX protocol?”

Initial Phase

At first I thought that through a Decentralized Application (Dapp) using a smart contract and the 0x protocol, we could stake individual tokens on the Ethereum blockchain.

It would go something like this:

The user decides to stake an ERC-20 token (say SNT) on the Ethereum blockchain using our Dapp. The SNT is sent to the smart contract, converted into ETH through the 0x protocol. The ETH is staked until the user wishes to withdraw their deposit. When the user decides to withdraw their deposit, they get back their initial deposit plus whatever reward they earned through staking as interest (converted from ETH to SNT).

One problem with this approach however is that it does not allow the staking of baskets of tokens or rather it would be too complicated to build.

That’s when I found {Set}

Enter {Set}

{Set} is a new primitive that facilitates the low-cost, trustless creation and exchange of a collateralized basket of tokens. — website — whitepaper

{Set} is a new protocol that enables anybody to easily create a collateralized basket of ERC20 tokens on the Ethereum Blockchain. {Sets} would be like tokenized Index Funds or ETFs. Being able to wrap several tokens into a single {Set} (which is also it’s own ERC-20 token btw!) has several advantages like:

Being able to save on gas when transferring several tokens at once.

They are fully collateralized.

Composed of a limitless numbers of tokens, as long as they’re ERC-20.

Can be traded and their underlying tokens can be redeemed at any time.

The {Set} protocol is exciting enough with just these benefits but one thing that is particularly amazing is potential use case that caught my eye while reading the whitepaper:

Let’s say a developer wants programmatically to process a file in a MapReduce fashion on computers all over the world using Golem and then store it in a decentralized manner using Storj. Using a decentralized exchange protocol such as 0x protocol, the developer can programmatically purchase a single {ComputeStore Token} which is composed of 100x Golem and 100x Storj tokens using wrapped Ether, ether that has been converted into the ERC20 specification. Then the developer can call the redeem function in the {ComputeStore Token} contract to get the underlying Golem and Storj tokens for usage on the Golem and Storj networks. Any unused tokens can be traded, sold, or issued into a new {Set}.

What it’s basically saying is that {Sets} can be used to wrap several tokens and pay for a service using only one token. In this case you’re paying to process and store a file using only one token and paying one gas fee.

Staking with {Sets}

With those capabilities in my mind, using a {Set} and the 0x protocol, any ERC-20 tokens you put in your Set could be used to Stake ETH on the Ethereum blockchain.

You can hold ERC-20 tokens in a {Set}, use the 0x protocol to exchange them to ETH in real time and stake them that way. As soon as you wrant to stop staking you can take them out and you will have your {Set} back with all of the original tokens that were there initially. Since {Sets} automatically rebalance themselves, ETH earned as a reward from staking would go into the {Set} and be returned as the tokens you had initially in the same ratio as before. So if you have a {Set} with a value of $10K, 50% ETH, 25% OMG and 25% BAT. You stake that {Set}, it gets converted into ETH through a Dapp, you earn say 5 ETH from staking. Those 5 ETH would be redistributed among your {Set} in order to conserve the initial ratio by using the 0x protocol to exchange in real time.

There are several issues with this idea however that I’ve noticed: