From 87cc9d93782df0f86fac172b47d27a19e5cd53b7 Mon Sep 17 00:00:00 2001 From: GG Date: Thu, 27 Jul 2023 11:31:04 +0800 Subject: [PATCH 01/13] Update README.md --- README.md | 56 ++++--------------------------------------------------- 1 file changed, 4 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index 6b04f3d73..e4049d619 100644 --- a/README.md +++ b/README.md @@ -1,50 +1,4 @@ -# ChainX - -[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](./LICENSE) -[![CI](https://github.com/chainx-org/ChainX/workflows/ci/badge.svg)](https://github.com/chainx-org/ChainX/actions?workflow=ci) - -[ChainX](https://github.com/chainx-org/ChainX) is a community-driven project built on the next-generation blockchain framework [substrate](https://github.com/paritytech/substrate), the largest Layer-2 network of Bitcoin using the Light-client protocol with smart contract support, spawn as the third relay chain besides Polkadot/Kusama. SherpaX and MiniX will be added as a parachain. - -Based on the LayerZero protocol, the EVM Layer2 ecology on ChainX can share the liquidity of the EVM ecology such as ETH/BSC, and the POW payment coin such as BTC/DogeCoin can share the DAPP ecology of the EVM. -[light white paper](https://chainx.org/static/media/Chainx.3df914fe.pdf). -[website](https://chainx.org) - -## The Fragmented Web3 Crypto World -There has always been many problems in the crypto world, but there has never been a shortage of reforms and innovations. -* In order to solve the payment performance and scalability problems of BTC, various altcoins such as Dogecoin, LTC, and BCH have been introduced. -* In order to solve the problems of too expensive gas fees in Ethereum and the scalability of dapps, people have successively developed public chains such as BSC, EOS, Polkadot, and Avalanche, which now seem to have a wide users. - - -However, the establishment of dapps on these mainstream public chains still faces some problems: the ecosystems of different public chains are separated from each other, and the isolation will disperse the value, until the value returns to 0, the aggregation can accumulate the value, making the value like The piles of wood are piled higher and higher. -Also, we cannot exchange tokens on pancakeswap with those on Uniswap because they come from different ecosystems. This will prevent DEXs from having as much liquidity as CEXs. But we must embrace DEXs, because we all know that decentralization is the fundamental attribute and future of the encrypted world, and the meaning of encryption algorithms and even the whole web3 world is decentralization. - -Based on this, ChainX, the layer 2 network of Bitcoin, will be committed to solving the above problems and aggregating these divided communities and ecology. - -## How ChainX solves the above problems - -### To solve the scalability problem of isolated POW tokens such as Bitcoin and Dogecoin -First, we adopted the mode of light node + multi-centralized hosting (integrated with Taproot aggregated signature + MAST contract + Signal distributed computing protocol). Then, we will adopt the on chain lightning network model to completely solve the scalability problem of POW tokens such as BTC in a completely decentralized way. - -### To solve the isolation problem of EVM public chains such as ETH/BSC -There are already many solutions for the decentralized cross-chain between EVM chains. We will absorb the LayerZero protocol to realize the cross-chain between decentralized EVM chains. - -Later, an aggregation protocol will be deployed on ChainX EVM, so that our DEX can unify liquidity across platforms and chains: for example, pools on UniSwap and pools on PancakeSwap can share liquidity. - -In addition, ChainX will realize the consistent mapping between ENS and other various public chain domain name systems. For example, the CID of ComingChat can be mapped with ENS, and ENS can be mapped with BTC addresses. - -Aggregation and unification are eternal themes in the crypto world. Aggregation can make the crypto world closer and make web3 competitive enough to replace the web2 world. At the same time, aggregation also prevents LTC, BCH and other DAPP ecologically unprosperous communities from slowly going silent, and the prosperous EVM ecology will also become more prosperous because of aggregation. - - -## ChainX Ecological Project: -* [ComingChat](https://coming.chat/):Integrated web3 portal for encrypted social, digital identity, NFT, digital wallet, smart contract platform portal and other functions. Committed to being a secure and trusted web3 portal. Combining decentralized encryption algorithms and blockchain knowledge to solve trusted information transmission and asset management problems. -* [SherpaX](https://sherpax.io/): ChainX's EVM & WASM Smart Contract Parachain. -* [MiniX](https://github.com/MinixChain/MinixChain): ChainX's digital identity, NFT, reputation system parachain. -* [SoSwap](https://www.soswap.finance/): Omni-chain DEX, a distributed financial platform dedicated to allowing multiple chains to share liquidity. -* [ComFuture](https://comfuture.coming.chat/): Digital identity, NFT creation auction trading platform. -* USB: The decentralized expansion of BTC that allows BTC and any EVM ecological chain to be integrated with each other. - -## The crypto world is not perfect, but ChainX is working hard to make it better and better. -Please refer to the [docs](https://chainx-org.github.io/documentation) for building and developing on ChainX platform. +# BEVM ## Contribution @@ -52,15 +6,13 @@ Any kinds of contributions are highly welcome. Feel free to submit an issue if y ## Metamask config for BTC ``` -Network name: ChainX -RPC URL: https://mainnet.chainx.org/rpc +Network name: BEVM +RPC URL: https://mainnet.bevm.io/rpc Chain ID: 1501 Currency symbol: BTC -Block explorer URL (Optional): https://evm.chainx.org/ +Block explorer URL (Optional): https://evm.bevm.io/ ``` -PCX(ERC20): `0xf3607524cAB05762cB5F0cAb17e4cA3A0F0b4E87` - ## License [GPL v3](LICENSE) From 84c909d6cb47803f7910937f2d7658f808b78632 Mon Sep 17 00:00:00 2001 From: GG Date: Thu, 27 Jul 2023 11:32:39 +0800 Subject: [PATCH 02/13] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e4049d619..8a96bdb83 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ # BEVM +WechatIMG475 -## Contribution +## Contribution Any kinds of contributions are highly welcome. Feel free to submit an issue if you have any question or run into any issues. ## Metamask config for BTC From 44c22534f675e9fc68562d086c6dedacf702131b Mon Sep 17 00:00:00 2001 From: GG Date: Thu, 27 Jul 2023 12:25:38 +0800 Subject: [PATCH 03/13] Update README.md (#1) --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8a96bdb83..b0bd130b9 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,17 @@ # BEVM WechatIMG475 +## A community-driven BTC Layer2 project. +### Technical features: +- EVM +- BTC native gas +- Taproot Threshold Signature +- bitcoin light node +- Signal Privacy Distributed Protocol +- zkstark ultra-light node ## Contribution -Any kinds of contributions are highly welcome. Feel free to submit an issue if you have any question or run into any issues. +Any kinds of contribution are highly welcome. Feel free to submit an issue if you have any question or run into any issues. ## Metamask config for BTC ``` From a77b26e3b9abc40c4d8bebe7cb63d5d9f20ace10 Mon Sep 17 00:00:00 2001 From: guanghua Date: Fri, 28 Jul 2023 13:40:37 +0800 Subject: [PATCH 04/13] Summary BEVM Technical Outline (#2) * Update README.md * Update README.md * Update README.md --- README.md | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b0bd130b9..503073a8a 100644 --- a/README.md +++ b/README.md @@ -3,12 +3,23 @@ ## A community-driven BTC Layer2 project. ### Technical features: -- EVM -- BTC native gas -- Taproot Threshold Signature -- bitcoin light node -- Signal Privacy Distributed Protocol -- zkstark ultra-light node +- ***EVM:*** Fully compatible with EVM ecology, wallets such as metamask, development frameworks such as truffle/hardhat, and solidity programming language. +- ***BTC native gas:*** Use native BTC as the gas fee for EVM. Similar to ETH layer2 OP/Starknet, ETH is used as the gas fee of Layer2. +- ***Taproot Threshold Signature:*** On-chain POS nodes to ensure the decentralization of threshold signature verifiers. singal privacy communication protocol to ensure the security of the aggregated schnorr signature pubkey/msg. +- ***bitcoin light node:*** Light nodes on the BTC chain that support the Wasm version (no_std). +- ***Signal Privacy Distributed Protocol:*** [Signal protocol](https://en.wikipedia.org/wiki/Signal_Protocol) to ensure the privacy and security of message communication between nodes when schnorr aggregate signature and Mast contract combined threshold signature. +- ***zkstark ultra-light node:*** To optimize the light nodes mentioned above, zkstark technology can be used to realize the ultra-light nodes of BTC. + +### Taproot Threshold Signature +Musig2 is a multi-signature protocol that only needs two rounds of communication to complete communication. It is a continuation and upgrade of Musig, and its practicability is greatly improved. This repo fully reproduces the multi-signature scheme proposed by [Musig2](https://eprint.iacr.org/2020/1261) Paper which the version is `20210706:150749`.At the same time, we implemented versions for secp256k1 and sr25519, respectively, so that we can use the Musig2 protocol in BTC and Polka. + +### secp256k1 + +The naming of the functions, states, and variables are aligned with that of the protocol. At the same time, it is compatible with the schnorr signature process proposed by Bitcoin [bip340](https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki), making it applicable to the Bitcoin network. + +### sr25519 + +Implements musig2 protocol on [Ristretto](https://ristretto.group/) compressed Ed25519 points. ## Contribution Any kinds of contribution are highly welcome. Feel free to submit an issue if you have any question or run into any issues. @@ -25,3 +36,10 @@ Block explorer URL (Optional): https://evm.bevm.io/ ## License [GPL v3](LICENSE) + +# References + +- [schnorrkel](https://github.com/w3f/schnorrkel) +- [multi-party-schnorr](https://github.com/ZenGo-X/multi-party-schnorr) +- [musig2](https://eprint.iacr.org/2020/1261) + From af7d8dc0135ca41fec52c5f91dcece50ed29fef1 Mon Sep 17 00:00:00 2001 From: guanghua Date: Fri, 28 Jul 2023 15:06:15 +0800 Subject: [PATCH 05/13] Organize the advantages of the BEVM BTC cross-chain solution. --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 503073a8a..a2f5e909a 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,13 @@ - ***Signal Privacy Distributed Protocol:*** [Signal protocol](https://en.wikipedia.org/wiki/Signal_Protocol) to ensure the privacy and security of message communication between nodes when schnorr aggregate signature and Mast contract combined threshold signature. - ***zkstark ultra-light node:*** To optimize the light nodes mentioned above, zkstark technology can be used to realize the ultra-light nodes of BTC. +### Four advantages compared to other layer2/cross-chain bridges (Take [tBTC](https://www.thresholdusd.org/en/) as an example) +- 1,There is no need to use sharding private keys to implement distributed threshold signatures, which avoids the security problem of private key leakage caused by sharding private keys. +- 2, The validators of the distributed threshold network are all block verification nodes on the chain, and the network on the chain increases trust. It avoids the opaque and easy-to-operate defects of the distributed network under the chain. +- 3, The BTC to Layer2 network uses BTC light nodes. The blockchain logic of fully trusting the code avoids the centralized fraud problem caused by the submission of data oracle to the distributed network under the chain. +- 4, The Signal protocol is used to complete the communication problem of the BTC taproot threshold signature. Solve the privacy communication problem of distributed network. Avoid the risks of data leakage, collusion or external attacks when threshold signatures appear + + ### Taproot Threshold Signature Musig2 is a multi-signature protocol that only needs two rounds of communication to complete communication. It is a continuation and upgrade of Musig, and its practicability is greatly improved. This repo fully reproduces the multi-signature scheme proposed by [Musig2](https://eprint.iacr.org/2020/1261) Paper which the version is `20210706:150749`.At the same time, we implemented versions for secp256k1 and sr25519, respectively, so that we can use the Musig2 protocol in BTC and Polka. From db8051fa853ca57103749cbf134ac5d1a9c9d2e7 Mon Sep 17 00:00:00 2001 From: guanghua Date: Fri, 28 Jul 2023 15:18:04 +0800 Subject: [PATCH 06/13] Update README.md (#4) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a2f5e909a..80e5364f7 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,10 @@ - ***zkstark ultra-light node:*** To optimize the light nodes mentioned above, zkstark technology can be used to realize the ultra-light nodes of BTC. ### Four advantages compared to other layer2/cross-chain bridges (Take [tBTC](https://www.thresholdusd.org/en/) as an example) -- 1,There is no need to use sharding private keys to implement distributed threshold signatures, which avoids the security problem of private key leakage caused by sharding private keys. +- 1,There is no need to use sharding private keys to implement distributed threshold signatures, which avoids the security problem of private key leakage caused by sharding private keys. Directly use BTC's native threshold signature scheme: [MuSig2](https://eprint.iacr.org/2020/1261). - 2, The validators of the distributed threshold network are all block verification nodes on the chain, and the network on the chain increases trust. It avoids the opaque and easy-to-operate defects of the distributed network under the chain. - 3, The BTC to Layer2 network uses BTC light nodes. The blockchain logic of fully trusting the code avoids the centralized fraud problem caused by the submission of data oracle to the distributed network under the chain. -- 4, The Signal protocol is used to complete the communication problem of the BTC taproot threshold signature. Solve the privacy communication problem of distributed network. Avoid the risks of data leakage, collusion or external attacks when threshold signatures appear +- 4, The [Signal protocol](https://en.wikipedia.org/wiki/Signal_Protocol) is used to complete the communication problem of the BTC taproot threshold signature. Solve the privacy communication problem of distributed network. Avoid the risks of data leakage, collusion or external attacks when threshold signatures appear ### Taproot Threshold Signature From be9e36f6a4864cca16352eb0d79cadfe9aae3d6b Mon Sep 17 00:00:00 2001 From: guanghua Date: Fri, 28 Jul 2023 15:27:00 +0800 Subject: [PATCH 07/13] Summarize the four major advantage titles --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 80e5364f7..338142c08 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,10 @@ - ***zkstark ultra-light node:*** To optimize the light nodes mentioned above, zkstark technology can be used to realize the ultra-light nodes of BTC. ### Four advantages compared to other layer2/cross-chain bridges (Take [tBTC](https://www.thresholdusd.org/en/) as an example) -- 1,There is no need to use sharding private keys to implement distributed threshold signatures, which avoids the security problem of private key leakage caused by sharding private keys. Directly use BTC's native threshold signature scheme: [MuSig2](https://eprint.iacr.org/2020/1261). -- 2, The validators of the distributed threshold network are all block verification nodes on the chain, and the network on the chain increases trust. It avoids the opaque and easy-to-operate defects of the distributed network under the chain. -- 3, The BTC to Layer2 network uses BTC light nodes. The blockchain logic of fully trusting the code avoids the centralized fraud problem caused by the submission of data oracle to the distributed network under the chain. -- 4, The [Signal protocol](https://en.wikipedia.org/wiki/Signal_Protocol) is used to complete the communication problem of the BTC taproot threshold signature. Solve the privacy communication problem of distributed network. Avoid the risks of data leakage, collusion or external attacks when threshold signatures appear +- 1, ***No centralized initial setup required.*** There is no need to use sharding private keys to implement distributed threshold signatures, which avoids the security problem of private key leakage caused by sharding private keys. Directly use BTC's native threshold signature scheme: [MuSig2](https://eprint.iacr.org/2020/1261). +- 2, ***Distributed network on the chain, more decentralized.*** The validators of the distributed threshold network are all block verification nodes on the chain, and the network on the chain increases trust. It avoids the opaque and easy-to-operate defects of the distributed network under the chain. +- 3, ***No permission required, just trust the code.*** The BTC to Layer2 network uses BTC light nodes. The blockchain logic of fully trusting the code avoids the centralized fraud problem caused by the submission of data oracle to the distributed network under the chain. +- 4, ***Distributed network communication with complete privacy.*** The [Signal protocol](https://en.wikipedia.org/wiki/Signal_Protocol) is used to complete the communication problem of the BTC taproot threshold signature. Solve the privacy communication problem of distributed network. Avoid the risks of data leakage, collusion or external attacks when threshold signatures appear ### Taproot Threshold Signature From 53e24424ed44c8e70d1512fb9f10b85b2f4f6420 Mon Sep 17 00:00:00 2001 From: guanghua Date: Wed, 9 Aug 2023 12:04:47 +0800 Subject: [PATCH 08/13] EVM system with BTC as native Gas (#6) * Update README.md * Update README.md --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index 338142c08..acf491973 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,19 @@ - 3, ***No permission required, just trust the code.*** The BTC to Layer2 network uses BTC light nodes. The blockchain logic of fully trusting the code avoids the centralized fraud problem caused by the submission of data oracle to the distributed network under the chain. - 4, ***Distributed network communication with complete privacy.*** The [Signal protocol](https://en.wikipedia.org/wiki/Signal_Protocol) is used to complete the communication problem of the BTC taproot threshold signature. Solve the privacy communication problem of distributed network. Avoid the risks of data leakage, collusion or external attacks when threshold signatures appear +### EVM system with BTC as native Gas +#### The benefits of BTC as native Gas +- The largest BTC ecology, which is convenient for BTC users to hold BTC and use Layer2. +- BEVM's Sequencer can charge BTC fees to motivate BEVM Sequencer nodes. + +#### BTC is compatible with EVM system +- BTC needs a Turing-complete smart contract platform to settle assets issued on BTC and BTC. +- The EVM ecology occupies more than 90% of the smart contract ecology in the market, and the compatible EVM ecology can accommodate the most expensive on-chain developers and user communities. + +#### Technical realization +- Adopt substrate frame +- Precompiled system contracts, using BTC as gas +- Porting EVM platform ### Taproot Threshold Signature Musig2 is a multi-signature protocol that only needs two rounds of communication to complete communication. It is a continuation and upgrade of Musig, and its practicability is greatly improved. This repo fully reproduces the multi-signature scheme proposed by [Musig2](https://eprint.iacr.org/2020/1261) Paper which the version is `20210706:150749`.At the same time, we implemented versions for secp256k1 and sr25519, respectively, so that we can use the Musig2 protocol in BTC and Polka. From faff10cbbcadbfc90352a2fd31fd314a14187f17 Mon Sep 17 00:00:00 2001 From: guanghua Date: Wed, 29 Nov 2023 18:18:27 +0800 Subject: [PATCH 09/13] Update README.md (#8) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index acf491973..a0dc7f0ab 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # BEVM WechatIMG475 -## A community-driven BTC Layer2 project. +## [An EVM-compatible Bitcoin Layer 2 with BTC as gas](https://github.com/btclayer2/BEVM-white-paper) ### Technical features: - ***EVM:*** Fully compatible with EVM ecology, wallets such as metamask, development frameworks such as truffle/hardhat, and solidity programming language. - ***BTC native gas:*** Use native BTC as the gas fee for EVM. Similar to ETH layer2 OP/Starknet, ETH is used as the gas fee of Layer2. From 74349e1ccec959a1b553a2889d0b9c80a490e196 Mon Sep 17 00:00:00 2001 From: guanghua Date: Sat, 13 Jan 2024 11:33:59 +0800 Subject: [PATCH 10/13] Update README.md (#9) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a0dc7f0ab..89ef3e4f8 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # BEVM -WechatIMG475 +WechatIMG475 ## [An EVM-compatible Bitcoin Layer 2 with BTC as gas](https://github.com/btclayer2/BEVM-white-paper) ### Technical features: From 0a164fa7ec71bba72a4083ffb0a4b38d43f96c00 Mon Sep 17 00:00:00 2001 From: guanghua Date: Sat, 13 Jan 2024 11:41:23 +0800 Subject: [PATCH 11/13] Update README.md (#10) --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 89ef3e4f8..61c9e2f13 100644 --- a/README.md +++ b/README.md @@ -46,11 +46,11 @@ Any kinds of contribution are highly welcome. Feel free to submit an issue if yo ## Metamask config for BTC ``` -Network name: BEVM -RPC URL: https://mainnet.bevm.io/rpc +Network name: BEVM Canary network +RPC URL: https://rpc-2.bevm.io Chain ID: 1501 Currency symbol: BTC -Block explorer URL (Optional): https://evm.bevm.io/ +Block explorer URL (Optional): https://scan.bevm.io/ ``` ## License From 4edb88e1cc09e792203451b9b20e9e77858e14bf Mon Sep 17 00:00:00 2001 From: guanghua Date: Tue, 30 Jan 2024 12:18:37 +0800 Subject: [PATCH 12/13] Update README.md (#11) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 61c9e2f13..45f11f953 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ Any kinds of contribution are highly welcome. Feel free to submit an issue if yo ## Metamask config for BTC ``` Network name: BEVM Canary network -RPC URL: https://rpc-2.bevm.io +RPC URL: https://rpc-canary-1.bevm.io Chain ID: 1501 Currency symbol: BTC Block explorer URL (Optional): https://scan.bevm.io/ From 94bd9b33ab9f2ad91238b26f05a5b4a55c85fb60 Mon Sep 17 00:00:00 2001 From: AAweidai Date: Wed, 28 Feb 2024 09:17:19 +0700 Subject: [PATCH 13/13] Delete unused doc --- xpallets/gateway/README.md | 156 ------------------------------- xpallets/gateway/Trustee.md | 46 --------- xpallets/gateway/TrusteeAdmin.md | 48 ---------- 3 files changed, 250 deletions(-) delete mode 100644 xpallets/gateway/README.md delete mode 100644 xpallets/gateway/Trustee.md delete mode 100644 xpallets/gateway/TrusteeAdmin.md diff --git a/xpallets/gateway/README.md b/xpallets/gateway/README.md deleted file mode 100644 index f96d496d0..000000000 --- a/xpallets/gateway/README.md +++ /dev/null @@ -1,156 +0,0 @@ -# Case - -## 成为信托 - -### 成为议会成员 - -1. 要成为议会成员,首先要成为候选人 - -![img](https://cdn.jsdelivr.net/gh/hacpy/PictureBed@master/Document/16399971419031639997141896.png) - -2. 任何人都可以给候选人进行投票。投票可以给多个人投票需要质押一定的pcx。议会的换届周期为一天。每一天会根据得票数和相关的质押pcx计算排名。选前11名作为议会成员,后7人作为runners up. - -![img](https://cdn.jsdelivr.net/gh/hacpy/PictureBed@master/Document/16399970352971639997035289.png) - -### 设置信托成员信息 - -议会当前成员以及runner up中的成员都是信托候选人员。信托候选人员需要提前设置信托信息,否则无法参选信托。 - -![img](https://cdn.jsdelivr.net/gh/hacpy/PictureBed@master/Document/16399849656191639984965606.png) - -- proxy_account : 不填默认为和议会账户是相同的。主要作用是减少议会账户的使用,信托换届相关的交易都可通过代理账户进行操作 - -- chain: 目前填`Bitcoin` - -- about: 备注 - -- hot_entity: 填写BTC的公钥 (用来签名提现交易的账号)。压缩公钥和无压缩公钥均可。如`0x02926877f1a4c5e348c32ab6307799f8ac6836bf60a2c3a38e56a759cabe8f0187`. - -- cold_entity: 填写BTC的公钥 (使用少、安全性更高,用于存储BTC)。压缩公钥和无压缩公钥均可。 - - 如`039392e66cb126ce7116a4dacd2682ddd80721f951b106818b03fea3e836713d12`. - -## 充值 - -充值就是由用户向当前届信托的热地址进行转账,需要带上OP_RETURN(即用户的chainx账户信息)。 - -### 查询当前届信托热地址 - -#### xgatewaycommon_bitcoinTrusteeSessionInfo - -参数:负数:-1表示查询当前届信托信息,-2表示查询上一届信托信息。正数:表示具体某届的信托信息。 - -返回值: - -- coldAddress: 信托冷地址 -- hotAddress: 信托热地址 -- multiAccount: 信托chainx多签账户 -- threshold: 阈值 -- trusteeList: 信托相关的所有成员账户和他们参与提现的累积权重(参与提现的btc累加) -- startHeight: 成为信托的起始块 -- en dHeight: 信托换届的结束块 - -![img](https://cdn.nlark.com/yuque/0/2021/png/1606853/1639997268585-039af3ee-e50c-4fa3-9d3c-dd089af3d79b.png) - -### 查询最小充值金额 - -用户充值金额小于最小充值金额等于没冲 - -### ![img](https://cdn.jsdelivr.net/gh/hacpy/PictureBed@master/Document/16399902138761639990213872.png) - -## 提现 - -### Step 1 - -#### 用户申请提现![img](https://cdn.jsdelivr.net/gh/hacpy/PictureBed@master/Document/16399808590601639980859053.png) - -- assetId:默认sbtc是1 - -- value:提现的金额(BTC的精度为8位,5000000相当于0.05BTC) - -- addr: 要提现到的账号(BTC地址) - -- ext:备注(无影响) - -#### 查询用户锁定资产 - -用户申请提现后,提现的金额会进入锁定状态,查询用户锁定资产数量。 - -![img](https://cdn.jsdelivr.net/gh/hacpy/PictureBed@master/Document/16399903900851639990390083.png) - -- AccountId:填用户账户 - -- u32: 为资产ID,sbtc默认为1 - -#### 查询最小提现金额 - -确保提现金额要大于链上最小提现金额 - -![img](https://cdn.jsdelivr.net/gh/hacpy/PictureBed@master/Document/16399901113041639990111299.png) - -### Step 2 - -#### 信托查询所有提现列表 - -用户申请提现后,信托要根据用户的提现信息来构造提现交易,因此首先要查询所有未处理的用户提现 - -##### xgatewayrecords_withdrawalList - -参数:无 - -返回值: 字典(`withdraw_id` -> `withdraw_info`) - -- addr: 用户提现接收的btc地址 -- applicant: 用户chainx账户 -- assetId: 资产id, 1表示btc -- height: 用户申请提现的块高度 -- state: 用户申请先的状态:`Applying`表示未处理的提现申请。`Processing`表示正在处理的提现申请。`NormalFinish/RootFinish`表示已经完成的提现申请。`NormalCancel/RootCancel`表示已经取消的提现申请。 -- balance:提现数量 - -![img](https://cdn.jsdelivr.net/gh/hacpy/PictureBed@master/Document/16399936095111639993609503.png) - -#### 信托链下构造交易 - -利用上述查询到的所有`Applying`申请构造提现交易,从信托的热地址进行门限签名转账. 接收方地址为上述查询到的addr,数量为上述`balance-提现手续费` - -##### 查询提现手续费 - -![img](https://cdn.jsdelivr.net/gh/hacpy/PictureBed@master/Document/16400554712471640055471241.png) - -唯一的参数是资产ID,默认使用1就是sbtc - -#### 信托提交提现 - -构造完交易后,不能直接向btc网络广播交易,而是向chainx广播交易,带上相关的withdraw id。否则chainx无法确认是哪几笔交易正在进行提现并设定提现的状态。 - -![img](https://cdn.jsdelivr.net/gh/hacpy/PictureBed@master/Document/16399809713971639980971389.png) - -- withdrawList: 即`信托链下构造交易`所采用的`Applying`状态的`withdraw_id` - -## 信托换届 - -信托换届的过程主要分成两大步。第一步是每个月到期后chainx**自动**进行拉取议会相关信息并进行信托换届,并将信托换届状态设置为True。第二步是上一届信托需构造从上一届信托冷热地址到当前届信托热冷地址的比特币转账交易。 - -### 查询信托换届状态 - -如果为True,表示信托需要进行信托换届,即信托换届第一步已完成,需要进行第二步,从(上一届冷地址-->当前届冷地址, 上一届热地址-->当前届热地址)的转账。 - -![img](https://cdn.jsdelivr.net/gh/hacpy/PictureBed@master/Document/16399909392371639990939232.png) - -参考`xgatewaycommon_bitcoinTrusteeSessionInfo`,传入参数-1查询当前届的信托冷热地址,上一届信托成员通过门限签名构造一笔转账交易。 - -# 信托奖励分发 - -### 申请奖励 - -1.每个月上一届信托可以向国库申请pcx奖励到多签账户。多签账户的查询参考`xgatewaycommon_bitcoinTrusteeSessionInfo`,传入参数-2查询上一届信托信息(如下图所示)。如果一个月到期没有进行换届,也可以进行申请并分配奖励。 - -![img](https://cdn.jsdelivr.net/gh/hacpy/PictureBed@master/Document/16400561829991640056182992.png) - -### 奖励分配 - -奖励申请到账后,上一届信托成员中任一人通过下图所示交易进行奖励分配,最终奖励会分发到各个信托的账户中。一个月没有换届,申请的奖励需要议会投票执行下图交易。 - -![img](https://cdn.jsdelivr.net/gh/hacpy/PictureBed@master/Document/16400556024121640055602407.png) - -- sessionNum: 负数:-1表示查询当前届信托信息,-2表示查询上一届信托信息。正数:表示具体某届的信托信息 diff --git a/xpallets/gateway/Trustee.md b/xpallets/gateway/Trustee.md deleted file mode 100644 index d6992538e..000000000 --- a/xpallets/gateway/Trustee.md +++ /dev/null @@ -1,46 +0,0 @@ -# Overview - -This document describes how to become a member of council and trustee. Becoming a trust, the main responsibility is to keep the btc for users and help with withdrawals. Every month the trust can apply to the treasury for pcx as rewards. Rewards are distributed in proportion to the number of withdrawals and the number of BTCs that help users withdraw. - -# Council - -## Elected candidate - -![img](https://cdn.jsdelivr.net/gh/hacpy/PictureBed@master/Document/16400546556771640054655670.png) - -To become a member of council, one must first be elected as a candidate. - -## Vote - -![img](https://cdn.jsdelivr.net/gh/hacpy/PictureBed@master/Document/16400548057191640054805712.png) - -Everyone can stake some **pcx** and vote for multiple candidates. Allow yourself to vote for yourself. **After becoming a candidate, members of the parliament will be updated every day, and the ranking will be calculated based on the number of votes and related staking pcx.** - -# Trustee - -To become a trust, you must first be elected as a council member or runners up. **Then set your own btc hot and cold public key as shown in the figure below.** The **hot public key** is used for general deposit and withdrawal, and the **cold public key** is used to store large amounts of btc to improve security. After becoming a trust and setting up the btc information, the trust will be renewed every 30 days. - -![img](https://cdn.jsdelivr.net/gh/hacpy/PictureBed@master/Document/16400549209591640054920952.png) - -- proxy_account : An proxy account, if it is not filled in, the default is the same as the council account. Avoid frequent use of council accounts. -- chain: Fill `Bitcoin` -- about: Remark -- hot_entity: Btc public key. Such as `0x043858204f15d385da76fcbdf019debde624689e296c5ac53f6437491528857617691fe85c5c529b692bd75e361a9d0995dbd3e20a81e949642dfb74095520d981`. -- cold_entity: Btc public key. Such as `0x043858204f15d385da76fcbdf019debde624689e296c5ac53f6437491528857617691fe85c5c529b692bd75e361a9d0995dbd3e20a81e949642dfb74095520d981`. - -The hot public key is obtained through **Coming** and used in **Coming**, and the cold addresses are also obtained through Coming but with a different mnemonic. **When Coming adds the check logic of the withdrawal address and amount, the PCX account associated with the BTC hot address in Coming must be the parliament account or the Proxy Account in the above figure.** - -# Responsibility - -Process user withdrawals. Required for each withdrawal: - -- Check the correctness of the output address and amount -- Make sure there is no op_return in the output - -# Reward distribution - -After the renewal of the trust each month, the previous trust can apply to the Treasury for pcx to the trust multi-signature account. After the pcx is received, any member of the previous trust can distribute rewards through the interface shown in the figure below. - -![img](https://cdn.jsdelivr.net/gh/hacpy/PictureBed@master/Document/16400549742281640054974219.png) - -- sessionNum: The id of the previous trust. diff --git a/xpallets/gateway/TrusteeAdmin.md b/xpallets/gateway/TrusteeAdmin.md deleted file mode 100644 index eaf011c70..000000000 --- a/xpallets/gateway/TrusteeAdmin.md +++ /dev/null @@ -1,48 +0,0 @@ -# TrusteeAdmin - -## How do I get elected as an administrator of the Trustees? - -Call through the council to vote for the election. The voting threshold needs to be greater than 2/3.(The council members who want to become trustee administrator call on their own initiative) - -![https://cdn.jsdelivr.net/gh/hacpy/PictureBed@master/Document/16460135181231646013517166.png](https://cdn.jsdelivr.net/gh/hacpy/PictureBed@master/Document/16460135181231646013517166.png) - -## Rights and Duties of the Trustee Administrator - -##### 1. Trustee administrator is required to create hot multi-signature addresses in the ComingChat trustee group in time for the election, and teach other trustees to obtain and use the hardware wallet signature script. - -##### 2. Trustee administrator needs to identify problematic trustees in a timely manner and move them into a small black house for transition. - -Call to move to the little black house - -![](https://cdn.jsdelivr.net/gh/hacpy/PictureBed@master/Document/16460150141231646015014069.png) - -##### 3. Trustee administrator can move a group of users out of the little black house - -If some of the users in the black house recover, they need to be moved out of the black house in a timely manner , or they cannot run for the trustee. - -Call to move out of the little black house - -![](https://cdn.jsdelivr.net/gh/hacpy/PictureBed@master/Document/16460153141231646015313400.png) - -##### 4. Trustee administrator is required to initiate a trustee election at the end of each term. And ensuring the perfect execution of trust transition. The following trust transition process needs to be carried out in an orderly and correct manner - -- Council members set up trust addresses, refer to [Trustee.md](./Trustee.md) -- Call to start trustee election![](https://cdn.jsdelivr.net/gh/hacpy/PictureBed@master/Document/16460155281231646015527278.png) -- **Use Coming to initiate transactions and ensure that all btc that previously trusted the hot address are transferred to the previous cold address. There are two guarantees here, one is that the Coming Robot verifies the validity of the transaction. The other is to manually check the transaction, that is, transfer all the input amount to the last cold address**. -- Finally, **Use Coming to initiate transactions and ensure that all the btc of the previous cold address is transferred to the current cold address. There are two guarantees here, one is that the Coming Robot verifies the validity of the transaction. The other is to manually check the transaction, that is, transfer all the input amount to the current cold address** - -##### 5. Perform general trustee operations and sign for withdrawal transactions - -Trustee administrator also needs to be more involved with trust signatures, and rewards are distributed with a weighting of the amount of withdrawals processed. - -##### 6. Conversion of hot and cold addresses - -When the hot address has enough money, transfer the money to the cold address for security.When the money from the hot address is not enough to withdraw cash, transfer from the cold address to the hot address. - -## Rewards for Trustee Administrator - -##### 1. The trustee administrator's reward will be multiplied by a multiplier on top of the normal trustee reward, which currently defaults to 1.1x, or 10% more (the reward multiplier can be adjusted through the council if there is insufficient incentive to cause no one to be elected) - -Set the trustee administrator reward multiplier Call, `12` means 1.2 times - -![](https://cdn.jsdelivr.net/gh/hacpy/PictureBed@master/Document/16460161701231646016169194.png) \ No newline at end of file