argonprotocol / mainchain

The Argon is an inflation-proof stablecoin powered by Bitcoin
https://argonprotocol.org
MIT No Attribution
4 stars 1 forks source link

Argon

An inflation-proof stablecoin backed by Bitcoin and the Ulixee data network. The Argon is designed as a transactional currency that can scale to micropayments as low as 1 millionth of a dollar. It is built on the Polkadot Substrate framework.

Overview

The Argon mainchain is the stabilization layer of the Argon network. Argon stabilizes the value of the Argon by removing excess currency from supply when the price of argon falls below target (ie, less is desired by the market) and minting new supply when price is above target (ie, more is in demand than exists).

Minting can be done through two mechanisms. The first is via mining for the Argon, where miners are given permission to mint new Argons when the price is above target. The second is through a "Liquid Locking" offering for Bitcoins, where Bitcoins are able to mint liquidity equal to their Bitcoin's market value by committing to locking their Bitcoins and an equivalent amount of Argons for a year.

The Bitcoin bonds transform into "options" that allow a holder to profit from the volatility of both the Bitcoin price and the Argon price. To call an option, a Bitcoin holder must issue a "system burn" of argons equivalent to the current market price of Bitcoin. This creates a dynamically adjusting "burn rate" to forcefully remove unwanted currency from the system (unwanted, meaning, the market price of the Argon is below target, ergo less desirable).

The Argon's second layer of excess currency removal (ie, stabilization) occurs through the collection of a tax on all transactions that occur on the L2 of the Argon network, the Localchains. This second layer tax will dynamically adjust to the price of the Argon, ensuring sufficient supply can be removed quickly from the system.

Localchains are the person-to-person Layer 2 of the Argon network. They are a personal "blockchain" that keeps a cryptographic proof of the "current balance" of each user, which can be signed and sent to another user for exchanging funds. Localchains are expected to be used for high-frequency transactions, such as micropayments for queries in Ulixee Datastores. Localchains submit balance changes in "notarizations" to the Argon mainchain via Notaries, which are network approved entities that audit the balance changes and batch them to the mainchain.

Consensus

The Argon mainchain uses a hybrid consensus model. The first form of consensus is a Randomx proof-of-compute algorithm that is active during "Slot Zero" before miners register for slots. Randomx was developed as part of the Monero blockchain to create a proof of work that does not favor GPUs, allowing regular desktops to compete. The argon has no funds minted in the genesis block, so this period can be viewed as the bootstrapping period for the network.

The second form of consensus is a registered mining phase, where miners bid for slots to mine blocks. They must bid by using bonded argons from a Vault in the system. All mining argons must have an equivalent amount of Bitcoin bonded, which will bring liquidity to the system. Miners are given priority to register blocks in the system over proof of compute blocks, so once this phase activates, the network will be secured by the miners and only use proof of compute when no miners are registered or active. Miners are matched to votes provided by Localchain users using an XOR closest algorithm (more details to come in the whitepaper).

Technology Brief

The Argon mainchain is built using the Substrate framework. Substrate is a modular blockchain framework that allows developers to build custom blockchains that operate independently, but can connect into a shared ecosystem called "Parachains". Substrate is built in Rust and has a WebAssembly runtime that allows for upgrades to the blockchain without forks. Argon runs as a "solochain", which means our consensus is not shared with other chains. It will gain integration through a "Transferchain" that allows for the transfer of Argons between chains.

The Localchain is a Rust library that can be run in a standalone cli, within Node.js via bindings created using napi-rs or as a library in iOS/Android using uniffi. It uses a Sqlite database to store the balance changes and notarizations.

The Notary is a Rust-based API that uses Json-RPC to communicate with the Localchains and the Argon mainchain. It uses a PostgresSQL database to keep track of its history and users' balance tips.

Repository Structure

Runtime Pallets

Argon makes use of a few runtime pallets that are useful to know about as a user of the system.

Using the Testnet

The Argon testnet is a network that is intended to be used for testing and development. You can connect to the Polkadot Developer Portal to interact with the testnet. We are also publishing binary versions of the localchain and bitcoin cli that are useful to test out connecting to the testnet. Those versions can be found on the releases page.

Useful Urls:

Here are some tutorials to get you started:

Running Locally

Depending on your operating system and Rust version, there might be additional packages required to compile this project. Check the Substrate Install instructions for your platform for the most common dependencies.

Build

Use the following command to build the tools without launching it:

cargo build --release

Launch a local test network

The following command starts a local test network that will not persist state. NOTE: you need postgres sql installed and available.

./scripts/local_testnet.sh

Connect with Polkadot-JS Developer Admin Front-End

After you start the network locally, you can interact with it using the hosted version of the Polkadot/Substrate Portal.

You can also find the source code and instructions for hosting your own instance on the polkadot-js/apps repository.