Some friends of mine are building Basis, a price-stable cryptocurrency. To learn more about the protocol and the broader ecosystem, I implemented a naive implementation of Basis in December 2017. Here’s what I did & what I learned.

See all my code at adamlouis/naiive-coin.

My Work

Protocol summary

First, I’ll give a summary of the Basis protocol as described in the whitepaper:

There exist 3 tokens in the system: coins, shares, and bonds. The system attempts to keep the price of a coin pegged to some arbitrary value. The Basis team has chosen 1 USD as the target coin price.

The coin-USD exchange price is provided to the system via an oracle feed. If the USD-coin price is lower than $1, the system contracts the coin supply to raise the coin-USD price. If the USD-coin price exceeds $1, the system expands coin supply to reduce the coin-USD price.

With a $1 target price, the re-balancing process should restore the system to a state where the number of coins in the system is equal to the market cap, assuming a price elasticity of 1.

To contract coin supply, the system holds a bond auction in which coin holders can purchase bonds using coins. Bonds either:

  1. pay out 1 coin when the system expands
  2. expire if no such expansion is required in time

“Bond” is a misnomer for these instruments, as they have characteristics of both options and bonds. They’re not bonds - they’re something new.

To expand coin supply, the system first pays out coins to all bond holders in the order the bonds were purchased. If all bond holders have been paid, the remaining coins are distributed to shareholders pro-rata.

That’s it! Read the white paper or Basis’ resources for more information.


In December 2017, I implemented the 3 token system of shares, coins, and bonds as a single Ethereum smart contract. My main goals were to better understand the Basis protocol and the greater cryptocurrency space by actually doing something. I make no attempt at a production implementation. See all my code at adamlouis/naiive-coin.

contracts/Basecoin.sol contains the solidity implementation. The protocol as described above and in the whitepaper runs off 5 salient write functions:

// transfer `value` shares from `to` to `msg.sender`
function transferShares(address to, uint value)

// transfer `value` coins from `to` to `msg.sender`
function transferCoins(address to, uint value)

// submit a vote of `price` for the current usd-basecoin exchange rate
function submitOracleExchangeRate(uint price)

// place a bid for `quantity` bonds at price `price`
// bids are destroyed in next call to tick()
function placeBondBid(uint price, uint quantity)

// read the oracle price and expand or contract the coin supply accordingly
function tick()

This API captures the basics of the system. I cut corners where possible & favored simple, naiive approaches over complicated but efficient ones. Check out the code and comments for details.

In addition to the smart contract, I wrote a React web application that is a dashboard of the Basecoin system. From this dashboard, one can:

  1. view coin, share, and bond holdings
  2. interact with the smart contract

I built this using the truffle framework. Truffle makes it easy to build javascript web apps that interact with solidity smart contracts.

I put this smart contract on the Ethereum blockchain in July 2018 at 0x4b525b3ab3599f2dc42506de304181db1f45d62ebb7616390ef2358e0aeef354

My Learnings

On Basis

Here are some of my thoughts on Basis after working on this project:


  • Price volatility of Bitcoin, Ethereum or other cryptocurrencies will be an impediment for their mass adoption as money. Even if their price volatility matched that of gold (~10% per year), they would still be unsuitable for commerce and long term financial contracts. Money is the “killer app” of blockchain and any cryptocurrency that ultimately achieves widespread use as money will have low price (purchasing power) volatility. This is great news for Basis! There is need for a stablecoin in a world with cryptocurrency.

  • Success of Basis is highly dependent on consumer distribution & utility. The likely first users are cryptocurrency traders. Expansion beyond a technically sophisticated audience though will be challenging and require significant consumer product & design work, user education, and integrations from the wider world.


Here are some technical questions related to the Basis system and its implementation on the Ethereum blockchain:

  • are the economics & price stability mechanisms of Basis viable given the gas & storage constraints? in my implementation, the cost to run tick() (the auction to re-balance the system) is expensive and scales linearly with the number of bond holders and share holders. who pays for the gas costs? how can this re-balancing happen more efficient at scale?

  • does the frequency and cost of running the auction and re-balancing the economy impose a limit to Basis’s growth? Basis can only grow after an auction / re-balance. An auction / re-balance can only happen after enough shareholders have submitted their votes on the current USD-Basis coin price. The Ethereum blockchain presently processes only ~15 transactions per second. In the success case where there are thousands or millions of Basis users, oracle votes and operations related to the auction may consume an unreasonably large portion of total Ethereum transaction resources. There is ongoing work in Ethereum to improve transaction volume, but its not live yet. How does Basis handle this?

  • How often does the economy need to re-balance for the coin prices to be stable? Or rather, what should we expect the relationship to be for time between reconciliations and price volatility to look like? How is this affected by the gas cost of re-balancing the coin supply? Is there any dynamic adaptation logic to control when auctions happen? My idea is to take as inputs: (N_current = # of oracle price votes by coin ownership), (N_last = # of oracle price votes by coin ownership at last reconciliation), (T_rec = time since last reconciliation) and trigger an auction then some threshold is met. The threshold starts at N_last and decays as T_rec increases.

  • what incentive or penalty structure makes for accurate oracle guesses? how are oracle rewards balanced with needs to expand and contract coin supply? are there scenarios where oracles would want to bid dishonestly?

  • what are the mechanics, sequencing, and frequency of the bond auctions, oracle price guessing, and expanding and contracting the coin supply? the sequencing of each of these will affect trade behavior and even currency stability. i punted this question- in my implementation, oracle price guessing and bonding bidding run continuously and supply contracts or expands at will at a call to tick().

  • in a contraction, what happens if there is insufficient bond demand? is there a risk of losing the peg or crashing if bond markets are not deep enough? in early days especially, what gives people confidence in the return of Basis to $1 amid a contracting supply? what’s the role of the pre-sale / ico funds here?

  • in an expansion, what happens if (# of share holders) >>> (# of coins for expansion)? how can coins be distributed efficiently and fairly? e.g. smallest units of coin distributed randomly to share holders pro rata.

  • what will share liquidity look like in early days? will pre-sale / ico investors be trading actively and have the tools to do so easily? does this matter?

On cryptocurrency

Below are some thoughts on Basis & cryptocurrency broadly after working on my project. First, some of my favorite reading materials:

Technical & primary sources:

Easy reads

  • Andreas Antonopoulos’s The Internet of Money 1 and The Internet of Money 2 books are fantastic, easy reads that describe bitcoin & cryptocurrency. Great for non-technical audience. Reading these books was inspiring / empowering - really makes it seem like the next frontier.

Great analysis

Critical view & humor

  • Matt Levine is my favorite finance writer. His daily email is funny & insightful. He has deep understanding of traditional finance and provides great critical commentary of cryptocurrency buzz.

My soap box:

  • Required use cases for blockchains are limited and the “killer app” of the blockchain is money. The NIST blockchain paper and Siliski’s article provide correct breakdowns of blockchain use cases. There are many creative blockchain projects, but money transfer is the single best application for a borderless, trustless, decentralized, anonymous ledger (i.e. blockchain).
Flowchart from the NIST paper via the DHS Science & Technology Directorate

  • The convenience & low cost of existing centralized products relative to new decentralized, blockchain-based products will inhibit growth of those decentralized products. Presently, most consumers are not concerned about the privacy / security / data-ownership features that many decentralized products espouse. Free, easy, frictionless, centralized consumer products are preferable to the presently expensive, cumbersome, irreversible decentralized products. I believe in most consumer domains, we will continue to trend towards more regulated centralized products rather than decentralized products with privacy built-in. Network effects & moats of existing companies/products will make it difficult for new decentralized products to break in.

  • Some argue that after the cryptocurrency bubble pops, blockchain technology absent of cryptocurrency will prevail as the major accomplishment / salient feature of the era [needs citation]. This is wrong - they are currently inseparable. Perhaps I am arguing “blockchain” semantics here. A system that isn’t solving the Byzantine generals problem of reaching consensus amongst unreliable actors isn’t a blockchain. Currently, the mining/cryptocurrency reward system is the only solution to this problem. Distributed, chained data stores are great (think git), but blockchain implies distributed consensus.

  • New “decentralized” systems can still trend towards centralization. In proof of work systems, mining can become centralized. Economies of scale make it cheaper for a few big players to build efficient, mass infrastructure. In proof of stake or distributed proof of stake systems, concentration of wealth and reliance on other actors again become issues. These problems are likely solvable, but are obstacles to the decentralized utopian narrative.