From e9a9d1689787e5de2575cb242aefe471846f7bb4 Mon Sep 17 00:00:00 2001 From: Fuxing Loh Date: Thu, 15 Sep 2022 01:09:26 +0800 Subject: [PATCH 1/5] restructure "MetaChain Protocol" --- docs/:300:MetaChain Protocol/:200:consensus.md | 3 +++ docs/:300:MetaChain Protocol/:200:improvement-proposal.md | 3 --- .../:600:node-upgrades.md} | 0 3 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 docs/:300:MetaChain Protocol/:200:consensus.md delete mode 100644 docs/:300:MetaChain Protocol/:200:improvement-proposal.md rename docs/{:900:MetaChain Governance/:200:node-upgrades.md => :300:MetaChain Protocol/:600:node-upgrades.md} (100%) diff --git a/docs/:300:MetaChain Protocol/:200:consensus.md b/docs/:300:MetaChain Protocol/:200:consensus.md new file mode 100644 index 00000000..aa658656 --- /dev/null +++ b/docs/:300:MetaChain Protocol/:200:consensus.md @@ -0,0 +1,3 @@ +--- +title: MetaChain Consensus +--- diff --git a/docs/:300:MetaChain Protocol/:200:improvement-proposal.md b/docs/:300:MetaChain Protocol/:200:improvement-proposal.md deleted file mode 100644 index 713b3486..00000000 --- a/docs/:300:MetaChain Protocol/:200:improvement-proposal.md +++ /dev/null @@ -1,3 +0,0 @@ ---- -title: MetaChain Improvement Proposal ---- diff --git a/docs/:900:MetaChain Governance/:200:node-upgrades.md b/docs/:300:MetaChain Protocol/:600:node-upgrades.md similarity index 100% rename from docs/:900:MetaChain Governance/:200:node-upgrades.md rename to docs/:300:MetaChain Protocol/:600:node-upgrades.md From f72d716e206d22c0d677f839836f60d278439a12 Mon Sep 17 00:00:00 2001 From: Fuxing Loh Date: Fri, 16 Sep 2022 01:14:16 +0800 Subject: [PATCH 2/5] chore(docs): add a wip draft of MetaChain consensus --- .../:100:what-is-metachain.md | 11 ++- .../:110:what-is-nativechain.md | 5 ++ .../:200:DeFiChain Basics/:120:what-is-dfi.md | 5 ++ docs/:200:DeFiChain Basics/:500:wallet.md | 5 ++ .../:100:whitepaper.md | 5 ++ .../:300:MetaChain Protocol/:200:consensus.md | 84 +++++++++++++++++++ .../:300:token-bridge.md | 5 ++ .../:600:node-upgrades.md | 5 ++ 8 files changed, 119 insertions(+), 6 deletions(-) diff --git a/docs/:200:DeFiChain Basics/:100:what-is-metachain.md b/docs/:200:DeFiChain Basics/:100:what-is-metachain.md index 130e728f..14234769 100644 --- a/docs/:200:DeFiChain Basics/:100:what-is-metachain.md +++ b/docs/:200:DeFiChain Basics/:100:what-is-metachain.md @@ -2,6 +2,11 @@ title: What is MetaChain? --- +:::div{class="admonitions yellow"} +Currently work in progress — this article/page is consider draft, the information reflected here might not be +up-to-date. +::: + `DeFiCh/metachain` started as a codename research & development for [DFIP 2111-B: VOC: Ethereum Virtual Machine (EVM) Support](https://github.com/DeFiCh/dfips/issues/96). Proposed as a DFIP on Nov 2021; DFIP 2111-B provided DeFiChain with more flexibility to think beyond what is possible today. It @@ -9,9 +14,3 @@ introduced a new dimension to the DeFiChain ecosystem, allowing us to stretch th - Smart contract capability through a turing-complete environment for faster paced innovation - Embrace the multi-chain future enabling easier cross compatibility and extensibility. - ---- - -:::div{class="admonitions red"} -TODO -::: diff --git a/docs/:200:DeFiChain Basics/:110:what-is-nativechain.md b/docs/:200:DeFiChain Basics/:110:what-is-nativechain.md index e0ae8995..257637de 100644 --- a/docs/:200:DeFiChain Basics/:110:what-is-nativechain.md +++ b/docs/:200:DeFiChain Basics/:110:what-is-nativechain.md @@ -1,3 +1,8 @@ --- title: What is NativeChain? --- + +:::div{class="admonitions yellow"} +Currently work in progress — this article/page is consider draft, the information reflected here might not be +up-to-date. +::: diff --git a/docs/:200:DeFiChain Basics/:120:what-is-dfi.md b/docs/:200:DeFiChain Basics/:120:what-is-dfi.md index 597400b7..f73dbe37 100644 --- a/docs/:200:DeFiChain Basics/:120:what-is-dfi.md +++ b/docs/:200:DeFiChain Basics/:120:what-is-dfi.md @@ -1,3 +1,8 @@ --- title: What is DFI? --- + +:::div{class="admonitions yellow"} +Currently work in progress — this article/page is consider draft, the information reflected here might not be +up-to-date. +::: diff --git a/docs/:200:DeFiChain Basics/:500:wallet.md b/docs/:200:DeFiChain Basics/:500:wallet.md index d6634377..f0ed5aca 100644 --- a/docs/:200:DeFiChain Basics/:500:wallet.md +++ b/docs/:200:DeFiChain Basics/:500:wallet.md @@ -1,3 +1,8 @@ --- title: DeFiChain Wallets --- + +:::div{class="admonitions yellow"} +Currently work in progress — this article/page is consider draft, the information reflected here might not be +up-to-date. +::: diff --git a/docs/:300:MetaChain Protocol/:100:whitepaper.md b/docs/:300:MetaChain Protocol/:100:whitepaper.md index 75c26f76..4d68d9de 100644 --- a/docs/:300:MetaChain Protocol/:100:whitepaper.md +++ b/docs/:300:MetaChain Protocol/:100:whitepaper.md @@ -1,3 +1,8 @@ --- title: MetaChain Whitepaper --- + +:::div{class="admonitions yellow"} +Currently work in progress — this article/page is consider draft, the information reflected here might not be +up-to-date. +::: diff --git a/docs/:300:MetaChain Protocol/:200:consensus.md b/docs/:300:MetaChain Protocol/:200:consensus.md index aa658656..30e9139a 100644 --- a/docs/:300:MetaChain Protocol/:200:consensus.md +++ b/docs/:300:MetaChain Protocol/:200:consensus.md @@ -1,3 +1,87 @@ --- title: MetaChain Consensus --- + +:::div{class="admonitions yellow"} +Currently work in progress — this article/page is consider draft, the information reflected here might not be +up-to-date. +::: + +## Proof-Of-? + +'Proof-Of-x' is often colloquially referred to as the consensus mechanism generally agreed upon between multiple for +moving the chain forward. Given there is no disagreement between multiple actors, a consensus is achieved. Since its +genesis, DeFiChain has used a proof-of-stake consensus mechanism adapted from Bitcoin Core's original Proof-of-Work +(PoW) implementation for moving the chain forward. + +```mermaid +graph LR + +n[UTXO Based Ledger] +m[EVM Based Ledger] + +subgraph "NativeChain (PoS)" +n +end + +subgraph "MetaChain (PoA)" +m +end + +n --Mint Block--> m +n --Propogate Block--> m + +``` + +For the purpose of describing the different DeFiChain consensus at play, NativeChain refers to the UTXO Bitcoin-based +chain, while MetaChain refers to the EVM-based chain. + +### Proof-Of-Stake (PoS) at NativeChain + +NativeChain utilizes a Proof-of-Stake (PoS) algorithm similar to Bitcoin Core's original Proof-of-Work (PoW) mining +algorithm. Validators are selected in proportion to their quantity of holdings in the associated cryptocurrency. + +NativeChain uses the concept of Masternode for its PoS implementation. To run a Masternode on NativeChain, a staker must +hold a minimum of 20,000 DFI. Masternodes on NativeChain participate in active transaction validations and block +creations. Each staking node can perform only 1 hash per second, with the nonce from the Bitcoin Core PoW algorithm +replaced by a staker's masternode ID. + +### Proof-Of-Authority (PoA) at MetaChain + +The Proof-Of-Authority (PoA) is a consensus method that gives a designated number of actors the power to validate +transactions within the network. MetaChain validators are Masternodes appointed from the NativeChain group of +validators. Running a Masternode on NativeChain allows the actor to validate transactions on the MetaChain network as +they do on the NativeChain network. + +## MetaChain Consensus-lite Design + +Operating on a consensus-lite design via Proof-Of-Authority (PoA), the MetaChain embeds each EVM Block on the +NativeChain. It relies on NativeChain peer-to-peer networking for block propagation. Connectivity between NativeChain +and MetaChain is established through a common JSON-RPC secured within a trusted communication medium. + +### Block Creation + +When the NativeChain validator finds a valid hash, it will instruct the attached MetaChain node to mint a new block. The +attached MetaChain node will mint a new block encoded +with [SCALE CODEC](https://docs.substrate.io/reference/scale-codec/). The newly minted block will be next on top of the +current tip, embedded into the NativeChain block index and propagated via NativeChain peer-to-peer networking. + +### Block Connecting + +MetaChain has no peer-to-peer (p2p) networking capability; encoded blocks are imported and propagated via the +NativeChain p2p network. The encoded blocks are imported into MetaChain during NativeChain `connectBlock()`. MetaChain +does its block validation separately and in addition to NativeChain's validation. Once validated and indexed on +MetaChain, NativeChain will deem the entire block as valid during the `connectBlock()` subroutine. + +### Benefits of a consensus-lite Design + +Utilizing a consensus-lite design removes the usual complexity and problems that arise from a consensus-heavy design. +Piggybacking on NativeChain, we isolate and concentrate consensus design decisions into the NativeChain. Rollback and +fork resolutions become a non-issue on MetaChain as the NativeChain handles it. + +> ### Precedent for Innovation +> +> To set the precedent for innovation, MetaChain consensus is designed to be consensus-lite for continuous and +> sustainable iterative development. MetaChain is designed to be operated as a parallel subnet of the NativeChain; it +> utilizes the NativeChain consensus mechanism to move the chain forward, allowing more subchains to be abstracted and +> added. diff --git a/docs/:300:MetaChain Protocol/:300:token-bridge.md b/docs/:300:MetaChain Protocol/:300:token-bridge.md index 41547f6a..c38c89df 100644 --- a/docs/:300:MetaChain Protocol/:300:token-bridge.md +++ b/docs/:300:MetaChain Protocol/:300:token-bridge.md @@ -1,3 +1,8 @@ --- title: MetaChain Tokens & Bridge --- + +:::div{class="admonitions yellow"} +Currently work in progress — this article/page is consider draft, the information reflected here might not be +up-to-date. +::: diff --git a/docs/:300:MetaChain Protocol/:600:node-upgrades.md b/docs/:300:MetaChain Protocol/:600:node-upgrades.md index 32c6924c..edfed530 100644 --- a/docs/:300:MetaChain Protocol/:600:node-upgrades.md +++ b/docs/:300:MetaChain Protocol/:600:node-upgrades.md @@ -1,3 +1,8 @@ --- title: MetaChain Node Upgrades --- + +:::div{class="admonitions yellow"} +Currently work in progress — this article/page is consider draft, the information reflected here might not be +up-to-date. +::: From feb7c1c0c453784c0b7bbd36077743a953602a63 Mon Sep 17 00:00:00 2001 From: Fuxing Loh Date: Fri, 16 Sep 2022 13:16:19 +0800 Subject: [PATCH 3/5] fix typos --- docs/:300:MetaChain Protocol/:200:consensus.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/:300:MetaChain Protocol/:200:consensus.md b/docs/:300:MetaChain Protocol/:200:consensus.md index 30e9139a..f1108473 100644 --- a/docs/:300:MetaChain Protocol/:200:consensus.md +++ b/docs/:300:MetaChain Protocol/:200:consensus.md @@ -11,8 +11,8 @@ up-to-date. 'Proof-Of-x' is often colloquially referred to as the consensus mechanism generally agreed upon between multiple for moving the chain forward. Given there is no disagreement between multiple actors, a consensus is achieved. Since its -genesis, DeFiChain has used a proof-of-stake consensus mechanism adapted from Bitcoin Core's original Proof-of-Work -(PoW) implementation for moving the chain forward. +genesis, DeFiChain has used a Proof-Of-Stake (PoS) consensus mechanism adapted from Bitcoin Core's original +Proof-Of-Work (PoW) implementation for moving the chain forward. ```mermaid graph LR From d035e0f08bdab9cf2ac85c4e54c7b90bca352710 Mon Sep 17 00:00:00 2001 From: Fuxing Loh <4266087+fuxingloh@users.noreply.github.com> Date: Fri, 16 Sep 2022 18:30:34 +0800 Subject: [PATCH 4/5] Apply suggestions from code review Co-authored-by: Eli <31790206+eli-lim@users.noreply.github.com> Signed-off-by: Fuxing Loh <4266087+fuxingloh@users.noreply.github.com> --- docs/:300:MetaChain Protocol/:200:consensus.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/:300:MetaChain Protocol/:200:consensus.md b/docs/:300:MetaChain Protocol/:200:consensus.md index f1108473..df19d491 100644 --- a/docs/:300:MetaChain Protocol/:200:consensus.md +++ b/docs/:300:MetaChain Protocol/:200:consensus.md @@ -7,9 +7,9 @@ Currently work in progress — this article/page is consider draft, the informat up-to-date. ::: -## Proof-Of-? +## Proof-of-? -'Proof-Of-x' is often colloquially referred to as the consensus mechanism generally agreed upon between multiple for +'Proof-Of-x' is often colloquially referred to as the consensus mechanism generally agreed upon between multiple actors for moving the chain forward. Given there is no disagreement between multiple actors, a consensus is achieved. Since its genesis, DeFiChain has used a Proof-Of-Stake (PoS) consensus mechanism adapted from Bitcoin Core's original Proof-Of-Work (PoW) implementation for moving the chain forward. @@ -57,7 +57,7 @@ they do on the NativeChain network. Operating on a consensus-lite design via Proof-Of-Authority (PoA), the MetaChain embeds each EVM Block on the NativeChain. It relies on NativeChain peer-to-peer networking for block propagation. Connectivity between NativeChain -and MetaChain is established through a common JSON-RPC secured within a trusted communication medium. +and MetaChain is established through JSON-RPC, secured within a trusted communication medium. ### Block Creation From 0dc475c52aad0073a108cc26fd654e3ecb04bdb9 Mon Sep 17 00:00:00 2001 From: Fuxing Loh Date: Sun, 18 Sep 2022 23:41:22 +0800 Subject: [PATCH 5/5] Rename all 'Proof-Of-' to 'Proof-of-' as suggested. --- docs/:300:MetaChain Protocol/:200:consensus.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/:300:MetaChain Protocol/:200:consensus.md b/docs/:300:MetaChain Protocol/:200:consensus.md index df19d491..3b71389e 100644 --- a/docs/:300:MetaChain Protocol/:200:consensus.md +++ b/docs/:300:MetaChain Protocol/:200:consensus.md @@ -9,10 +9,10 @@ up-to-date. ## Proof-of-? -'Proof-Of-x' is often colloquially referred to as the consensus mechanism generally agreed upon between multiple actors for -moving the chain forward. Given there is no disagreement between multiple actors, a consensus is achieved. Since its -genesis, DeFiChain has used a Proof-Of-Stake (PoS) consensus mechanism adapted from Bitcoin Core's original -Proof-Of-Work (PoW) implementation for moving the chain forward. +'Proof-of-' is often colloquially referred to as the consensus mechanism generally agreed upon between multiple actors +for moving the chain forward. Given there is no disagreement between multiple actors, a consensus is achieved. Since its +genesis, DeFiChain has used a Proof-of-Stake (PoS) consensus mechanism adapted from Bitcoin Core's original +Proof-of-Work (PoW) implementation for moving the chain forward. ```mermaid graph LR @@ -36,7 +36,7 @@ n --Propogate Block--> m For the purpose of describing the different DeFiChain consensus at play, NativeChain refers to the UTXO Bitcoin-based chain, while MetaChain refers to the EVM-based chain. -### Proof-Of-Stake (PoS) at NativeChain +### Proof-of-Stake (PoS) at NativeChain NativeChain utilizes a Proof-of-Stake (PoS) algorithm similar to Bitcoin Core's original Proof-of-Work (PoW) mining algorithm. Validators are selected in proportion to their quantity of holdings in the associated cryptocurrency. @@ -46,16 +46,16 @@ hold a minimum of 20,000 DFI. Masternodes on NativeChain participate in active t creations. Each staking node can perform only 1 hash per second, with the nonce from the Bitcoin Core PoW algorithm replaced by a staker's masternode ID. -### Proof-Of-Authority (PoA) at MetaChain +### Proof-of-Authority (PoA) at MetaChain -The Proof-Of-Authority (PoA) is a consensus method that gives a designated number of actors the power to validate +The Proof-of-Authority (PoA) is a consensus method that gives a designated number of actors the power to validate transactions within the network. MetaChain validators are Masternodes appointed from the NativeChain group of validators. Running a Masternode on NativeChain allows the actor to validate transactions on the MetaChain network as they do on the NativeChain network. ## MetaChain Consensus-lite Design -Operating on a consensus-lite design via Proof-Of-Authority (PoA), the MetaChain embeds each EVM Block on the +Operating on a consensus-lite design via Proof-of-Authority (PoA), the MetaChain embeds each EVM Block on the NativeChain. It relies on NativeChain peer-to-peer networking for block propagation. Connectivity between NativeChain and MetaChain is established through JSON-RPC, secured within a trusted communication medium.