From cbb755a092481e8488289f0d4e66346e88c1efac Mon Sep 17 00:00:00 2001 From: Aki Wu Date: Fri, 28 Oct 2022 16:38:22 +0800 Subject: [PATCH 01/15] refactor init --- docs/builder/_category_.json | 5 + .../ethereum-api.md} | 6 +- docs/builder/explorers.md | 6 + docs/{ => builder}/glossary.md | 2 +- docs/builder/networks/_category_.json | 4 + docs/builder/networks/crab.md | 4 + docs/builder/networks/darwinia.md | 4 + docs/builder/networks/pangolin.md | 4 + docs/builder/networks/pangoro.md | 4 + docs/builder/public-endpoints.md | 6 + docs/builder/quick-start.md | 42 ++++++ docs/builder/solidity-precompiles.md | 6 + docs/builder/solidity-sdk/_category_.json | 4 + .../solidity-sdk}/api-reference.md | 0 .../solidity-sdk}/constants.md | 0 .../01-using-smart-chain-with-metamask.md | 2 +- .../guides/02-know-your-cross-chain-status.md | 0 .../03-execute-remote-smart-contract-call.md | 4 +- .../04-dispatch-remote-substrate-call.md | 0 .../solidity-sdk}/guides/_category_.json | 0 .../substrate-api}/Constants.md | 0 .../substrate-api}/Extrinsics.md | 0 .../substrate-api}/Storage.md | 0 docs/builder/substrate-api/_category_.json | 4 + .../substrate-api}/api-derive.md | 0 .../substrate-api}/overview.md | 0 .../substrate-api}/rpc.md | 0 docs/chains/Introduction.md | 21 --- docs/chains/_category_.json | 4 - docs/chains/darwinia-chain.md | 79 ----------- docs/chains/darwinia-parachain.md | 6 - docs/chains/darwinia-smart-chain.md | 123 ------------------ docs/protocols/_category_.json | 5 + docs/{ => protocols}/lcmp-overview.md | 0 docs/relayer/_category_.json | 5 + docs/{fee.md => relayer/cross-chain-fee.md} | 5 +- docs/relayer/fee-market.md | 5 + docs/relayer/relayer-client.md | 5 + docs/sdk/_category_.json | 4 - docs/what-is-darwinia.md | 2 +- sidebars.js | 3 +- src/css/custom.css | 17 +-- 42 files changed, 128 insertions(+), 263 deletions(-) create mode 100644 docs/builder/_category_.json rename docs/{sdk/darwinia.js/smart-chain-api.md => builder/ethereum-api.md} (94%) create mode 100644 docs/builder/explorers.md rename docs/{ => builder}/glossary.md (99%) create mode 100644 docs/builder/networks/_category_.json create mode 100644 docs/builder/networks/crab.md create mode 100644 docs/builder/networks/darwinia.md create mode 100644 docs/builder/networks/pangolin.md create mode 100644 docs/builder/networks/pangoro.md create mode 100644 docs/builder/public-endpoints.md create mode 100644 docs/builder/quick-start.md create mode 100644 docs/builder/solidity-precompiles.md create mode 100644 docs/builder/solidity-sdk/_category_.json rename docs/{sdk => builder/solidity-sdk}/api-reference.md (100%) rename docs/{sdk => builder/solidity-sdk}/constants.md (100%) rename docs/{sdk => builder/solidity-sdk}/guides/01-using-smart-chain-with-metamask.md (92%) rename docs/{sdk => builder/solidity-sdk}/guides/02-know-your-cross-chain-status.md (100%) rename docs/{sdk => builder/solidity-sdk}/guides/03-execute-remote-smart-contract-call.md (96%) rename docs/{sdk => builder/solidity-sdk}/guides/04-dispatch-remote-substrate-call.md (100%) rename docs/{sdk => builder/solidity-sdk}/guides/_category_.json (100%) rename docs/{sdk/darwinia.js/Substrate API => builder/substrate-api}/Constants.md (100%) rename docs/{sdk/darwinia.js/Substrate API => builder/substrate-api}/Extrinsics.md (100%) rename docs/{sdk/darwinia.js/Substrate API => builder/substrate-api}/Storage.md (100%) create mode 100644 docs/builder/substrate-api/_category_.json rename docs/{sdk/darwinia.js/Substrate API => builder/substrate-api}/api-derive.md (100%) rename docs/{sdk/darwinia.js/Substrate API => builder/substrate-api}/overview.md (100%) rename docs/{sdk/darwinia.js/Substrate API => builder/substrate-api}/rpc.md (100%) delete mode 100644 docs/chains/Introduction.md delete mode 100644 docs/chains/_category_.json delete mode 100644 docs/chains/darwinia-chain.md delete mode 100644 docs/chains/darwinia-parachain.md delete mode 100644 docs/chains/darwinia-smart-chain.md create mode 100644 docs/protocols/_category_.json rename docs/{ => protocols}/lcmp-overview.md (100%) create mode 100644 docs/relayer/_category_.json rename docs/{fee.md => relayer/cross-chain-fee.md} (97%) create mode 100644 docs/relayer/fee-market.md create mode 100644 docs/relayer/relayer-client.md delete mode 100644 docs/sdk/_category_.json diff --git a/docs/builder/_category_.json b/docs/builder/_category_.json new file mode 100644 index 00000000..0085891d --- /dev/null +++ b/docs/builder/_category_.json @@ -0,0 +1,5 @@ +{ + "label": "Builder", + "collapsible": false, + "position": 1 +} diff --git a/docs/sdk/darwinia.js/smart-chain-api.md b/docs/builder/ethereum-api.md similarity index 94% rename from docs/sdk/darwinia.js/smart-chain-api.md rename to docs/builder/ethereum-api.md index 0005d957..7474f8c5 100644 --- a/docs/sdk/darwinia.js/smart-chain-api.md +++ b/docs/builder/ethereum-api.md @@ -1,8 +1,8 @@ --- -sidebar_position: 4 +sidebar_position: 105 --- -# Smart Chain API +# Ethereum API ### Introduction @@ -60,4 +60,4 @@ const providerRPC = { ``` -Then return contains transcation hash and check more detail information at [Crab Subscan](https://crab.subscan.io/) +Then return contains transcation hash and check more detail information at [Crab Subscan](https://crab.subscan.io/) \ No newline at end of file diff --git a/docs/builder/explorers.md b/docs/builder/explorers.md new file mode 100644 index 00000000..b893af12 --- /dev/null +++ b/docs/builder/explorers.md @@ -0,0 +1,6 @@ +--- +sidebar_position: 104 +--- + +# Explorers +tbd \ No newline at end of file diff --git a/docs/glossary.md b/docs/builder/glossary.md similarity index 99% rename from docs/glossary.md rename to docs/builder/glossary.md index 78e695ea..549e1bee 100644 --- a/docs/glossary.md +++ b/docs/builder/glossary.md @@ -1,5 +1,5 @@ --- -sidebar_position: 7 +sidebar_position: 108 --- # Glossary diff --git a/docs/builder/networks/_category_.json b/docs/builder/networks/_category_.json new file mode 100644 index 00000000..ffbb9477 --- /dev/null +++ b/docs/builder/networks/_category_.json @@ -0,0 +1,4 @@ +{ + "label": "Networks", + "position": 101 +} diff --git a/docs/builder/networks/crab.md b/docs/builder/networks/crab.md new file mode 100644 index 00000000..6b03b3a8 --- /dev/null +++ b/docs/builder/networks/crab.md @@ -0,0 +1,4 @@ +--- +sidebar_position: 0 +title: Crab +--- \ No newline at end of file diff --git a/docs/builder/networks/darwinia.md b/docs/builder/networks/darwinia.md new file mode 100644 index 00000000..907da834 --- /dev/null +++ b/docs/builder/networks/darwinia.md @@ -0,0 +1,4 @@ +--- +sidebar_position: 0 +title: Darwinia +--- \ No newline at end of file diff --git a/docs/builder/networks/pangolin.md b/docs/builder/networks/pangolin.md new file mode 100644 index 00000000..98d393be --- /dev/null +++ b/docs/builder/networks/pangolin.md @@ -0,0 +1,4 @@ +--- +sidebar_position: 0 +title: Pangolin +--- \ No newline at end of file diff --git a/docs/builder/networks/pangoro.md b/docs/builder/networks/pangoro.md new file mode 100644 index 00000000..8b2b88ea --- /dev/null +++ b/docs/builder/networks/pangoro.md @@ -0,0 +1,4 @@ +--- +sidebar_position: 0 +title: Pangoro +--- \ No newline at end of file diff --git a/docs/builder/public-endpoints.md b/docs/builder/public-endpoints.md new file mode 100644 index 00000000..2fc3e139 --- /dev/null +++ b/docs/builder/public-endpoints.md @@ -0,0 +1,6 @@ +--- +sidebar_position: 102 +--- + +# Public Endpoints +tbd \ No newline at end of file diff --git a/docs/builder/quick-start.md b/docs/builder/quick-start.md new file mode 100644 index 00000000..03e1b211 --- /dev/null +++ b/docs/builder/quick-start.md @@ -0,0 +1,42 @@ +--- +sidebar_position: 1 +--- + +# Quick Start +## Overview + +## Networks + +### Network Configurations + +## TestNet Faucet + +* [Pangoro ORING Faucet](https://apps.darwinia.network/?network=pangoro) +* [Pangolin PRING Faucet](https://apps.darwinia.network/?rpc=wss%253A%252F%252Fpangolin-rpc.darwinia.network) + +## Dev Tools + +#### EVM tools + +Darwinia is EVM-compatiable, so your can use almost all toolchains for EVM. Here are some of our picks: + +Wallets: + +- [MetaMask](https://metamask.io/) + +Libraries: + +* [web3.js](https://github.com/web3/web3.js) +* [ethers.js](https://github.com/ethers-io/ethers.js) + +Contract Libraries: + +* [OpenZeppelin](https://openzeppelin.com/) + +Dev Environment: + +* [Remix](https://remix.ethereum.org/) +* [Hardhat](https://hardhat.org/) + +## Conntect to Darwinia public node + diff --git a/docs/builder/solidity-precompiles.md b/docs/builder/solidity-precompiles.md new file mode 100644 index 00000000..986886c2 --- /dev/null +++ b/docs/builder/solidity-precompiles.md @@ -0,0 +1,6 @@ +--- +sidebar_position: 103 +--- + +# Solidity Precompiles +tbd \ No newline at end of file diff --git a/docs/builder/solidity-sdk/_category_.json b/docs/builder/solidity-sdk/_category_.json new file mode 100644 index 00000000..060bcfcd --- /dev/null +++ b/docs/builder/solidity-sdk/_category_.json @@ -0,0 +1,4 @@ +{ + "label": "Solidity SDK", + "position": 107 +} diff --git a/docs/sdk/api-reference.md b/docs/builder/solidity-sdk/api-reference.md similarity index 100% rename from docs/sdk/api-reference.md rename to docs/builder/solidity-sdk/api-reference.md diff --git a/docs/sdk/constants.md b/docs/builder/solidity-sdk/constants.md similarity index 100% rename from docs/sdk/constants.md rename to docs/builder/solidity-sdk/constants.md diff --git a/docs/sdk/guides/01-using-smart-chain-with-metamask.md b/docs/builder/solidity-sdk/guides/01-using-smart-chain-with-metamask.md similarity index 92% rename from docs/sdk/guides/01-using-smart-chain-with-metamask.md rename to docs/builder/solidity-sdk/guides/01-using-smart-chain-with-metamask.md index b120441c..db6c3dd2 100644 --- a/docs/sdk/guides/01-using-smart-chain-with-metamask.md +++ b/docs/builder/solidity-sdk/guides/01-using-smart-chain-with-metamask.md @@ -12,7 +12,7 @@ sidebar_position: 1 ### Smart Chain Parameters -See [Darwinia Smart Chain](../../chains/darwinia-smart-chain) +See [Darwinia Smart Chain](../../networks/darwinia) ## Deposit tokens diff --git a/docs/sdk/guides/02-know-your-cross-chain-status.md b/docs/builder/solidity-sdk/guides/02-know-your-cross-chain-status.md similarity index 100% rename from docs/sdk/guides/02-know-your-cross-chain-status.md rename to docs/builder/solidity-sdk/guides/02-know-your-cross-chain-status.md diff --git a/docs/sdk/guides/03-execute-remote-smart-contract-call.md b/docs/builder/solidity-sdk/guides/03-execute-remote-smart-contract-call.md similarity index 96% rename from docs/sdk/guides/03-execute-remote-smart-contract-call.md rename to docs/builder/solidity-sdk/guides/03-execute-remote-smart-contract-call.md index 070b938f..4e438f2a 100644 --- a/docs/sdk/guides/03-execute-remote-smart-contract-call.md +++ b/docs/builder/solidity-sdk/guides/03-execute-remote-smart-contract-call.md @@ -40,8 +40,8 @@ In this example, we need two endpoints. One is for Pangoro Smart Chain, and the Copy the flattened PangoroToPangolinEndpoint.sol to [Remix](https://remix.ethereum.org/) and deploy it to Pangoro Smart Chain. > How to use Remix to deploy a contract? here are some useful articles. [Creating and Deploying a Contract in Remix](https://remix-ide.readthedocs.io/en/latest/create_deploy.html) - [Using Smart Chain with MetaMask](/sdk/guides/using-smart-chain-with-metamask) - [Pangoro Smart Chain Info](/chains/darwinia-smart-chain#for-pangoro-smart-chain) + [Using Smart Chain with MetaMask](./using-smart-chain-with-metamask) + [Pangoro Smart Chain Info](../../networks/darwinia) 3. Deploy `PangolinToPangoroEndpoint` to Pangolin Smart Chain. diff --git a/docs/sdk/guides/04-dispatch-remote-substrate-call.md b/docs/builder/solidity-sdk/guides/04-dispatch-remote-substrate-call.md similarity index 100% rename from docs/sdk/guides/04-dispatch-remote-substrate-call.md rename to docs/builder/solidity-sdk/guides/04-dispatch-remote-substrate-call.md diff --git a/docs/sdk/guides/_category_.json b/docs/builder/solidity-sdk/guides/_category_.json similarity index 100% rename from docs/sdk/guides/_category_.json rename to docs/builder/solidity-sdk/guides/_category_.json diff --git a/docs/sdk/darwinia.js/Substrate API/Constants.md b/docs/builder/substrate-api/Constants.md similarity index 100% rename from docs/sdk/darwinia.js/Substrate API/Constants.md rename to docs/builder/substrate-api/Constants.md diff --git a/docs/sdk/darwinia.js/Substrate API/Extrinsics.md b/docs/builder/substrate-api/Extrinsics.md similarity index 100% rename from docs/sdk/darwinia.js/Substrate API/Extrinsics.md rename to docs/builder/substrate-api/Extrinsics.md diff --git a/docs/sdk/darwinia.js/Substrate API/Storage.md b/docs/builder/substrate-api/Storage.md similarity index 100% rename from docs/sdk/darwinia.js/Substrate API/Storage.md rename to docs/builder/substrate-api/Storage.md diff --git a/docs/builder/substrate-api/_category_.json b/docs/builder/substrate-api/_category_.json new file mode 100644 index 00000000..45680b38 --- /dev/null +++ b/docs/builder/substrate-api/_category_.json @@ -0,0 +1,4 @@ +{ + "label": "Substrate API", + "position": 106 +} diff --git a/docs/sdk/darwinia.js/Substrate API/api-derive.md b/docs/builder/substrate-api/api-derive.md similarity index 100% rename from docs/sdk/darwinia.js/Substrate API/api-derive.md rename to docs/builder/substrate-api/api-derive.md diff --git a/docs/sdk/darwinia.js/Substrate API/overview.md b/docs/builder/substrate-api/overview.md similarity index 100% rename from docs/sdk/darwinia.js/Substrate API/overview.md rename to docs/builder/substrate-api/overview.md diff --git a/docs/sdk/darwinia.js/Substrate API/rpc.md b/docs/builder/substrate-api/rpc.md similarity index 100% rename from docs/sdk/darwinia.js/Substrate API/rpc.md rename to docs/builder/substrate-api/rpc.md diff --git a/docs/chains/Introduction.md b/docs/chains/Introduction.md deleted file mode 100644 index 3f83bdf8..00000000 --- a/docs/chains/Introduction.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -sidebar_position: 0 -title: Introduction ---- - -Darwinia offers a number of different chains for development of messaging infrastructure and Dapp deployment, each with its own features and benefits. - -## [Darwinia Chain](darwinia-chain.md) - -Darwinia Chain is designed to be the primary chain for tokens and governance, main communication hub and routing point of the LCMP, and will support most on-chain light clients for other public chains. - -Darwinia Chain is a public chain that can operate independently with its own consensus and security model, with its core business and application services, including cross-chain functionality of each application chain, controlled by the Darwinia Chain itself. - -## [Darwinia Parachain](darwinia-parachain.md) -Darwinia Parachain is designed to be protected by the shared security of the Polkadot Relay Chain. It will integrate Polkadot’s XCMP, open channels with other parachains, and connect to the Darwinia Chain via LCMP. - -Darwinia Parachain does not have its own economy. - -## [Darwinia Smart Chain](darwinia-smart-chain.md) - -Darwinia Smart Chain adds an Ethereum-Compatible layer to the Darwinia Chain and provides users with the ability to create and interact with solidity smart contracts. The node of Darwinia Smart Chain provides Ethereum RPCs endpoint for reading chain states and sending transactions which can be included in Ethereum blocks, and these blocks are chained together as an Ethereum blockchain in the Darwinia Chain. Therefore, it is easy for projects in the Ethereum ecosystem to migrate to the Darwinia Chain. \ No newline at end of file diff --git a/docs/chains/_category_.json b/docs/chains/_category_.json deleted file mode 100644 index 69f0f5f5..00000000 --- a/docs/chains/_category_.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "label": "Darwinia Chains", - "position": 6 -} diff --git a/docs/chains/darwinia-chain.md b/docs/chains/darwinia-chain.md deleted file mode 100644 index 4221fca9..00000000 --- a/docs/chains/darwinia-chain.md +++ /dev/null @@ -1,79 +0,0 @@ ---- -sidebar_position: 1 -title: Darwinia Chain ---- - -## Introduction - -The Darwinia Chain is a public chain based on substrate with cross-chain components, including substrate to ethereum and substrate to substrate. In this article we will cover a number of topics that are important to developers, such as network configuration, on-chain runtime params and so on. In addition, we have set up a free test network, the pangoro network, where the latest features will be fully tested before they are added to the Darwinia Chain. The user can obtain test tokens at [Pangoro Test Token Faucet](https://apps.darwinia.network/?network=pangoro). - -### Network Info - -#### For Darwinia Chain - -- Network Name: `Darwinia` -- Token Name: `RING` -- Token Decimal: `9` -- Block Explorer URL: `https://darwinia.subscan.io/` -- HTTP Endpoints: - - `https://rpc.darwinia.network` - - `https://darwinia-rpc.dwellir.com` -- WSS Endpoints: - - `wss://rpc.darwinia.network` - - `wss://darwinia-rpc.dwellir.com` - -#### For Pangoro Chain - -- Network Name: `Pangoro` -- Token Name: `ORING` -- Token Decimal: `9` -- Block Explorer URL: `https://pangoro.subscan.io/` -- HTTP Endpoints: - - `https://pangoro-rpc.darwinia.network` -- WSS Endpoints: - - `wss://pangoro-rpc.darwinia.network` - -### On-Chain Params - -> This page intends to reflect the current configurations of the Darwinia Chain and provide some brief explanation to their meanings when necessary. - -- Block, Epoch and Era Time - - | Darwinia | Time | Slots | - | -------- | --------- | ----- | - | Block | 6 seconds | 1 | - | Epoch | 4 hour | 2,400 | - | Era | 24 hours |14,400 | - - -- Staking, Validating and Nominating Time - - | Darwinia | Time | Slots | Description | - | --- | --- | --- | --- | - | Term duration | 24 hours | 14,400 | The time for which a validator is in the set after being elected. Note, this duration can be shortened in the case that a validator misbehaves. | - | Nomination period | 24 hours | 14,400 | Every 24 hours, a new validator set is elected according to Phragmen's method. | - | Bonding duration | 14 days | 201,600 | How long until your funds will be transferable after unbonding. | - -- Parameters of Validators - - One preliminary method to make profit is to nominate a validator. There are multiple factors to consider when choosing a validator wisely. Although we do not make recommendations out of neutrality, we provide an explanation of the meaning of the parameters related to a validator. A comprehensive understanding can help you assess your candidates accurately. - -- Active Commission - - The *active commission* is the percentage of the gain that the validator will draw before distributing according to staking power in the current era. This parameter is set by the validator. From one perspective, it measures the willingness of the validator to share the profit with nominators. Meanwhile, it can be interpreted as an indicator of their confidence in themselves. In a nutshell, one cannot say that the higher the better or otherwise. - -- Next Commission - - The *next commission* is the percentage of the gain that the validator will draw before distributing according to staking power in the next era. This parameter is set by the validator. It may directly affect your profit if you endorse this validator. As explained above, this is not a simple measure of good or bad. - -- Own Stake(Power) - - The *own stake (power)* is the amount of power that the validator has locked for staking currently. It indicates how much stake the validator has put in the game. Since if the validator is punished for some reason, part of the staking power will be slashed, the higher this number is, the higher risk the validator is willing to take. - -- Other Stake(Power) - - The *other stake (power)* is the amount of power that nominators have trusted the validator with. This partly indicates the level of confidence that nominators have on the validator. - -- Points - - The *point* is a measure of the validator's achievement in the current era. The validator normally gets 20 points for each block produced by them. If a validator has 1200 *points*, it means that this validator has produced 60(1200/20) blocks successfully so far in current era. \ No newline at end of file diff --git a/docs/chains/darwinia-parachain.md b/docs/chains/darwinia-parachain.md deleted file mode 100644 index ab090d28..00000000 --- a/docs/chains/darwinia-parachain.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -sidebar_position: 3 -title: Darwinia Parachain ---- - -TODO \ No newline at end of file diff --git a/docs/chains/darwinia-smart-chain.md b/docs/chains/darwinia-smart-chain.md deleted file mode 100644 index 135d0685..00000000 --- a/docs/chains/darwinia-smart-chain.md +++ /dev/null @@ -1,123 +0,0 @@ ---- -sidebar_position: 2 -title: Darwinia Smart Chain ---- - -## Introduction - -Darwinia Smart Chain is a substrate based ethereum compatible smart contract platform where contract developers can easily migrate -smart contracts from the Ethereum chain to run their business. In this article we will cover a number of topics that are important to contract developers, such as network configuration, precompiled contracts and so on. In addition, we have set up a free test network, the pangoro network, where the latest features will be fully tested before they are added to the Darwinia Smart Chain. The user can obtain test tokens at [Pangoro Test Token Faucet](https://apps.darwinia.network/?network=pangoro). - -### Network Info - -#### For Darwinia Smart Chain - -- Network Name: `Darwinia Smart Chain` -- Token Name: `RING` -- Token Decimal: `18` -- ChainId: `46` -- Block Explorer URL: `https://darwinia.subscan.io/` -- HTTP Endpoints: - - `https://rpc.darwinia.network` - - `https://darwinia-rpc.dwellir.com` -- WSS Endpoints: - - `wss://rpc.darwinia.network` - - `wss://darwinia-rpc.dwellir.com` - -#### For Pangoro Smart Chain - -- Network Name: `Pangoro Smart Chain` -- Token Name: `ORING` -- Token Decimal: `18` -- ChainId: `45` -- Block Explorer URL: `https://pangoro.subscan.io/` -- HTTP Endpoints: - - `https://pangoro-rpc.darwinia.network` -- WSS Endpoints: - - `wss://pangoro-rpc.darwinia.network` - - -### Other Tokens For Darwinia Smart Chain - -| Token Symbol | Spec | Decimals | Smart Contract Address | -| --- | --- | --- | --- | -| KTON | ERC20 | 18 | 0x0000000000000000000000000000000000000402 | -| WRING | ERC20 | 18 | 0xE7578598Aac020abFB918f33A20faD5B71d670b4 | - - -### Precompiled Contracts - -#### For Darwinia Smart Chain - -Ethereum compatible: - -- `0x0000000000000000000000000000000000000001`: ECRecover -- `0x0000000000000000000000000000000000000002`: Sha256 -- `0x0000000000000000000000000000000000000003`: Ripemd160 -- `0x0000000000000000000000000000000000000004`: Identity -- `0x0000000000000000000000000000000000000005`: Modexp -- `0x0000000000000000000000000000000000000006`: Bn128Add -- `0x0000000000000000000000000000000000000007`: Bn128Mul -- `0x0000000000000000000000000000000000000008`: Bn128Pairing -- `0x0000000000000000000000000000000000000009`: Blake2F - -Darwinia dedicated: - -- `0x0000000000000000000000000000000000000400`: StateStorage - - This contract is used to get the storage values from substrate modules by storage key. - - Function signature: `state_storage(bytes)` - - Params: the substrate storage key -- `0x0000000000000000000000000000000000000401`: Dispatch - - This contract is used to dispatch the substrate dispatch calls. - - Function signature: `(bytes)` - - Params: scale encoded substrate dispatch call -- `0x0000000000000000000000000000000000000402`: KTON - - KTON contract which compatible with the Ethereum ERC20 protocol. - -#### For Pangoro Smart Chain - -Ethereum compatible: - -- `0x0000000000000000000000000000000000000001`: ECRecover -- `0x0000000000000000000000000000000000000002`: Sha256 -- `0x0000000000000000000000000000000000000003`: Ripemd160 -- `0x0000000000000000000000000000000000000004`: Identity -- `0x0000000000000000000000000000000000000005`: Modexp -- `0x0000000000000000000000000000000000000006`: Bn128Add -- `0x0000000000000000000000000000000000000007`: Bn128Mul -- `0x0000000000000000000000000000000000000008`: Bn128Pairing -- `0x0000000000000000000000000000000000000009`: Blake2F - -Darwinia dedicated: - -- `0x0000000000000000000000000000000000000400`: StateStorage - - This contract is used to get the storage values from substrate modules by storage key. - - Function signature: `state_storage(bytes)` - - Params: the substrate storage key -- `0x0000000000000000000000000000000000000401`: Dispatch - - This contract is used to dispatch the substrate dispatch calls. - - Function signature: `(bytes)` - - Params: scale encoded substrate dispatch call -- `0x0000000000000000000000000000000000000402`: KTON - - KTON contract which compatible with the Ethereum ERC20 protocol. -- `0x0000000000000000000000000000000000000800`: BLS12381 - - function signature: `fast_aggregate_verify(bytes[],bytes,bytes)` - - -### Things Dapp developers must know - -#### Ethereum Block Author - -The author(miner) of the ethereum block you get from `eth_getBlockByNumber()` or `eth_getBlockByHash()` is the last 20 bytes of the actual substrate block author. It's because the ethereum block is built based on substrate block and who's author is a 32-bytes address. We have to truncate to adapt ethereum block needs. **Please do not tranfer to the ethereum block author, since the private key of this address is unknown.** -#### Genesis Block - -It is particularly important to note that Darwinia Smart Chain's genesis block does not start at 0 like Ethereum. It is `9453251`. This means that if you try to query the block history before this with `eth_getBlockByNumber()` or `eth_getBlockByHash()`, you will get `null`. This is because the DVM smart contract solution was added in the middle of the Substrate-base Darwinia chain, there are no Ethereum transactions in the Substrate history blocks and no corresponding Ethereum history blocks generated. - -#### Consensus Related Field - -Ethereum uses a consensus protocol named Proof-of-Work (PoW). While Darwinia Smart Chain uses the Nominated Proof of Stake(NPOS). They are two completely different consensus mechanisms. Consequently, Proof of Work concepts, such as `difficulty`, `uncles`, `hashrate`, generally is not applicable to Darwinia Smart Chain. For APIs that return value related to Ethereum’s Proof of Work, default value are returned. - -#### Use `block.timestamp` instead of `block.number` - -On Ethereum or other EVM-Compatible platform, you may use `block.number` in contract, but this is not recommended in Darwinia Smart Chain. We may introduce Darwinia Smart Chain 2.0 (The Next Generation) in the future and export the data from Darwinia Smart Chain 1.0 to Darwinia Smart Chain 2.0, which may reset the chain height to zero, so we recommend using `block.timestamp`. - diff --git a/docs/protocols/_category_.json b/docs/protocols/_category_.json new file mode 100644 index 00000000..04530207 --- /dev/null +++ b/docs/protocols/_category_.json @@ -0,0 +1,5 @@ +{ + "label": "Protocols", + "collapsible": false, + "position": 3 +} diff --git a/docs/lcmp-overview.md b/docs/protocols/lcmp-overview.md similarity index 100% rename from docs/lcmp-overview.md rename to docs/protocols/lcmp-overview.md diff --git a/docs/relayer/_category_.json b/docs/relayer/_category_.json new file mode 100644 index 00000000..40fb5d6e --- /dev/null +++ b/docs/relayer/_category_.json @@ -0,0 +1,5 @@ +{ + "label": "Relayer", + "collapsible": false, + "position": 2 +} diff --git a/docs/fee.md b/docs/relayer/cross-chain-fee.md similarity index 97% rename from docs/fee.md rename to docs/relayer/cross-chain-fee.md index deda3ead..637e259f 100644 --- a/docs/fee.md +++ b/docs/relayer/cross-chain-fee.md @@ -1,8 +1,8 @@ --- -sidebar_position: 3 +sidebar_position: 1 --- -# Fee +# Cross-chain Fee ## Fee Structure @@ -32,4 +32,3 @@ Dapp developers can estimate fees through the App SDK. }); ``` - diff --git a/docs/relayer/fee-market.md b/docs/relayer/fee-market.md new file mode 100644 index 00000000..85a54afe --- /dev/null +++ b/docs/relayer/fee-market.md @@ -0,0 +1,5 @@ +--- +sidebar_position: 2 +--- + +# Fee Market \ No newline at end of file diff --git a/docs/relayer/relayer-client.md b/docs/relayer/relayer-client.md new file mode 100644 index 00000000..0d8e00a4 --- /dev/null +++ b/docs/relayer/relayer-client.md @@ -0,0 +1,5 @@ +--- +sidebar_position: 3 +--- + +# Relayer Client \ No newline at end of file diff --git a/docs/sdk/_category_.json b/docs/sdk/_category_.json deleted file mode 100644 index 62ac1094..00000000 --- a/docs/sdk/_category_.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "label": "SDK", - "position": 5 -} diff --git a/docs/what-is-darwinia.md b/docs/what-is-darwinia.md index 0a3aabb9..10118139 100644 --- a/docs/what-is-darwinia.md +++ b/docs/what-is-darwinia.md @@ -1,5 +1,5 @@ --- -sidebar_position: 1 +sidebar_position: 0 slug: / --- diff --git a/sidebars.js b/sidebars.js index fd342f2c..ff1e5a82 100644 --- a/sidebars.js +++ b/sidebars.js @@ -14,7 +14,8 @@ /** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */ const sidebars = { // By default, Docusaurus generates a sidebar from the docs folder structure - tutorialSidebar: [{type: 'autogenerated', dirName: '.'}], + tutorialSidebar: [{type: 'autogenerated', dirName: './builder', }], + relayerSidebar: [{type: 'autogenerated', dirName: '.'}] // But you can create a sidebar manually /* diff --git a/src/css/custom.css b/src/css/custom.css index b1d62d36..246450b0 100644 --- a/src/css/custom.css +++ b/src/css/custom.css @@ -49,15 +49,9 @@ html[data-theme='dark'] { background-color: rgba(0, 0, 0, 0.3); } -article { - max-width: 95%; - margin-left: auto; - margin-right: auto; -} - -.navbar .navbar__items { +/* .navbar .navbar__items { flex: auto; -} +} */ /* Announcement Bar */ div[class^='announcementBarContent'] { @@ -95,9 +89,4 @@ div[class^='announcementBarContent'] a:hover { text-decoration: underline; } -@media screen and (min-width: 997px) { - /* Show inline table of contents on mobile only */ - div[class^='tableOfContentsInline'] { - display: none; - } -} + From 24205bb0c0ac280aaefe2a852ec1685546ae75e8 Mon Sep 17 00:00:00 2001 From: Aki Wu Date: Wed, 9 Nov 2022 11:01:37 +0800 Subject: [PATCH 02/15] fill networks --- docs/builder/networks/crab.md | 91 ++++++++++++++++++++++++++++++- docs/builder/networks/darwinia.md | 75 ++++++++++++++++++++++++- docs/builder/networks/pangolin.md | 41 +++++++++++++- docs/builder/networks/pangoro.md | 41 +++++++++++++- 4 files changed, 241 insertions(+), 7 deletions(-) diff --git a/docs/builder/networks/crab.md b/docs/builder/networks/crab.md index 6b03b3a8..7e8c51f0 100644 --- a/docs/builder/networks/crab.md +++ b/docs/builder/networks/crab.md @@ -1,4 +1,91 @@ --- -sidebar_position: 0 +sidebar_position: 1 title: Crab ---- \ No newline at end of file +--- + +Crab Network is a canary network with real economic value for Darwinia, and its positioning is similar to Polkadot's Kusama Network. To expect chaos is a reasonable assumption! + +## Network Info + +- Network Name: Crab +- Token Name: CRAB +- Token Decimal: 9 +- Block Explorer: + - https://crab.subscan.io/ +- HTTP Endpoints: + - https://crab-rpc.darwinia.network + - https://darwinia-crab.api.onfinality.io/public + - https://darwiniacrab-rpc.dwellir.com +- WSS Endpoints: + - wss://crab-rpc.darwinia.network + - wss://darwinia-crab.api.onfinality.io/public-ws + - wss://darwiniacrab-rpc.dwellir.com + +#### EVM Info +- Network Name: Crab Smart Chain +- Token Name: CRAB +- Token Decimal: 18 +- ChainId: 44 +- Block Explorer: + - https://crab.subscan.io/ +- HTTP Endpoints: + - https://crab-rpc.darwinia.network + - https://darwinia-crab.api.onfinality.io/public + - https://darwiniacrab-rpc.dwellir.com +- WSS Endpoints: + - wss://crab-rpc.darwinia.network + - wss://darwinia-crab.api.onfinality.io/public-ws + - wss://darwiniacrab-rpc.dwellir.com + +## Params + +### Block, Epoch and Era Time + +| Darwinia | Time | Slots | +| -------- | --------- | ----- | +| Block | 6 seconds | 1 | +| Epoch | 1 hour | 600 | +| Era | 6 hours | 3,600 | + +### Staking, Validating, and Nominating + +| Darwinia | Time | Slots | Description | +| ----------------------- | ---------------------------------- | ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | +| Validator Slots | 7 | Initial slots for active validators, gradually increasing. | | +| Term duration | 6 hours | 3,600 | The time for which a validator is in the set after being elected. Note, this duration can be shortened in the case that a validator misbehaves. | +| Nomination period | 6 hours | 3,600 | Every 6 hours, a new validator set is elected according to Phragmen's method. | +| Bonding duration | 14 days | 201,600 | How long until your funds will be transferrable after unbonding. | +| Slash defer duration | 14 days | 201,600 | Prevents overslashing and validators "escaping" and getting their nominators slashed with no repercussions to themselves | +| Slash Cancellation Vote | Requires 3/4 of Council to Approve | | | +### Governance + +| Democracy | Time | Slots | Description | +| ---------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| Voting period | 7 days | 100,800 | How long the public can vote on a referendum. | +| Launch period | 7 days | 100,800 | How long the public can select which proposal to hold a referendum on. i.e., Every week, the highest-weighted proposal will be selected to have a referendum | +| Enactment period | 8 days | 115,200 | Time it takes for a successful referendum to be implemented on the network. | + +| Council | Time | Slots | Description | +| ------------- | ----- | ----- | -------------------------------------------------------------------- | +| Term duration | 1 day | 3,600 | The length of a council member's term until the next election round. | +| Voting period | 1 day | 3,600 | The council's voting period for motions. | + +| Technical committee | Time | Slots | Description | +| ----------------------- | ------- | ------- | ---------------------------------------------------------------------------------------------- | +| Cool-off period | 7 days | 100,800 | The time a veto from the technical committee lasts before the proposal can be submitted again. | +| Emergency voting period | 3 hours | 1,800 | The voting period after the technical committee expedites voting. | + +### Treasury + +| Parameter | Value | Description | +| --------------------------- | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | +| Budgeting Period** | 6 days | When the treasury can spend again after spending previously. | +| Proposal Bond | 5% and minumum 1000 CRAB | The amount required to bond in order to propose a treasury spend. If approved, it is returned, if the proposal fails, it is burnt. | +| Burn unspent treasury funds | Off | This deactivates a burn of all unspent treasury funds at the end of a budgeting period. | + +### SS58 Address Format + +Chain specification name: Crab + +SS58 prefix: 42 + diff --git a/docs/builder/networks/darwinia.md b/docs/builder/networks/darwinia.md index 907da834..7fe085f7 100644 --- a/docs/builder/networks/darwinia.md +++ b/docs/builder/networks/darwinia.md @@ -1,4 +1,77 @@ --- sidebar_position: 0 title: Darwinia ---- \ No newline at end of file +--- + +Darwinia is a public chain based on substrate with cross-chain components, including substrate to ethereum and substrate to substrate. + +## Network Info + +- Network Name: Darwinia +- Token Name: RING +- Token Decimal: 9 +- Block Explorer: + - https://darwinia.subscan.io/ +- HTTP Endpoints: + - https://rpc.darwinia.network + - https://darwinia-rpc.dwellir.com +- WSS Endpoints: + - wss://rpc.darwinia.network + - wss://darwinia-rpc.dwellir.com + +#### EVM Info +- Network Name: Darwinia Smart Chain +- Token Name: RING +- Token Decimal: 18 +- ChainId: 46 +- Block Explorer: + - https://darwinia.subscan.io/ +- HTTP Endpoints: + - https://rpc.darwinia.network + - https://darwinia-rpc.dwellir.com +- WSS Endpoints: + - wss://rpc.darwinia.network + - wss://darwinia-rpc.dwellir.com + +## Params + +### Block, Epoch and Era Time + +| Darwinia | Time | Slots | +| -------- | --------- | ----- | +| Block | 6 seconds | 1 | +| Epoch | 4 hour | 2,400 | +| Era | 24 hours |14,400 | + + +### Staking, Validating and Nominating Time + +| Darwinia | Time | Slots | Description | +| --- | --- | --- | --- | +| Term duration | 24 hours | 14,400 | The time for which a validator is in the set after being elected. Note, this duration can be shortened in the case that a validator misbehaves. | +| Nomination period | 24 hours | 14,400 | Every 24 hours, a new validator set is elected according to Phragmen's method. | +| Bonding duration | 14 days | 201,600 | How long until your funds will be transferable after unbonding. | + +### Parameters of Validators + +One preliminary method to make profit is to nominate a validator. There are multiple factors to consider when choosing a validator wisely. Although we do not make recommendations out of neutrality, we provide an explanation of the meaning of the parameters related to a validator. A comprehensive understanding can help you assess your candidates accurately. + +#### Active Commission + +The *active commission* is the percentage of the gain that the validator will draw before distributing according to staking power in the current era. This parameter is set by the validator. From one perspective, it measures the willingness of the validator to share the profit with nominators. Meanwhile, it can be interpreted as an indicator of their confidence in themselves. In a nutshell, one cannot say that the higher the better or otherwise. + +#### Next Commission + +The *next commission* is the percentage of the gain that the validator will draw before distributing according to staking power in the next era. This parameter is set by the validator. It may directly affect your profit if you endorse this validator. As explained above, this is not a simple measure of good or bad. + +#### Own Stake(Power) + +The *own stake (power)* is the amount of power that the validator has locked for staking currently. It indicates how much stake the validator has put in the game. Since if the validator is punished for some reason, part of the staking power will be slashed, the higher this number is, the higher risk the validator is willing to take. + +#### Other Stake(Power) + +The *other stake (power)* is the amount of power that nominators have trusted the validator with. This partly indicates the level of confidence that nominators have on the validator. + +#### Points + +The *point* is a measure of the validator's achievement in the current era. The validator normally gets 20 points for each block produced by them. If a validator has 1200 *points*, it means that this validator has produced 60(1200/20) blocks successfully so far in current era. diff --git a/docs/builder/networks/pangolin.md b/docs/builder/networks/pangolin.md index 98d393be..39bcbf43 100644 --- a/docs/builder/networks/pangolin.md +++ b/docs/builder/networks/pangolin.md @@ -1,4 +1,41 @@ --- -sidebar_position: 0 +sidebar_position: 3 title: Pangolin ---- \ No newline at end of file +--- + +Pangolin is the testnet of Crab. + +## Network Info + +- Network Name: Pangolin +- Token Name: PRING +- Token Decimal: 9 +- Block Explorer: + - https://pangolin.subscan.io/ +- HTTP Endpoints: + - https://pangolin-rpc.darwinia.network +- WSS Endpoints: + - wss://pangolin-rpc.darwinia.network + +#### EVM Info +- Network Name: Pangolin Smart Chain +- Token Name: PRING +- Token Decimal: 18 +- ChainId: 43 +- Block Explorer: + - https://pangolin.subscan.io/ +- HTTP Endpoints: + - https://pangolin-rpc.darwinia.network +- WSS Endpoints: + - wss://pangolin-rpc.darwinia.network + +## Params + +### Block, Epoch and Era Time + +| Darwinia | Time | Slots | +| -------- | --------- | ----- | +| Block | 6 seconds | 1 | +| Epoch | 0.5 hour | 300 | +| Era | 1.5 hours | 900 | + diff --git a/docs/builder/networks/pangoro.md b/docs/builder/networks/pangoro.md index 8b2b88ea..78f637e7 100644 --- a/docs/builder/networks/pangoro.md +++ b/docs/builder/networks/pangoro.md @@ -1,4 +1,41 @@ --- -sidebar_position: 0 +sidebar_position: 2 title: Pangoro ---- \ No newline at end of file +--- + +Pangoro is the testnet of Darwinia. + +## Network Info + +- Network Name: Pangoro +- Token Name: ORING +- Token Decimal: 9 +- Block Explorer: + - https://pangoro.subscan.io/ +- HTTP Endpoints: + - https://pangoro-rpc.darwinia.network +- WSS Endpoints: + - wss://pangoro-rpc.darwinia.network + +#### EVM Info +- Network Name: Pangoro Smart Chain +- Token Name: ORING +- Token Decimal: 18 +- Block Explorer: +- ChainId: 45 + - https://pangoro.subscan.io/ +- HTTP Endpoints: + - https://pangoro-rpc.darwinia.network +- WSS Endpoints: + - wss://pangoro-rpc.darwinia.network + +## Params + +### Block, Epoch and Era Time + +| Darwinia | Time | Slots | +| -------- | --------- | ----- | +| Block | 6 seconds | 1 | +| Epoch | 2 hour | 1,200 | +| Era | 6 hours | 3,600 | + From 653d7ad5424bdde238aa40358e726da111d48e5c Mon Sep 17 00:00:00 2001 From: Aki Wu Date: Wed, 9 Nov 2022 11:05:21 +0800 Subject: [PATCH 03/15] add other tokens to crab --- docs/builder/networks/crab.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/docs/builder/networks/crab.md b/docs/builder/networks/crab.md index 7e8c51f0..57685031 100644 --- a/docs/builder/networks/crab.md +++ b/docs/builder/networks/crab.md @@ -5,7 +5,7 @@ title: Crab Crab Network is a canary network with real economic value for Darwinia, and its positioning is similar to Polkadot's Kusama Network. To expect chaos is a reasonable assumption! -## Network Info +## Network Info - Network Name: Crab - Token Name: CRAB @@ -37,6 +37,21 @@ Crab Network is a canary network with real economic value for Darwinia, and its - wss://darwinia-crab.api.onfinality.io/public-ws - wss://darwiniacrab-rpc.dwellir.com +## Other tokens + +| Token Symbol | Spec | Decimals | Smart Contract Address | +| --- | --- | --- | --- | +| CKTON | ERC20 | 18 | 0x0000000000000000000000000000000000000402 | +| WCRAB | ERC20 | 18 | 0x2d2b97ea380b0185e9fdf8271d1afb5d2bf18329 | +| xWRING | ERC20 | 18 | 0x273131F7CB50ac002BDd08cA721988731F7e1092 | + + +### Deprecated tokens +| Token Symbol | Spec | Decimals | Smart Contract Address | Why | +| --- | --- | --- | --- | --- | +| WCKTON(Classic) | ERC20 | 18 | 0x159933C635570D5042723359fbD1619dFe83D3f3 | migrated to CKTON | +| xRING(Classic) | ERC20 | 9 | 0x7399Ea6C9d35124d893B8d9808930e9d3F211501 | migrated to xWRING | + ## Params ### Block, Epoch and Era Time From f91a29265a03bc37477275cd78eab4cfdbd1df57 Mon Sep 17 00:00:00 2001 From: Aki Wu Date: Thu, 10 Nov 2022 14:02:47 +0800 Subject: [PATCH 04/15] update darwinia and crab chain info --- docs/builder/networks/crab.md | 6 +++--- docs/builder/networks/darwinia.md | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/builder/networks/crab.md b/docs/builder/networks/crab.md index 57685031..dccc3f40 100644 --- a/docs/builder/networks/crab.md +++ b/docs/builder/networks/crab.md @@ -5,6 +5,8 @@ title: Crab Crab Network is a canary network with real economic value for Darwinia, and its positioning is similar to Polkadot's Kusama Network. To expect chaos is a reasonable assumption! +Crab is now a parachain of [Kusama](https://kusama.subscan.io/parachain/2229). + ## Network Info - Network Name: Crab @@ -46,9 +48,7 @@ Crab Network is a canary network with real economic value for Darwinia, and its | xWRING | ERC20 | 18 | 0x273131F7CB50ac002BDd08cA721988731F7e1092 | -### Deprecated tokens -| Token Symbol | Spec | Decimals | Smart Contract Address | Why | -| --- | --- | --- | --- | --- | +### Deprecated tokens | Token Symbol | Spec | Decimals | Smart Contract Address | Why | | --- | --- | --- | --- | --- | | WCKTON(Classic) | ERC20 | 18 | 0x159933C635570D5042723359fbD1619dFe83D3f3 | migrated to CKTON | | xRING(Classic) | ERC20 | 9 | 0x7399Ea6C9d35124d893B8d9808930e9d3F211501 | migrated to xWRING | diff --git a/docs/builder/networks/darwinia.md b/docs/builder/networks/darwinia.md index 7fe085f7..d89f0591 100644 --- a/docs/builder/networks/darwinia.md +++ b/docs/builder/networks/darwinia.md @@ -3,7 +3,9 @@ sidebar_position: 0 title: Darwinia --- -Darwinia is a public chain based on substrate with cross-chain components, including substrate to ethereum and substrate to substrate. +Darwinia is a chain based on substrate with cross-chain components, including substrate to ethereum and substrate to substrate. + +Darwinia is now a parachain of [Polkadot](https://polkadot.subscan.io/parachain/2046). ## Network Info From 233a8c2484e76119905a0e3d2d18e347df28d66b Mon Sep 17 00:00:00 2001 From: Aki Wu Date: Thu, 10 Nov 2022 14:02:56 +0800 Subject: [PATCH 05/15] public endpoints --- docs/builder/public-endpoints.md | 35 +++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/docs/builder/public-endpoints.md b/docs/builder/public-endpoints.md index 2fc3e139..74d737e2 100644 --- a/docs/builder/public-endpoints.md +++ b/docs/builder/public-endpoints.md @@ -3,4 +3,37 @@ sidebar_position: 102 --- # Public Endpoints -tbd \ No newline at end of file + +## Darwinia + +- HTTP Endpoints: + - https://rpc.darwinia.network + - https://darwinia-rpc.dwellir.com +- WSS Endpoints: + - wss://rpc.darwinia.network + - wss://darwinia-rpc.dwellir.com + +## Crab + +- HTTP Endpoints: + - https://crab-rpc.darwinia.network + - https://darwinia-crab.api.onfinality.io/public + - https://darwiniacrab-rpc.dwellir.com +- WSS Endpoints: + - wss://crab-rpc.darwinia.network + - wss://darwinia-crab.api.onfinality.io/public-ws + - wss://darwiniacrab-rpc.dwellir.com + +## Pangoro + +- HTTP Endpoints: + - https://pangoro-rpc.darwinia.network +- WSS Endpoints: + - wss://pangoro-rpc.darwinia.network + +## Pangolin + +- HTTP Endpoints: + - https://pangolin-rpc.darwinia.network +- WSS Endpoints: + - wss://pangolin-rpc.darwinia.network From 77f99b67c1b8cf6adf6989219b68a7213b8ebc44 Mon Sep 17 00:00:00 2001 From: Aki Wu Date: Thu, 10 Nov 2022 14:11:59 +0800 Subject: [PATCH 06/15] explorers --- docs/builder/explorers.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/builder/explorers.md b/docs/builder/explorers.md index b893af12..7a5053a6 100644 --- a/docs/builder/explorers.md +++ b/docs/builder/explorers.md @@ -3,4 +3,17 @@ sidebar_position: 104 --- # Explorers -tbd \ No newline at end of file + +## Darwinia +- https://darwinia.subscan.io/ +- https://darwinia.subview.xyz/ + +## Crab +- https://crab.subscan.io/ +- https://crab.subview.xyz/ + +## Pangoro +- https://pangoro.subscan.io/ + +## Pangolin +- https://pangolin.subscan.io/ From 668eeff5e0ba9ece0e8638136de72a55c40c6f03 Mon Sep 17 00:00:00 2001 From: Aki Wu Date: Thu, 10 Nov 2022 14:25:48 +0800 Subject: [PATCH 07/15] precompiles --- docs/builder/solidity-precompiles.md | 92 +++++++++++++++++++++++++++- 1 file changed, 91 insertions(+), 1 deletion(-) diff --git a/docs/builder/solidity-precompiles.md b/docs/builder/solidity-precompiles.md index 986886c2..25418157 100644 --- a/docs/builder/solidity-precompiles.md +++ b/docs/builder/solidity-precompiles.md @@ -3,4 +3,94 @@ sidebar_position: 103 --- # Solidity Precompiles -tbd \ No newline at end of file + +## Darwinia + +Ethereum compatible: + +- `0x0000000000000000000000000000000000000001`: ECRecover +- `0x0000000000000000000000000000000000000002`: Sha256 +- `0x0000000000000000000000000000000000000003`: Ripemd160 +- `0x0000000000000000000000000000000000000004`: Identity +- `0x0000000000000000000000000000000000000005`: Modexp +- `0x0000000000000000000000000000000000000006`: Bn128Add +- `0x0000000000000000000000000000000000000007`: Bn128Mul +- `0x0000000000000000000000000000000000000008`: Bn128Pairing +- `0x0000000000000000000000000000000000000009`: Blake2F +- `0x0000000000000000000000000000000000000400`: StateStorage +- `0x0000000000000000000000000000000000000401`: Dispatch + +Darwinia dedicated: + +- `0x0000000000000000000000000000000000000400`: StateStorage + - This contract is used to get the storage values from substrate modules by storage key. + - Function signature: `state_storage(bytes)` + - Params: the substrate storage key +- `0x0000000000000000000000000000000000000401`: Dispatch + - This contract is used to dispatch the substrate dispatch calls. + - Function signature: `(bytes)` + - Params: scale encoded substrate dispatch call + +## Crab + +Ethereum compatible: + +- `0x0000000000000000000000000000000000000001`: ECRecover +- `0x0000000000000000000000000000000000000002`: Sha256 +- `0x0000000000000000000000000000000000000003`: Ripemd160 +- `0x0000000000000000000000000000000000000004`: Identity +- `0x0000000000000000000000000000000000000005`: Modexp +- `0x0000000000000000000000000000000000000006`: Bn128Add +- `0x0000000000000000000000000000000000000007`: Bn128Mul +- `0x0000000000000000000000000000000000000008`: Bn128Pairing +- `0x0000000000000000000000000000000000000009`: Blake2F + +Darwinia dedicated: + +- `0x0000000000000000000000000000000000000400`: StateStorage +- `0x0000000000000000000000000000000000000401`: Dispatch +- `0x0000000000000000000000000000000000000402`: KTON + - KTON contract which compatible with the Ethereum ERC20 protocol. + +## Pangoro + +Ethereum compatible: + +- `0x0000000000000000000000000000000000000001`: ECRecover +- `0x0000000000000000000000000000000000000002`: Sha256 +- `0x0000000000000000000000000000000000000003`: Ripemd160 +- `0x0000000000000000000000000000000000000004`: Identity +- `0x0000000000000000000000000000000000000005`: Modexp +- `0x0000000000000000000000000000000000000006`: Bn128Add +- `0x0000000000000000000000000000000000000007`: Bn128Mul +- `0x0000000000000000000000000000000000000008`: Bn128Pairing +- `0x0000000000000000000000000000000000000009`: Blake2F +- `0x0000000000000000000000000000000000000400`: StateStorage +- `0x0000000000000000000000000000000000000401`: Dispatch + +Darwinia dedicated: + +- `0x0000000000000000000000000000000000000400`: StateStorage +- `0x0000000000000000000000000000000000000401`: Dispatch +- `0x0000000000000000000000000000000000000800`: BLS12381 + - function signature: `fast_aggregate_verify(bytes[],bytes,bytes) + +## Pangolin + +Ethereum compatible: + +- `0x0000000000000000000000000000000000000001`: ECRecover +- `0x0000000000000000000000000000000000000002`: Sha256 +- `0x0000000000000000000000000000000000000003`: Ripemd160 +- `0x0000000000000000000000000000000000000004`: Identity +- `0x0000000000000000000000000000000000000005`: Modexp +- `0x0000000000000000000000000000000000000006`: Bn128Add +- `0x0000000000000000000000000000000000000007`: Bn128Mul +- `0x0000000000000000000000000000000000000008`: Bn128Pairing +- `0x0000000000000000000000000000000000000009`: Blake2F + +Darwinia dedicated: + +- `0x0000000000000000000000000000000000000400`: StateStorage +- `0x0000000000000000000000000000000000000401`: Dispatch +- `0x0000000000000000000000000000000000000402`: KTON From b4ef1afa6897e158860a7a0bf2b751f6da2b5ec7 Mon Sep 17 00:00:00 2001 From: Aki Wu Date: Thu, 10 Nov 2022 14:36:54 +0800 Subject: [PATCH 08/15] ethereum api --- docs/builder/ethereum-api.md | 135 +++++++++++++++++++++-------------- 1 file changed, 80 insertions(+), 55 deletions(-) diff --git a/docs/builder/ethereum-api.md b/docs/builder/ethereum-api.md index 7474f8c5..00f90a69 100644 --- a/docs/builder/ethereum-api.md +++ b/docs/builder/ethereum-api.md @@ -4,60 +4,85 @@ sidebar_position: 105 # Ethereum API -### Introduction +## Introduction + +DVM(Darwinia Virtual Machine) is fully compatible with EVM (Ethereum Virtual Machine) in Darwinia Network. + +You can use `web3.js` or other ethereum libs to interact with Darwinia using Ethereum compactible RPC api. + +## RPC List + +> Note: The currently implemented RPC apis is compatible with Ethereum, but some apis are not yet implemented. + +## Supported Interfaces + +- [x] debug_traceBlockByNumber +- [x] debug_traceByHash +- [x] debug_traceTransaction +- [x] eth_accounts +- [x] eth_blockNumber +- [x] eth_chainId +- [x] eth_coinbase +- [x] eth_call +- [x] eth_estimateGas +- [x] eth_feeHistory +- [x] eth_gasPrice +- [x] eth_getBlockByHash +- [x] eth_getBlockByNumber +- [x] eth_getTransactionCount +- [x] eth_getBlockTransactionCountByHash +- [x] eth_getBlockTransactionCountByNumber +- [x] eth_getCode +- [x] eth_getTransactionByBlockHashAndIndex +- [x] eth_getTransactionByHash +- [x] eth_getTransactionByBlockNumberAndIndex +- [x] eth_getTransactionReceipt +- [x] eth_getUncleByBlockHashAndIndex +- [x] eth_getUncleByBlockNumberAndIndex +- [x] eth_getUncleCountByBlockHash +- [x] eth_getUncleCountByBlockNumber +- [x] eth_getLogs +- [x] eth_getWork +- [x] eth_getBalance +- [x] eth_getFilterChanges +- [x] eth_getFilterLogs +- [x] eth_hashrate +- [x] eth_mining +- [x] eth_newFilter +- [x] eth_newBlockFilter +- [x] eth_newPendingTransactionFilter +- [x] eth_protocolVersion +- [x] eth_sendTransaction +- [x] eth_sendRawTransaction +- [x] eth_submitWork +- [x] eth_submitHashrate +- [x] eth_subscription +- [x] eth_syncing +- [x] eth_unsubscribe +- [x] eth_uninstallFilter +- [x] net_version +- [x] net_peerCount +- [x] net_listening +- [x] trace_filter +- [x] web3_clientVersion +- [x] web3_sha3 + +## Things Dapp developers must know + +### Use `block.timestamp` instead of `block.number` + +On Ethereum or other EVM-Compatible platform, you may use `block.number` in contract, but this is not recommended in CSC. We may introduce CSC 2.0 (The Next Generation of CSC) in the future and export the data from CSC 1.0 to CSC 2.0, which may reset the chain height to zero, so we recommend using `block.timestamp`. + +### Consensus Related Field + +Ethereum uses a consensus protocol named Proof-of-Work (PoW). While CSC uses the Nominated Proof of Stake(NPOS). They are two completely different consensus mechanisms. Consequently, Proof of Work concepts, such as `difficulty`, `uncles`, `hashrate`, generally is not applicable to CSC. For APIs that return value related to Ethereum’s Proof of Work, default value are returned. + +### Genesis Block + +It is particularly important to note that CSC's genesis block does not start at 0 like Ethereum. It is `4969901`. This means that if you try to query the block history before `4969901` with `eth_getBlockByNumber()` or `eth_getBlockByHash()`, you will get `null`. This is because the DVM smart contract solution was added in the middle of the Substrate-base Crab chain, there are no Ethereum transactions in the Substrate history blocks and no corresponding Ethereum history blocks generated. + +### Ethereum Block Author + +The author(miner) of the ethereum block you get from `eth_getBlockByNumber()` or `eth_getBlockByHash()` is the last 20 bytes of the actual substrate block author. It's because the ethereum block is built based on substrate block and who's author is a 32-bytes address. We have to truncate to adapt ethereum block needs. **Please do not tranfer to the ethereum block author, since the private key of this address is unknown.** -DVM(Darwinia Virtual Machine) is fully compatible with EVM (Ethereum Virtual Machine) in Darwinia Network. We have Crab and Pangolin chain for dapp developer to apply dapp. Darwinia.js also provide common api to interact with Darwinia DVM same as web3.js interact with ethereum. - - - - -Install it in your project directory with the following command: - -``` javascript -yarn add @darwinia/api-evm -``` - - -#### Balance Tranfer - -In this example we will introduce Crab Smart chain(EVM comatible) to Crab Chain balance tranfer. - -Here is an example to call DVM api to send transaction from ethereum address to substrate account. - - -``` javascript -// Import -import { ethers } from 'ethers'; -import { DarwiniaDvmApi } from '@darwinia/api-evm/index'; -import { CrabCallIndex } from '@darwinia/api-evm/model'; - -// Crab node provider -const providerRPC = { - carb: { - chainId: 44, - name: 'Crab', - rpc: 'https://crab-rpc.darwinia.network' - } - }; - - // ethereum address - const from = "
"; - // substrate address - const to = "
"; - - const gasLimit = 10000; - const amount = 1; // crab precision is 1000_000_000, 1 present 1/10*9 token - - const provider = new ethers.providers.JsonRpcProvider(providerRPC.carb.rpc, { - chainId: providerRPC.carb.chainId, - name: providerRPC.carb.name - }); - - const dvm = new DarwiniaDvmApi(CrabCallIndex, provider); - const resulte = await balanceTransfer(from, to, amount, gasLimit); - console.log(`transaction resulte ${resulte}`); - -``` - -Then return contains transcation hash and check more detail information at [Crab Subscan](https://crab.subscan.io/) \ No newline at end of file From e8915072e4a85a105b95ede9d42800319da50969 Mon Sep 17 00:00:00 2001 From: Aki Wu Date: Thu, 10 Nov 2022 15:13:03 +0800 Subject: [PATCH 09/15] fix crab doc --- docs/builder/networks/crab.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/builder/networks/crab.md b/docs/builder/networks/crab.md index dccc3f40..b0cee936 100644 --- a/docs/builder/networks/crab.md +++ b/docs/builder/networks/crab.md @@ -48,7 +48,10 @@ Crab is now a parachain of [Kusama](https://kusama.subscan.io/parachain/2229). | xWRING | ERC20 | 18 | 0x273131F7CB50ac002BDd08cA721988731F7e1092 | -### Deprecated tokens | Token Symbol | Spec | Decimals | Smart Contract Address | Why | | --- | --- | --- | --- | --- | +### Deprecated tokens + +| Token Symbol | Spec | Decimals | Smart Contract Address | Why | +| --- | --- | --- | --- | --- | | WCKTON(Classic) | ERC20 | 18 | 0x159933C635570D5042723359fbD1619dFe83D3f3 | migrated to CKTON | | xRING(Classic) | ERC20 | 9 | 0x7399Ea6C9d35124d893B8d9808930e9d3F211501 | migrated to xWRING | From d564cfc7a2f832ea1e2845713c511e957abe17a7 Mon Sep 17 00:00:00 2001 From: Aki Wu Date: Thu, 10 Nov 2022 15:13:16 +0800 Subject: [PATCH 10/15] fix cross-chain fee's link --- docs/relayer/cross-chain-fee.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/relayer/cross-chain-fee.md b/docs/relayer/cross-chain-fee.md index 637e259f..9aff29e9 100644 --- a/docs/relayer/cross-chain-fee.md +++ b/docs/relayer/cross-chain-fee.md @@ -20,7 +20,7 @@ The fees is payed with the source chain assets. The transaction fee of the targe Fees paid to the Treasury and relayers are not set in stone. Anyone can become a relayer of `Darwinia Cross-Chain Messaging Service`, and they quote through their respective quotation strategies, and the quotations of all relayers form a fee market. -Each time the cross-chain starts, the user's cross-chain fees will be prepaid, and after the cross-chain is successful, these fees will be allocated to the Treasury and relayers according to some rules. If you want to know more details of the rules, please check [this article](https://github.com/darwinia-network/darwinia-common/blob/main/frame/fee-market/README.md). +Each time the cross-chain starts, the user's cross-chain fees will be prepaid, and after the cross-chain is successful, these fees will be allocated to the Treasury and relayers according to some rules. If you want to know more details of the rules, please check [this article](https://medium.com/darwinianetwork/what-can-a-cross-chain-message-relayer-get-ffb683b689cb). ## Fee Estimation From 514eeaa13ad0005ba248018250462f6ba693b4ce Mon Sep 17 00:00:00 2001 From: Aki Wu Date: Thu, 10 Nov 2022 15:13:27 +0800 Subject: [PATCH 11/15] fee market --- docs/relayer/fee-market.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/relayer/fee-market.md b/docs/relayer/fee-market.md index 85a54afe..8ec80ad5 100644 --- a/docs/relayer/fee-market.md +++ b/docs/relayer/fee-market.md @@ -2,4 +2,10 @@ sidebar_position: 2 --- -# Fee Market \ No newline at end of file +# Fee Market + +Darwinia Fee Market System is a market-based cross-chain infrastructure that provides financial incentives for cross-chain message deliverers(relayers). Through the profitability mechanism, promoting relayers actively participate in and deliver messages efficiently, which will make the cross-chain transaction system more robust and sustainable. + +The calculation of fees for cross-chain messages usually requires the consideration of the token value exchange ratio between the source and target chains on the blockchain, which is what Oracle is used to do. Unlike Oracle, the fee market mechanism does not require the chain to be aware of the token value exchange ratio between the source and target chains in real time, but relies on the relayers‘ quotes to generate the final cross-chain fee. + +The relayer is the third off-chain role of the message carrier, responsible for delivering messages between the source and target chains. Before delivering a message, the relayer calculates its own costs and expected profits by combining the transaction fees of the source and target chains and finally submits its own quote to the fee market. When the fee market has received enough quotes, it selects a suitable quote as the cross-chain fee at that moment according to the pre-defined rules. From 8dd886a176b1bc5c283c17d4e8c86259a5415630 Mon Sep 17 00:00:00 2001 From: Aki Wu Date: Thu, 10 Nov 2022 15:13:35 +0800 Subject: [PATCH 12/15] relayer client --- docs/relayer/relayer-client.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/relayer/relayer-client.md b/docs/relayer/relayer-client.md index 0d8e00a4..7e1d9e9a 100644 --- a/docs/relayer/relayer-client.md +++ b/docs/relayer/relayer-client.md @@ -2,4 +2,9 @@ sidebar_position: 3 --- -# Relayer Client \ No newline at end of file +# Relayer Client + +The software used by relayers to relay states and messages from the source chain to the target chain. + +* [Bridger](https://github.com/darwinia-network/bridger) + From 0e922583740f342afd575e0f970e8455358e17dc Mon Sep 17 00:00:00 2001 From: Aki Wu Date: Thu, 10 Nov 2022 15:32:45 +0800 Subject: [PATCH 13/15] testnet faucets --- docs/builder/testnet-faucets.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 docs/builder/testnet-faucets.md diff --git a/docs/builder/testnet-faucets.md b/docs/builder/testnet-faucets.md new file mode 100644 index 00000000..1af48db0 --- /dev/null +++ b/docs/builder/testnet-faucets.md @@ -0,0 +1,8 @@ +--- +sidebar_position: 109 +--- + +# Testnet Faucets + +* [Pangoro ORING Faucet](https://apps.darwinia.network/toolbox?rpc=wss%253A%252F%252Fpangoro-rpc.darwinia.network&tab=faucet) +* [Pangolin PRING Faucet](https://apps.darwinia.network/toolbox?rpc=wss%253A%252F%252Fpangolin-rpc.darwinia.network&tab=faucet) From e7c06e5d96f727b3b807a7a6362daaeea617c3d7 Mon Sep 17 00:00:00 2001 From: Aki Wu Date: Thu, 10 Nov 2022 15:32:56 +0800 Subject: [PATCH 14/15] rm quick start --- docs/builder/quick-start.md | 42 ------------------------------------- 1 file changed, 42 deletions(-) delete mode 100644 docs/builder/quick-start.md diff --git a/docs/builder/quick-start.md b/docs/builder/quick-start.md deleted file mode 100644 index 03e1b211..00000000 --- a/docs/builder/quick-start.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -sidebar_position: 1 ---- - -# Quick Start -## Overview - -## Networks - -### Network Configurations - -## TestNet Faucet - -* [Pangoro ORING Faucet](https://apps.darwinia.network/?network=pangoro) -* [Pangolin PRING Faucet](https://apps.darwinia.network/?rpc=wss%253A%252F%252Fpangolin-rpc.darwinia.network) - -## Dev Tools - -#### EVM tools - -Darwinia is EVM-compatiable, so your can use almost all toolchains for EVM. Here are some of our picks: - -Wallets: - -- [MetaMask](https://metamask.io/) - -Libraries: - -* [web3.js](https://github.com/web3/web3.js) -* [ethers.js](https://github.com/ethers-io/ethers.js) - -Contract Libraries: - -* [OpenZeppelin](https://openzeppelin.com/) - -Dev Environment: - -* [Remix](https://remix.ethereum.org/) -* [Hardhat](https://hardhat.org/) - -## Conntect to Darwinia public node - From 37e6447f73e606b364b42e2827a4e0e39c111ff3 Mon Sep 17 00:00:00 2001 From: Aki Wu Date: Thu, 10 Nov 2022 15:33:21 +0800 Subject: [PATCH 15/15] add evm dev tools list --- docs/builder/ethereum-api.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/docs/builder/ethereum-api.md b/docs/builder/ethereum-api.md index 00f90a69..14ae92cf 100644 --- a/docs/builder/ethereum-api.md +++ b/docs/builder/ethereum-api.md @@ -8,7 +8,7 @@ sidebar_position: 105 DVM(Darwinia Virtual Machine) is fully compatible with EVM (Ethereum Virtual Machine) in Darwinia Network. -You can use `web3.js` or other ethereum libs to interact with Darwinia using Ethereum compactible RPC api. +You can use `web3.js` or other [ethereum tools](#dev-tools) to interact with Darwinia using Ethereum compactible RPC api. ## RPC List @@ -85,4 +85,24 @@ It is particularly important to note that CSC's genesis block does not start at The author(miner) of the ethereum block you get from `eth_getBlockByNumber()` or `eth_getBlockByHash()` is the last 20 bytes of the actual substrate block author. It's because the ethereum block is built based on substrate block and who's author is a 32-bytes address. We have to truncate to adapt ethereum block needs. **Please do not tranfer to the ethereum block author, since the private key of this address is unknown.** +## Dev Tools +Darwinia is EVM-compatiable, so your can use almost all toolchains for EVM. Here are some of our picks: + +Wallets: + +- [MetaMask](https://metamask.io/) + +Libraries: + +* [web3.js](https://github.com/web3/web3.js) +* [ethers.js](https://github.com/ethers-io/ethers.js) + +Contract Libraries: + +* [OpenZeppelin](https://openzeppelin.com/) + +Dev Environment: + +* [Remix](https://remix.ethereum.org/) +* [Hardhat](https://hardhat.org/)