Skip to content

Instantly share code, notes, and snippets.

@liuchengxu
Created August 16, 2021 15:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liuchengxu/b1419fa5c65c03fbbe205d0d7abfcbab to your computer and use it in GitHub Desktop.
Save liuchengxu/b1419fa5c65c03fbbe205d0d7abfcbab to your computer and use it in GitHub Desktop.

PoA consensus on Substrate

We are pleased to announce that Canyon Labs had received an open grant from the Web3 Foundation to implement Proof-of-Access (PoA) consensus on Substrate a month ago. Today, we are announcing the delivery of phrase 2 of Canyon Network grant, which showcases the ability to run a local development canyon node with PoA consensus enabled. This is the first crucial step towards our ultimate goal of launching Canyon Network in the Polkadot ecosystem.

What's Canyon Network

Canyon is a permanent storage network built on Substrate, which records the hashes of files on-chain and stores the actual files off-chain. By combining PoS with the PoA consensus, Canyon greatly reduces the barriers to entry for the storage miners, who are incentivized to store as much data as possible for winning the rewards. Being a PoS system, canyon has more chances to become a platform that is capable of providing high quality of storage services in a trustless way as long as we can design an effective slashing and rewarding machinism. The mission of Canyon Network is to become a truly usable and sustainable storage infrastructure for Web3.0.

What's Proof of Access

The Proof of Access consensus was initially adopted by the project Arweave, which serves as an enhancement of Proof of Work in which the entire recall block data is included in the material to be hashed for the input to the proof of work. The recall block is a random block in the block history selected based on the previous block hash. To mine a new block, the miner must have the new block's recall block data to create a storage proof demonstrating the miner has access to the recall block.

For a blockchain-based decentrailzed storage network, there are normally two kinds of consensus in the system: one is the traditional blockchain consensus for solving the leader selection problem and collectively maintaining the ledger, PoS, PoW, etc, the other is a storage-oriented consensus to make sure the data can be properly stored onto the network, Filecoin's ZK proof and Crust's TEE solution, etc. Comparing with the other storage consensus, PoA is super light and has a pretty low entry for the storage miners. Please refer to the white paper for more information.

PoA on Substrate

In this grant, we implemented the prototype of PoA consensus by developing serveral client and runtime modules, which will be the foundation of future work. The main modules are depicted as follows:

  • cc-rpc: this module provides the RPC interfaces for users to submit and retrieve the transaction data.

  • cc-datastore: this module is responsible for the persistence of transaction data, it is currently implemented based on the offchain db.

  • cc-consensus-poa: this module implements the core algorithm of PoA. Due to PoA is typically used as a requirement of the block construction, an implementation of inherent data provider is also provided. The verification is acheived by creating a nested block import. Please see the white paper or the rustdoc for the details of PoA workflow.

  • pallet-poa: this pallet is used to process the PoaOutcome generated by cc-consensus-poa on each block, which will deposit a consensus log using the consensus id POA: if the nework data is not empty. This module records the history depth info that can be used to estimate the storage ratio of each validator, which is the key element of the future slashing and rewarding design.

Please refer to the testing guide to run a local node and test the above features.

Future work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment