Opium Protocol: start trading derivatives within 20 minutes

Andrey Belyakov
Jan 22 · 7 min read

Why we developed Opium Protocol?

The Opium Protocol is a universal protocol to easily create, settle and trade virtually all derivatives and financial instruments in a professional and trustless way.

Why is it interesting to use? Because it is quick and highly beneficial for both users and developers: users now only need to choose the ticker (instrument) that will be traded, all the rest is taken care of by the ecosystem, from creating and trade until expiration. Developers now have audited, secure framework for developing derivatives in a professional way, compliant with financial market standards.

Yes, we build the financial ecosystem that can work with any ticker professionally:

  1. Create tickers/derivatives: a ticker is a specific instrument with a unique code that is backed by the logic of the deal and the logic of the oracle solution. A ticker is made up from the derivative and oracle recipes and the parameters (such as maturity, margin and strike price) that make up the agreement
  2. Trade tickers/derivatives: plain or combined orders, limit orders, expiration orders. Each order is signed by a user and allows Opium to execute the desired trade. Orders can be constructed conveniently so that combined orders for tokens or portfolios can be carried out
  3. Settle — once the order is settled (and collateral (margin) is locked by the blockchain) it stays there till the moment of expiration/maturity
  4. Maturity/expiration — parties will get the payout according to the oracle and derivative logic at the expiration

So you see that we narrow the complicated derivative market to only two essential things: define oracle and define instrument. Then you can create professional ticker and trade your derivative using the professional and safe ecosystem.

Risks: We made the system professional and secure, but of course, you need to be careful with tickers that you trade — if they are corrupted, you may be trading something else than you think. If you don’t have a technical background and thus can’t understand some parts of the guide that we’ve written (still we tried to make it the way everyone could understand), you should only trust the tickers created by notable projects. It is easy to see who created the ticker; for example, the first implementation of the Opium Protocol has a “Derivative Explorer” page with all relevant data. Moreover, Opium Team created most of the popular derivatives already: futures, options, CDSs, and more as well as the most popular oracles.

At the same time, we see the following trends:

I. Innovation and technology are booming: we are all entering the new era of technologies that become inseparable from our everyday lives. In the middle of the 2000s, we have a similar experience with computer technologies, and now it’s time for the blockchain. We have come closer than ever before!

II. The financial sector is still the most significant sector of the global economy and is still the most conservative part of it. That is very inefficient in terms of global technological progress and stops its comprehensive implementation.

III. Derivatives are the most significant part of the financial sector, and the derivatives market is the biggest in the world.

The developers of the Opium Protocol are professional derivatives traders and fund managers, mathematicians, and developers, who bring together the best from the old and innovative markets. We have also taken lessons from the existing distributed finance solutions and adopted them in terms of the Opium protocol philosophy. We build Opium based on fundamental rules of the financial market, but as a fully decentralized protocol.

We also employ best practices from the blockchain community. For example, we don’t have a utility token with its complicated and fragile economy, and we also share fees with the decentralized community, not only parties who have professional equipment for running relays or executing orders.

Understanding the technical structure of Opium Protocol

Opium Protocol consists of 4 layers:

Off-chain layer — meta-transactions

The process starts with the off-chain matching of orders. A user creates an order (meta-transaction), signs it, and sends it to the relay. The relay will process it: match with the appropriate order or share it with another relayer.

Layers of Opium Network

Order layer — Opium Match

After users sent their orders to the relayer, orders are matched and broadcasted to the blockchain of the Order layer. Here the contract creates new positions out of the collateral (stable coins or other margin tokens). Alternatively, at this layer, Opium can execute swaps of positions and ERC20 tokens in a complex combination with all-or-nothing logic.

Users provide let this Opium Match contract move their tokens according to the logic of their order.

Derivative layer — Opium core

This layer may be called ‘a bookkeeper,’ as it carefully registers all the payments and collateral ever made though the system. Oracle register stores all the data, supplied by oracle recipes, that were ever requested by the system. If ten thousand options are outstanding with the same oracle recipe, this means that the data is transferred once to the blockchain, and every option can fetch the data from the registry. Thus everyone gets the same data in the safest way possible.

