...
This commit is contained in:
19
_archive/technology/consensus3_mechanism/consensus3.md
Normal file
19
_archive/technology/consensus3_mechanism/consensus3.md
Normal file
@@ -0,0 +1,19 @@
|
||||

|
||||
|
||||
# DAO Consensus Engine
|
||||
|
||||
!!!include:dao_info
|
||||
|
||||
## DAO Engine
|
||||
|
||||
On TFGrid 3.0 ThreeFold has implemented a DAO consensus engine using Polkadot/Substrate blockchain technology.
|
||||
|
||||
This is a powerful blockchain construct which allows us to run our TFGrid and maintain consensus on global scale.
|
||||
|
||||
This system has been designed to be compatible with multiple blockchains.
|
||||
|
||||
!!!include:consensus3_overview_graph
|
||||
|
||||
!!!include:consensus3_toc
|
||||
|
||||
!!!def alias:consensus3,consensus_engine
|
@@ -0,0 +1,17 @@
|
||||

|
||||
|
||||
### consensus engine in relation to TFT Farming Rewards in TFGrid 3.0
|
||||
|
||||
!!!include:consensus3_overview_graph
|
||||
|
||||
The consensus engine checks the farming rules as defined in
|
||||
|
||||
- [farming logic 3.0](farming_reward)
|
||||
- [farming reward calculator](farming_calculator)
|
||||
|
||||
- if uptime + 98% per month then the TFT will be rewarded to the farmer (for TFGrid 3.0, can change later).
|
||||
|
||||
All the data of the farmer and the 3nodes are registered on TFChain
|
||||
|
||||
|
||||
!!!include:consensus3_toc
|
@@ -0,0 +1,44 @@
|
||||
|
||||
## Consensus 3.X Oracles used
|
||||
|
||||
Oracles are external resources of information.
|
||||
|
||||
The TFChain captures and holds that information so we get more certainty about the accuracy.
|
||||
|
||||
We have oracles for price & reputation for e.g. TF Farmers and 3Nodes.
|
||||
|
||||
These oracles are implemented on TF_CHAIN for TFGrid 3.0.
|
||||
|
||||
```mermaid
|
||||
|
||||
|
||||
graph TB
|
||||
subgraph Digital Currency Ecosystem
|
||||
money_blockchain[Money Blockchain Explorers]
|
||||
Exch1[Money Blockchain Decentralized Exchange]
|
||||
OracleEngine --> Exch1[Polkadot]
|
||||
OracleEngine --> Exch1[Money Blockchain Exchange]
|
||||
OracleEngine --> Exch2[Binance Exchange]
|
||||
OracleEngine --> Exch3[other... exchanges]
|
||||
end
|
||||
subgraph ThreeFold Grid
|
||||
Monitor_Engine --> 3Node1
|
||||
Monitor_Engine --> 3Node2
|
||||
Monitor_Engine --> 3Node3
|
||||
end
|
||||
subgraph TFChainNode1[TFGrid Blockchain Node]
|
||||
Monitor_Engine
|
||||
Explorers[TFChain Explorers]-->TFGridDB --> BCNode
|
||||
Explorers --> BCNode
|
||||
ConsensusEngine1-->BCNode[Blockchain Validator Node]
|
||||
ConsensusEngine1 --> money_blockchain[Money Blockchain]
|
||||
ConsensusEngine1 --> ReputationEngine[Reputation Engine]
|
||||
ReputationEngine --> Monitor_Engine[Monitor Engine]
|
||||
ConsensusEngine1 --> OracleEngine[Oracle For Pricing Digital Currencies]
|
||||
end
|
||||
|
||||
```
|
||||
|
||||
> TODO: outdated info
|
||||
|
||||
!!!include:consensus3_toc
|
@@ -0,0 +1,51 @@
|
||||
|
||||
```mermaid
|
||||
graph TB
|
||||
subgraph Money Blockchain
|
||||
money_blockchain --> account1
|
||||
money_blockchain --> account2
|
||||
money_blockchain --> account3
|
||||
click money_blockchain "/threefold/#money_blockchain"
|
||||
end
|
||||
subgraph TFChainNode1[TFChain BCNode]
|
||||
Explorer1-->BCNode1
|
||||
ConsensusEngine1-->BCNode1
|
||||
ConsensusEngine1 --> money_blockchain
|
||||
ConsensusEngine1 --> ReputationEngine1
|
||||
ReputationEngine1 --> Monitor_Engine1
|
||||
click ReputationEngine1 "/info/threefold/#reputationengine"
|
||||
click ConsensusEngine1 "/info/threefold/#consensusengine"
|
||||
click BCNode1 "/info/threefold/#bcnode"
|
||||
click Explorer1 "/info/threefold/#tfexplorer"
|
||||
end
|
||||
subgraph TFChainNode2[TFChain BCNode]
|
||||
Explorer2-->BCNode2
|
||||
ConsensusEngine2-->BCNode2
|
||||
ConsensusEngine2 --> money_blockchain
|
||||
ConsensusEngine2 --> ReputationEngine2
|
||||
ReputationEngine2 --> Monitor_Engine2
|
||||
click ReputationEngine2 "/info/threefold/#reputationengine"
|
||||
click ConsensusEngine2 "/info/threefold/#consensusengine"
|
||||
click BCNoBCNode2de1 "/info/threefold/#bcnode"
|
||||
click Explorer2 "/info/threefold/#tfexplorer"
|
||||
|
||||
end
|
||||
Monitor_Engine1 --> 3Node1
|
||||
Monitor_Engine1 --> 3Node2
|
||||
Monitor_Engine1 --> 3Node3
|
||||
Monitor_Engine2 --> 3Node1
|
||||
Monitor_Engine2 --> 3Node2
|
||||
Monitor_Engine2 --> 3Node3
|
||||
click 3Node1 "/info/threefold/#3node"
|
||||
click 3Node2 "/info/threefold/#3node"
|
||||
click 3Node3 "/info/threefold/#3node"
|
||||
click Monitor_Engine1 "/info/threefold/#monitorengine"
|
||||
click Monitor_Engine2 "/info/threefold/#monitorengine"
|
||||
|
||||
|
||||
```
|
||||
|
||||
*click on the parts of the image, they will go to more info*
|
||||
|
||||
> TODO: outdated info
|
||||
|
@@ -0,0 +1,45 @@
|
||||
# Consensus Mechanism
|
||||
|
||||
## Blockchain node components
|
||||
|
||||
!!!include:consensus3_overview_graph
|
||||
|
||||
- A Blockchain node (= Substrate node) called TF-Chain, containing all entities interacting with each other on the TF-Grid
|
||||
- An explorer = a Rest + GraphQL interface to TF-Chain (Graphql is a nice query language to make it easy for everyone to query for info)
|
||||
- Consensus Engine
|
||||
- is a Multisignature Engine running on TF-Chain
|
||||
- The multisignature is done for the Money BlockchainAccounts
|
||||
- It checks the AccountMetadata versus reality and if ok, will sign, which allows transactions to happen after validation of the "smart contract"
|
||||
- SLA & reputation engine
|
||||
- Each node uptime is being checked by Monitor_Engine
|
||||
- Also bandwidth will be checked in the future (starting 3.x)
|
||||
|
||||
### Remarks
|
||||
|
||||
- Each Monitor_Engine checks uptime of X nr of nodes (in beginning it can do all nodes), and stores the info in local DB (to keep history of check)
|
||||
|
||||
## Principle
|
||||
|
||||
- We keep things as simple as we can
|
||||
- Money Blockchain blockchain used to hold the money
|
||||
- Money Blockchain has all required features to allow users to manage their money like wallet support, decentralized exchange, good reporting, low transaction fees, ...
|
||||
- Substrate based TFChain is holding the metadata for the accounts which express what we need to know per account to allow the start contracts to execute.
|
||||
- Smart Contracts are implemented using multisignature feature on Money Blockchain in combination with Multi Signature done by Consensus_Engine.
|
||||
- on money_blockchain:
|
||||
- each user has Money BlockchainAccounts (each of them holds money)
|
||||
- there are normal Accounts (means people can freely transfer money from these accounts) as well as RestrictedAccounts. Money cannot be transfered out of RestrictedAccounts unless consensus has been achieved from ConsensusEngine.
|
||||
- Restricted_Account
|
||||
- On stellar we use the multisignature feature to make sure that locked/vesting or FarmingPool cannot transfer money unless consensus is achieved by the ConsensusEngine
|
||||
|
||||
- Each account on money_blockchain (Money BlockchainAccount) has account record in TFChain who needs advanced features like:
|
||||
- lockup
|
||||
- vesting
|
||||
- minting (rewards to farmers)
|
||||
- tfta to tft conversion
|
||||
|
||||
- The Account record in TFGrid_DB is called AccountMetadata.
|
||||
- The AccountMetadata describes all info required to be able for consensus engine to define what to do for advanced features like vesting, locking, ...
|
||||
|
||||
> TODO: outdated info
|
||||
|
||||
!!!include:consensus3_toc
|
13
_archive/technology/consensus3_mechanism/consensus3_toc.md
Normal file
13
_archive/technology/consensus3_mechanism/consensus3_toc.md
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
## Consensus Engine Information
|
||||
|
||||
- [Consensus Engine Homepage](consensus3)
|
||||
- [Principles TFChain 3.0 Consensus](consensus3_principles)
|
||||
- [Consensus Engine Farming 3.0](consensus3_engine_farming)
|
||||
- [TFGrid 3.0 wallets](tfgrid3_wallets)
|
||||
- Architecture:
|
||||
- [Money Blockchains/Substrate architecture](money_blockchain_partity_link)
|
||||
<!-- - [Consensus Engine Weight System](consensus3_weights) -->
|
||||
|
||||
> implemented in TFGrid 3.0
|
||||
|
BIN
_archive/technology/consensus3_mechanism/img/grid_header.jpg
Normal file
BIN
_archive/technology/consensus3_mechanism/img/grid_header.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 39 KiB |
BIN
_archive/technology/consensus3_mechanism/img/limitedsupply_.png
Normal file
BIN
_archive/technology/consensus3_mechanism/img/limitedsupply_.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 64 KiB |
@@ -0,0 +1,53 @@
|
||||
|
||||
## Link between different Money Blockchain & TFChain
|
||||
|
||||
TF-Chain is the ThreeFold blockchain infrastructure, set up in the Substrate framework.
|
||||
|
||||
We are building a consensus layer which allows us to easily bridge between different money blockchains.
|
||||
|
||||
Main blockchain for TFT remains the Stellar network for now. A secure bridging mechanism exists, able to transfer TFT between the different blockchains.
|
||||
Active bridges as from TFGrid 3.0 release:
|
||||
- Stellar <> Binance Smart Chain
|
||||
- Stellar <> Parity Substrate
|
||||
More bridges are under development.
|
||||
|
||||
```mermaid
|
||||
|
||||
|
||||
graph TB
|
||||
subgraph Money Blockchain
|
||||
money_blockchain --- account1a
|
||||
money_blockchain --- account2a
|
||||
money_blockchain --- account3a
|
||||
account1a --> money_user_1
|
||||
account2a --> money_user_2
|
||||
account3a --> money_user_3
|
||||
click money_blockchain "/info/threefold/#money_blockchain"
|
||||
end
|
||||
subgraph ThreeFold Blockchain On Parity
|
||||
TFBlockchain --- account1b[account 1]
|
||||
TFBlockchain --- account2b[account 2]
|
||||
TFBlockchain --- account3b[account 3]
|
||||
account1b --- smart_contract_data_1
|
||||
account2b --- smart_contract_data_2
|
||||
account3b --- smart_contract_data_3
|
||||
click TFBlockchain "/info/threefold/#tfchain"
|
||||
end
|
||||
account1b ---- account1a[account 1]
|
||||
account2b ---- account2a[account 2]
|
||||
account3b ---- account3a[account 3]
|
||||
|
||||
consensus_engine --> smart_contract_data_1[fa:fa-ban smart contract metadata]
|
||||
consensus_engine --> smart_contract_data_2[fa:fa-ban smart contract metadata ]
|
||||
consensus_engine --> smart_contract_data_3[fa:fa-ban smart contract metadata]
|
||||
consensus_engine --> account1a
|
||||
consensus_engine --> account2a
|
||||
consensus_engine --> account3a
|
||||
click consensus_engine "/info/threefold/#consensus_engine"
|
||||
|
||||
|
||||
```
|
||||
|
||||
Above diagram shows how our consensus engine can deal with Substrate and multiple Money Blockchains at same time.
|
||||
|
||||
!!!include:consensus3_toc
|
52
_archive/technology/consensus3_mechanism/roadmap_tfchain3.md
Normal file
52
_archive/technology/consensus3_mechanism/roadmap_tfchain3.md
Normal file
@@ -0,0 +1,52 @@
|
||||
|
||||
# Roadmap For our TFCHain and ThreeFold DAO
|
||||
|
||||

|
||||
|
||||
## TFChain / DAO 3.0.2
|
||||
|
||||
For this phase our TFChain and TFDAO has been implemented using parity/substrate.
|
||||
|
||||
Features
|
||||
|
||||
- poc
|
||||
- pou
|
||||
- identity management
|
||||
- consensus for upgrades of DAO and TFChain (code)
|
||||
- capacity tracking (how much capacity used)
|
||||
- uptime achieved
|
||||
- capacity utization
|
||||
- smart contract for IT
|
||||
- storage of value = TFT
|
||||
- request/approval for adding a validator
|
||||
|
||||
Basically all basic DAO concepts are in place
|
||||
|
||||
## TFChain / DAO 3.0.x
|
||||
|
||||
TBD version nr, planned Q1 2022
|
||||
|
||||
NEW
|
||||
|
||||
- proposals for TFChain/DAO/TFGrid changes (request for change) = we call them TFCRP (ThreeFold Change Request Proposal)
|
||||
- voting on proposals = we call them TFCRV (ThreeFold Change Request Vote)
|
||||
|
||||
|
||||
## TFChain / DAO 3.1.x
|
||||
|
||||
TBD version nr, planned Q1 2022
|
||||
|
||||
This version adds more layers to our existing DAO and prepares for an even more scalable future.
|
||||
|
||||
NEW
|
||||
|
||||
- Cosmos based chain on L2
|
||||
- Validator Nodes for TFGrid and TFChain.
|
||||
- Cosmos based HUB = security for all TFChains
|
||||
|
||||
> More info about our DAO strategy see TFDAO.
|
||||
|
||||
|
||||
|
||||
!!!def alias:tfchain_roadmap,dao_roadmap,tfdao_roadmap
|
||||
|
73
_archive/technology/consensus3_mechanism/tfgrid3_wallets.md
Normal file
73
_archive/technology/consensus3_mechanism/tfgrid3_wallets.md
Normal file
@@ -0,0 +1,73 @@
|
||||
|
||||
# TFGrid 3.0 Wallets
|
||||
|
||||
ThreeFold has a mobile wallet which will allow to be used on the TFChain backend (Substrate) as well as any other Money Blockchain it supports.
|
||||
|
||||
This provides for a very secure digital currency infrastructure with lots of advantages.
|
||||
|
||||
- [X] ultra flexible smart contracts possible
|
||||
- [X] super safe
|
||||
- [X] compatible with multiple blockchains (money blockchains)
|
||||
- [X] ultra scalable
|
||||
|
||||
```mermaid
|
||||
|
||||
|
||||
graph TB
|
||||
|
||||
subgraph Money Blockchain
|
||||
money_blockchain[Money Blockchain Explorers]
|
||||
money_blockchain --- money_blockchain_node_1 & money_blockchain_node_2
|
||||
money_blockchain_node_1
|
||||
money_blockchain_node_2
|
||||
end
|
||||
|
||||
subgraph ThreeFold Wallets
|
||||
mobile_wallet[Mobile Wallet]
|
||||
desktop_wallet[Desktop Wallet]
|
||||
mobile_wallet & desktop_wallet --> money_blockchain
|
||||
mobile_wallet & desktop_wallet --> Explorers
|
||||
money_blockchain_wallet[Any Money Blockchain Wallet] --> money_blockchain
|
||||
end
|
||||
|
||||
|
||||
subgraph TFChain[TFGrid Blockchain on Substrate]
|
||||
Explorers[TFChain Explorers]-->TFGridDB --> BCNode
|
||||
Explorers --> BCNode
|
||||
end
|
||||
|
||||
|
||||
```
|
||||
|
||||
Generic overview:
|
||||
|
||||
```mermaid
|
||||
|
||||
graph TB
|
||||
|
||||
subgraph TFChain[TFGrid Chain]
|
||||
guardian1[TFChain Node 1]
|
||||
guardian2[TFChain Node 2]
|
||||
guardian3[TFChain Node 3...9]
|
||||
end
|
||||
|
||||
User_wallet[User Wallet] --> money_blockchain_account
|
||||
User_wallet[User Wallet] --> money_blockchain_restricted_account
|
||||
|
||||
subgraph Money Blockchain Ecosystem
|
||||
money_blockchain_account
|
||||
money_blockchain_restricted_account --- guardian1 & guardian2 & guardian3
|
||||
end
|
||||
|
||||
subgraph consensus[Consensus Layer on Substrate]
|
||||
guardian1 --> ReputationEngine & PricingOracle
|
||||
guardian1 --> contract1[Smart Contract Vesting]
|
||||
guardian1 --> contract2[Smart Contract Minting/Farming]
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
!!!include:consensus3_toc
|
52
_archive/technology/consensus3_mechanism/tfgrid_db_models.v
Normal file
52
_archive/technology/consensus3_mechanism/tfgrid_db_models.v
Normal file
@@ -0,0 +1,52 @@
|
||||
|
||||
// - vesting
|
||||
// - startdate: epoch
|
||||
// - currency: USD
|
||||
// - [[$month_nr,$minprice_unlock,$TFT_to_vest],...]
|
||||
// - if 48 months then list will have 48 parts
|
||||
// - month 0 = first month
|
||||
// - e.g. [[0,0.11,10000],[1,0.12,10000],[2,0.13,10000],[3,0.14,10000]...]
|
||||
|
||||
//information stored at account level in TFGridDB
|
||||
struct AccountMeta{
|
||||
//corresponds to unique address on money_blockchain
|
||||
money_blockchain_address string
|
||||
vesting Vesting[]
|
||||
unlocked_TFT int
|
||||
}
|
||||
|
||||
struct Vesting{
|
||||
startdate int
|
||||
//which currency is used to execute on the acceleration in the vesting
|
||||
//if price above certain level (which is currency + amount of that currency) the auto unlock
|
||||
currency CurrencyEnum
|
||||
months []VestingMonth
|
||||
}
|
||||
|
||||
struct VestingMonth{
|
||||
month_nr int
|
||||
//if 0 then will not unlock based on price
|
||||
unlock_price f32
|
||||
tft_amount int
|
||||
}
|
||||
|
||||
enum CurrencyEnum{
|
||||
usd
|
||||
eur
|
||||
egp
|
||||
gbp
|
||||
aed
|
||||
}
|
||||
|
||||
//this is stored in the TFGridDB
|
||||
fn (mut v AccountMeta) serialize() string{
|
||||
//todo code which does serialization see above
|
||||
return ""
|
||||
}
|
||||
|
||||
|
||||
//write minting pool
|
||||
|
||||
|
||||
//REMARKS
|
||||
// if unlock triggered because of month or price then that record in the VestingMonth[] goes away and TFT go to unlocked_TFT
|
Reference in New Issue
Block a user