Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Write blogpost explaining the Stablecoin project #20

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added docs/basis_whitepaper_en.pdf
Binary file not shown.
31 changes: 31 additions & 0 deletions docs/blogpost.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# How to Develop a Stablecoin with Substrate

This blogpost will cover how I built a non-collateralized stablecoin with [Substrate](https://substrate.dev/).

We will cover ... TODO: topics

## Introduction to Stablecoins
A stablecoin is a cryptocurrency aiming at price stability. They aim to address the problem where cryptocurrencies are not usable for day-to-day transactions because of their excessive volatility. Following the [CENTRE Whitepaper](https://www.centre.io/pdfs/centre-whitepaper.pdf) we can categorize stablecoins into 3+1 categories:

1. **Fiat-collateralized**: Fiat assets in reserves collateralize tokens and thus provide price stability by pegging token value to reserved fiat value. Examples for this is Tether (USDT), True USD (TUSD) and USD Coin (USDC) as well as many others.
2. **Crypto-collateralized**: Crypto assets in reserves collateralize tokens and provide price stability pegged to the value of those reserved crypto assets. Examples of this Dai (DAI) by MakerDAO and the Acala Network (aUSD).
3. **Algorithmic non-collateralized**: Software economic models aim to provide price stability without relying on underlying collateralized assets. An example of this is the now defunct Basis.
4. **Hybrid**: A blend of the three basic approaches above.

The stablecoin developed here is an algorithmic non-collateralized stablecoin mostly following the [Basis Whitepaper](https://www.basis.io/basis_whitepaper_en.pdf). It will thus regulate its own supply based on its price provided by a price oracle. Two other assets called Bonds and Shares are used to achieve that supply adjustment.

TODO: write about contrast to collateralized stablecoins.

## Components of a Stablecoin Built with Substrate
In order to build a stablecoin with Substrate we will create a re-usable pallet that encapsulates the core logic. We will then instantiate it in the runtime of an example node and integrate it with other pallets that will provide the price oracle.

### Stablecoin Pallet
The pallet contains the implementation of the stablecoin according to the behavior outlined in the [Basis Whitepaper](https://www.basis.io/basis_whitepaper_en.pdf).

### Example Node
The example node combines the stablecoin pallet with the price oracles and allows testing and interaction.

### Price Oracle Pallets
The price oracle consists of a simple pallet storing the current price as well as an offchain worker pallet collecting prices from outside of the substrate chain.

## Summary