Position token layer — Opium minter

Opium Minter is responsible for minting Opium derivative tokens and Opium portfolio tokens. When two matched orders are processed by the Opium match contract and Opium core contract, the Opium minter contract mints new Opium derivative tokens on behalf of the Core contract, and burns them once the contract is executed. The Minter also takes care of composing, recomposing, and decomposing Opium derivative tokens into Opium portfolio tokens.

Any long- or short-term position on Opium protocol is represented by a token, minted as soon as the position is created. Why create a token for each position? In order to have the possibility to resell it. When the deal is executed, the token owner receives the payment and the token burns.

Some features

Ideal for portfolios

Financial instruments, most of the time, are combined and managed as portfolios. This motivates us to create a possibility to wrap several tokens into a portfolio that is represented by one token. Once a portfolio is created, it is stored on the owner’s balance, and corresponding tokens are deleted from the blockchain.

Also, users may safely extract tokens from their portfolio.

Recompose option adds/takes several tokens to/from an existing portfolio in a gas efficient way. Once composed, the whole portfolio can be managed or traded as a single token, saving gas and implementing convenient financial logic.

ERC-721o tokens: extended 721-standard for the financial instruments

The ERC-721o token standard is a combination of the ERC-20 and ERC-721 token standards with extra functionalities.

It allows for batch transfer (and thus optimizing gas usage) and natively creating portfolios. In financial markets, instruments can be the same and interchangeable with each other, but there are many types of different instruments. Different by maturity, underlying or standard conventions. Our inspiration to develop this token standard comes from the real financial markets, where often positions are traded in large, and portfolios are used to take multiple positions at once, without having the risk of one leg of the portfolio not being executed (see examples below). At the same time, ERC-721o tokens are backward compatible with the ERC-721 token standard and thus can be traded in existing ecosystems where, for example, relayers use the 0x protocol.

ERC-721o standard

Opium margin: collateral for the deal

To create a derivative contract, participants must provide collateral (margin) that is used to pay the counter-party if there is a liability on a position. Within this margin, the position payout is guaranteed for the counter-party. In general, the maximum amount of profit to be earned is known for both counter-parties. Depending on how derivative recipes are structured, insurance products can be connected to guarantee payouts above the placed margins by counter-parties.

In the Opium protocol, we define collateral as any ERC-20 token, so lots of stable coins, gold, and even promising enterprise solutions. We do not limit users and developers to use a particular token.

Users can choose their desired token as a margin and create the corresponding derivative ticker (a unique Opium instrument). Specifications of the derivative contract include the type and amount of margin token, so participants can assess the risks connected to this contract and know what the maximum delivery of which amount of tokens is. As an example, USDT and DAI are both stable coins pegged to the US Dollar but carry inherently different risks. The Opium Protocol is unbiased towards the usage of margin tokens. Users can choose themselves which tokens they use as collateral.

How it works: margin and derivatives

You can create any almost derivative within just 20 min.

The Opium Protocol is open and understands the logic of financial markets. Thus it is compatible with other protocols — centralized and decentralized.

What can be built upon Opium Protocol and how fast?

Opium protocol can be utilized to create exchanges, trading instruments and any tickers. What’s more, it takes you only 20 minutes to do all that — it has never been so easy, inexpensive and quick to start trading and using derivatives.

Stay tuned.

— — — — — — — — — — — — — — — — — — — — — — — — — — — —

The full code is audited (by the SmartDec) and will be open-sourced in February 2020 here

More information about Opium Protocol you can find on our website.

Follow Opium.Team on Twitter and join our group in Telegram.

Opium Team

Opium Protocol is the universal protocol to create, settle and trade virtually all derivatives in a trustless way.

Thanks to Anastasia Korchagina

Andrey Belyakov

Written by

CEO, Opium Protocol

Opium Team

Opium Protocol is the universal protocol to create, settle and trade virtually all derivatives in a trustless way.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade