diff --git a/README.md b/README.md index 6b04f3d73..acde3c5e3 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ Any kinds of contributions are highly welcome. Feel free to submit an issue if y ## Metamask config for BTC ``` -Network name: ChainX +Network name: BEVM RPC URL: https://mainnet.chainx.org/rpc Chain ID: 1501 Currency symbol: BTC diff --git a/docs/account-convert.png b/docs/account-convert.png new file mode 100644 index 000000000..715ab5864 Binary files /dev/null and b/docs/account-convert.png differ diff --git a/docs/btc-balance.png b/docs/btc-balance.png new file mode 100644 index 000000000..9545f5c4c Binary files /dev/null and b/docs/btc-balance.png differ diff --git a/docs/btc-evm.png b/docs/btc-evm.png new file mode 100644 index 000000000..a868d7837 Binary files /dev/null and b/docs/btc-evm.png differ diff --git a/docs/btc-to-evm.png b/docs/btc-to-evm.png new file mode 100644 index 000000000..65186a35f Binary files /dev/null and b/docs/btc-to-evm.png differ diff --git a/docs/chainxbridge.md b/docs/chainxbridge.md new file mode 100644 index 000000000..3e6a216bc --- /dev/null +++ b/docs/chainxbridge.md @@ -0,0 +1,114 @@ +# ChainXBridge + +Through ChainXBridge, assets in BEVM(formerly called `chainx-evm`) and Bitcoin can circulate freely + +![chainx-v5](https://github.com/chainx-org/ChainX/assets/8869892/9ba9afdc-c738-4392-8f05-2d9d91d3b3bd) + +## 1. Deposit + +### 1.1 BTC(bitcoin -> bevm) +TODO + +### 1.2 BRC20(bitcoin -> bevm) +TODO + +### 1.3 PCX(chainx -> bevm) +ChainX wallet: https://dapp.chainx.org/#/chainstate/extrinsics + +xAssetsBridge -> depositPcxToEvm + +100000000 means 1 PCX + +![deposit-pcx](./deposit-pcx.png) + +PCX erc20 address: `0xf3607524cAB05762cB5F0cAb17e4cA3A0F0b4E87` + +metamask wallet + +![pcx-metamask](./pcx-metamask.png) + +### 1.4 XBTC => BTC(chainx -> bevm) +ChainX wallet: https://dapp.chainx.org/#/chainstate/extrinsics + +xAssetsBridge -> swapXbtcToBtc + +1000 means 0.00001000 XBTC + +![btc-to-evm](./btc-to-evm.png) + +### 1.5 BTC(chainx -> bevm) +ChainX wallet: https://dapp.chainx.org/#/chainstate/extrinsics + +xAssetsBridge -> transferBtcToEvm + +1000 means 0.00001000 BTC + +![transfer-btc-to-evm](./transfer-btc-to-evm.png) + +## 2. Withdraw + +### 2.1 BTC(bevm -> bitcoin) +TODO + +### 2.2 BRC20(bevm -> bitcoin) +TODO + +### 2.3 PCX(bevm -> chainx) +ChainXBridge(mainnet): **0xd1543A52d770D32854fc5f5F076a74033D49D41f** + +通过remix调用ChainXBridge合约中的**withdrawPCX** +```solidity +function withdrawPCX( + uint256 value, + bytes32 chainxPubkey + ) external autoIncreaseNonce returns (bool) { + return SystemWithdraw.withdrawPCX(value, chainxPubkey); + } +``` + +下载ChainX源码,启动remixd +```bash +$ git clone https://github.com/chainx-org/ChainX.git +$ cd ChainX +$ bash scripts/remix.sh +``` + +metamask连接chainx-evm +![img.png](remix-chainx-bridge.png) + +在"At Address": 填入chainx bridge合约地址 **0xd1543A52d770D32854fc5f5F076a74033D49D41f** + +调用 "withdrawPCX": 第一个参数填pcx balance(decimals=8), 第二个参数填chainx账户的公钥 + + +chainx账户转公钥可用下面的工具: https://scan.chainx.org/tools/SS58 +![img.png](account-convert.png) + + +## 3. Query balance + +### 3.1 BTC(bevm) + +![btc-evm](./btc-evm.png) + +### 3.2 BTC(wasm) + +`0x6CfE5574639Ba46d74b6b67D2651d1470E10BA9a` mapping to `5UKCmTuj5V4wmGnmZYm6RSDbT2mqwf2FUMTJy7phjwmwE51H` + +https://evm.chainx.org/tools/SS58 + +![evm-to-chainx](./evm-to-chainx.png) + +https://dapp.chainx.org/#/chainstate/chainstate + +![btc-balance](./btc-balance.png) + +### 3.3 PCX(bevm) + +![pcx-evm](./pcx-evm.png) + +### 3.4 PCX(wasm) + +https://dapp.chainx.org/#/chainstate/chainstate + +![pcx-balance](./pcx-balance.png) \ No newline at end of file diff --git a/docs/deposit-pcx.png b/docs/deposit-pcx.png new file mode 100644 index 000000000..f8ad04d6b Binary files /dev/null and b/docs/deposit-pcx.png differ diff --git a/docs/evm-to-chainx.png b/docs/evm-to-chainx.png new file mode 100644 index 000000000..43b81a162 Binary files /dev/null and b/docs/evm-to-chainx.png differ diff --git a/docs/pcx-balance.png b/docs/pcx-balance.png new file mode 100644 index 000000000..3e262db04 Binary files /dev/null and b/docs/pcx-balance.png differ diff --git a/docs/pcx-evm.png b/docs/pcx-evm.png new file mode 100644 index 000000000..ea1cfc2e5 Binary files /dev/null and b/docs/pcx-evm.png differ diff --git a/docs/pcx-metamask.png b/docs/pcx-metamask.png new file mode 100644 index 000000000..1901fa0d5 Binary files /dev/null and b/docs/pcx-metamask.png differ diff --git a/docs/remix-chainx-bridge.png b/docs/remix-chainx-bridge.png new file mode 100644 index 000000000..87e86e64d Binary files /dev/null and b/docs/remix-chainx-bridge.png differ diff --git a/docs/transfer-btc-to-evm.png b/docs/transfer-btc-to-evm.png new file mode 100644 index 000000000..881d6460a Binary files /dev/null and b/docs/transfer-btc-to-evm.png differ