In early May, a few of us from 8base, Evgeny Semushin, Gabe Kelly and myself, decided to take on the challenge of competing for the AlphaPoint prize at the Consensus 2018 Hackathon in New York City. There was a total of 33 participating teams at the hackathon, and there were some big-name sponsors such as CoinDesk, Microsoft, IBM, Hyperledger and Quorum.
The contenders in the AlphaPoint challenge had to build an application tied into a digital asset exchange and we thought that my hedge fund experience should give us an edge. We didn’t want to simply build a front-end to an existing blockchain solution. Instead, we wanted to focus on solving a real problem in a way that only blockchain architecture can enable, combining our expertise in smart contract development with knowledge of internal mechanics of finance.
We built a set of smart contracts on the Ethereum network that allows creation of decentralized derivatives with on-chain collateral management. Our solution enables anyone to underwrite a put or call option contract on any ERC20 asset without a 3rd party managing the exercise and collateral requirements. We were honored to win first prize.
Below we’ll describe the implementation detail of this project.
Derivatives are a big deal. Global derivatives are estimated to have at least ~$500 trillion market capitalization. Compare this to ~$0.4T crypto at the time of writing, ~$40T liquid money and ~$70T global stock markets, and it becomes clear how significant the role derivatives play in the global economy. Nothing shows this better than this infographic. Derivatives, such as options, futures and swaps are useful tools employed by banks, funds and companies to manage risk.
Market cap of various asset classes
The key complexity of derivative agreements stems from the fact that they are usually leveraged — meaning that potential risks exceed the amount of funds counterparties to the agreement have in their accounts. This leads to a complex system of settlement, maintenance margin and margin calls designed for counterparties to keep a level of collateral, such that it is always more expensive to walk away from an agreement than to honor it.
This system failed in 2008. Entangled in a complex web of derivative agreements, Wall Street players couldn’t efficiently unwind or net them out. This triggered a domino effect of margin calls and subsequent defaults leading to the collapse of Lehman Brothers and other players. The US government had to step in and bail out Wall Street to help unwind staggering amounts of defaulted derivative agreements. We all know the rest…
BlockSigma is a set of smart contracts that enable creation and management of derivative agreements for crypto assets. The collateral management is done on-chain and doesn’t require an intermediary to ensure that the funds locked inside of a smart contract satisfy the maintenance margin requirements.
The core innovation is fully on-chain margin management that requires no central party or oracle price feed. We achieve this by integrating with Bancor protocol. Bancor protocol is being adopted at a significant rate and already facilitating millions of dollars of daily trading activity. Bancor uses a deterministic price formula that is calculated based on supply and demand of an asset. As such, we can get the underlying token price directly on-chain, which allows us to calculate the maintenance margin requirement and trigger a margin call if necessary.
The smart contract logic is designed in a way that enables an option buyer to force-liquidate the position as soon as the collateral held inside of the smart contract drops below the mandatory margin requirement. The maintenance margin formula includes excess reserves, providing economic incentives for the option buyer to closely watch the position and grab the reserve (including the excess amount) by force-liquidating the position if the maintenance margin level is not satisfied. At the same time, it incentivizes the option seller (underwriter) to timely add more collateral if the trade goes against them, otherwise they risk losing the excess reserve.
The full source code of the solution can be found in the GitHub repo.
There are three main solidity files: BlockSigmaBase.sol, BlockSigmaCall.sol, BlockSigmaPut.sol. BlockSigmaBase implements the common logic, while BlockSigmaCall and BlockSigmaPut inherit it and implement the logic specific to call or put contracts.
Let’s look at the contract’s interface:
Now let’s walk through the key workflows of a put contract. For example, let’s consider a put contract on EOS token denominated in DAI, which effectively allows one to hedge his/her EOS holdings against the US dollar. The lifecycle of the contract is as follows:
Now let’s look at how the collateral management is done. In our example, the EOS price was at $12 at the time of option contract issuance. Let’s say now it went down to $9. The required reserve becomes 2 + max(0, 10 - 9) = 3. This means the seller needs to deposit additional 1 DAI for each contract they had underwritten. If the seller fails to do so, the buyer has an economic incentive to force the liquidation:
This motivates the buyer to force-liquidate as soon as they can as it produces an instant profit.
This solution is by no means production ready. Its main purpose is to demonstrate the groundbreaking capabilities of blockchain and smart contracts in automating settlement and collateral management of option contracts. Traditionally these services are performed by an intermediary, require manual work and cost fees.
While our solution shows great promise, there are several potentially significant challenges that we see:
If you see other issues not listed here, please let us know in comments.
The described solution gives a preview into the scope of the fundamental change that blockchain will bring to finance industry in the coming years. Not only will it make settlement and collateral management more efficient, it can provide transparent, self-enforcing rules that are applied to all market participants in the same way.
At 8base we’re not focusing on specific niche solutions or protocols as described in this article. We anticipate an explosion of similar disruptive technologies in the coming years as we continue to ride the wave of digital transformation. Instead, we focus on building the next layer of infrastructure that gives business users easy access to these technologies and the ability to incorporate them in enterprise software to drive business results.