January 28, 2026

Capitalizations Index – B ∞/21M

Introducing Vanilla – Equilibrium Labs –

Introducing Vanilla – Equilibrium Labs –

Introduction

Near the end of 2017, as the markets started to tumble, we began exploring ways to hedge against cryptocurrency price risk without moving into fiat. We came up with Vanilla, a trustless way for creating synthetic, leveraged assets on Ethereum. Not only would it allow users to hedge price risk, it would also make sophisticated financial tools globally accessible.

Today we are making Vanilla fully open-source. While we initially had plans to commercialise the system, along the way we discovered that the regulatory burden of doing so was considerable and so we decided to just put it out there for others to build on or use instead. While it would have been tricky for us to make money by providing this service, there is nothing stopping anyone in the world from creating their own synthetic assets using Vanilla.

We are excited to see how people use Vanilla and would love to help anyone looking to extend or build on it!

How It Works

The Vanilla system allows a user to create a fully collateralised Long/Short contract with leverage, which tracks a specified price feed. The contract is created by the user via a web application and deployed to the Ethereum blockchain on the users behalf.

Vanilla consists of four distinct parts: A frontend web application, a backend, a price feed and the smart contracts. The Vanilla platform itself is based on the smart contracts and their ability to handle funds, start and close orders, and save currency pair prices on the blockchain. The backend, frontend and the price feed services collectively form our implementation of the Vanilla platform, which developers can use as a reference when creating their own implementation (feel free to also copy our code outright). They are responsible for the creation of data that gets saved on the blockchain.

The reference implementation functions as follows:

The smart contracts Oracle, OrdersManager and LongShortController are deployed, along with some number of proxy wallets, on the Ethereum blockchain. All the deployed contracts’ addresses are stored in the database, which in our implementation is MongoDB. When a user creates an order for a synthetic asset through the frontend by specifying the desired parameters, one of the proxy wallets gets assigned to the user in question, reserving it for a time period until funds come in and the option order gets created. More proxy wallets get spawned when or before demand exceeds the availability.

The Oracle contract stores key-value pairs of cryptocurrency/fiat pairs and their values. Behind the values is a separate process with no API that updates the values based on volume-weighted public API information from 6 or more different exchanges, using Redis as its database. The weighted mean of all the prices, grouped by the currency pair, gets added to a list as a moving average of the last 15 minutes. This is to prevent huge spikes in the price from triggering the contracts prematurely. The latest value then gets stored in the Oracle contract, and the OrdersManager and LongShortController can keep in touch with the latest price.

The backend then works as a contract pinger and as a transaction handler between the smart contracts. Sifting through orders in its database and the OrdersManager contract, it matches up orders, calling openLongShort on LongShortController, moving the funds away from the OrdersManager to the LongShortController along with information of the order’s parameters and the users’ preferred wallet addresses.

From this point forward, the user has information that a synthetic asset has been successfully created. LongShortController is the most independent contract of all in the system, and can be pinged by the users if for some reason the backend is down. When the ping endpoint is called, the smart contract checks if an option with a given hash has enough price fluctuation for a margin call, or exercises the option if its closing date is over expiry. Then the contract itself calculates the rewards and saves them on the blockchain. After the rewards have been calculated, a separate withdraw function can be called in the contract to withdraw funds belonging to the given address. A transaction fee is calculated and stored for the maintenance fees of the system, and transferred from time to time to the fee wallet.

Check out the full code here.

Published at Wed, 24 Apr 2019 12:23:32 +0000

Previous Article

Is Softbank Right to Stay Away From Crypto After Son’s $130M Bitcoin Loss?

Next Article

BREAKING: Samsung Planning New Blockchain Mainnet Featuring Samsung Coin

You might be interested in …

The Overlooked Value of Information

CoinSpeaker The Overlooked Value of Information Charlemagne was a powerful ruler and a famous king, but he did not earn this recognition because of his astounding swordsmanship or massive army. The reason his name went […]

Ripple price weekly analysis: xrp primed for more upsides

Ripple Price Weekly Analysis: XRP Primed For More Upsides

Ripple Price Weekly Analysis: XRP Primed For More Upsides Ripple price bounced back sharply and broke the $0.3000 resistance level against the US dollar. There was a break above a major bearish trend line with […]