Skip to content

Commit

Permalink
Update development node tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
boundless-forest committed Jun 12, 2024
1 parent b7657dc commit 9da0476
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 62 deletions.
148 changes: 94 additions & 54 deletions docs/build/getting-started/networks/dev-node.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Run Development Testnet

While there is an established test network, namely the [Pangolin network](./pangolin.md), which serves as an ideal sandbox for your applications, eliminating any concern about initiating and connecting nodes, among other things. The official test network is designed to fulfill application developers' requirements. However, there may be scenarios where you want to perform low-level tasks. In such cases, creating your own development network can significantly enhance your development, testing, or debugging efficiency. This guide will walk you through the process of establishing a single-node development network.
While there is an established test network, namely the [Koi network](./koi.md), which serves as an ideal sandbox for your applications, eliminating any concern about initiating and connecting nodes, among other things. The official test network is designed to fulfill application developers' requirements. However, there may be scenarios where you want to perform low-level tasks. In such cases, creating your own development network can significantly enhance your development, testing, or debugging efficiency. This guide will walk you through the process of establishing a single-node development network.

## Compile darwinia node

Expand All @@ -15,85 +15,125 @@ While there is an established test network, namely the [Pangolin network](./pang

```bash
cd darwinia
cargo build --release -p darwinia --features pangolin-native
cargo build --release -p darwinia --features koi-native
```

4. When the compilation is finished, something like this will be printed:

```bash
Compiling kusama-runtime v0.9.43 (https://github.com/paritytech/polkadot?branch=release-v0.9.43#ba42b9ce)
Compiling rococo-runtime v0.9.43 (https://github.com/paritytech/polkadot?branch=release-v0.9.43#ba42b9ce)
Compiling polkadot-runtime v0.9.43 (https://github.com/paritytech/polkadot?branch=release-v0.9.43#ba42b9ce)
Compiling darwinia-runtime v6.3.4 (/home/bear/coding/rust-space/darwinia/runtime/darwinia)
Compiling crab-runtime v6.3.4 (/home/bear/coding/rust-space/darwinia/runtime/crab)
Compiling pangolin-runtime v6.3.4 (/home/bear/coding/rust-space/darwinia/runtime/pangolin)
Compiling darwinia v6.3.4 (/home/bear/coding/rust-space/darwinia/node)
Compiling polkadot-client v0.9.43 (https://github.com/paritytech/polkadot?branch=release-v0.9.43#ba42b9ce)
Compiling polkadot-service v0.9.43 (https://github.com/paritytech/polkadot?branch=release-v0.9.43#ba42b9ce)
Compiling polkadot-cli v0.9.43 (https://github.com/paritytech/polkadot?branch=release-v0.9.43#ba42b9ce)
Compiling cumulus-relay-chain-inprocess-interface v0.1.0 (https://github.com/paritytech/cumulusbranch=polkadot-v9.43#b8999fce)
Compiling cumulus-client-service v0.1.0 (https://github.com/paritytech/cumulus?branch=polkadot-v0.9.43#b8999fce)
Finished release [optimized] target(s) in 5m 57s
......
Compiling polkadot-node-core-backing v1.0.0 (https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251c)
Compiling polkadot-gossip-support v1.0.0 (https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251c)
Compiling polkadot-node-core-dispute-coordinator v1.0.0 (https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251c)
Compiling polkadot-statement-distribution v1.0.0 (https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251c)
Compiling polkadot-availability-distribution v1.0.0 (https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251c)
Compiling polkadot-node-core-prospective-parachains v1.0.0 (https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251c)
Compiling polkadot-node-core-bitfield-signing v1.0.0 (https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251c)
Compiling polkadot-node-core-av-store v1.0.0 (https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251c)
Compiling polkadot-approval-distribution v1.0.0 (https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251c)
Compiling polkadot-availability-bitfield-distribution v1.0.0 (https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251c)
Compiling polkadot-node-core-pvf-checker v1.0.0 (https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251c)
Compiling polkadot-node-core-chain-selection v1.0.0 (https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251c)
Compiling polkadot-node-core-approval-voting v1.0.0 (https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251c)
Compiling polkadot-node-core-parachains-inherent v1.0.0 (https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251c)
Compiling polkadot-node-core-chain-api v1.0.0 (https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251c)
Compiling fc-db v2.0.0-dev (https://github.com/darwinia-network/frontier?branch=polkadot-v1.1.0-patch#a562b665)
Compiling fc-mapping-sync v2.0.0-dev (https://github.com/darwinia-network/frontier?branch=polkadot-v1.1.0-patch#a562b665)
Compiling cumulus-client-consensus-common v0.1.0 (https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251c)
Compiling cumulus-pallet-aura-ext v0.1.0 (https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251c)
Compiling cumulus-client-network v0.1.0 (https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251c)
Compiling try-runtime-cli v0.10.0-dev (https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251c)
Compiling sc-storage-monitor v0.1.0 (https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251c)
Compiling cumulus-client-collator v0.1.0 (https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251c)
Compiling fc-rpc v2.0.0-dev (https://github.com/darwinia-network/frontier?branch=polkadot-v1.1.0-patch#a562b665)
Compiling cumulus-relay-chain-rpc-interface v0.1.0 (https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251c)
Compiling cumulus-relay-chain-minimal-node v0.1.0 (https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251c)
Compiling cumulus-client-consensus-proposer v0.1.0 (https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251c)
Compiling cumulus-client-cli v0.1.0 (https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251c)
Compiling cumulus-client-consensus-aura v0.1.0 (https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251c)
Compiling moonbeam-rpc-debug v0.1.0 (https://github.com/darwinia-network/moonbeam?branch=polkadot-v1.1.0#078eff3e)
Compiling moonbeam-rpc-trace v0.6.0 (https://github.com/darwinia-network/moonbeam?branch=polkadot-v1.1.0#078eff3e)
Compiling polkadot-service v1.0.0 (https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251c)
Compiling cumulus-relay-chain-inprocess-interface v0.1.0 (https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251c)
Compiling cumulus-client-service v0.1.0 (https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251c)
Finished release [optimized] target(s) in 16m 12s
```


## Start the development node

After your node compiles, you are ready to start exploring what it does using the darwinia development node.

To start the local Substrate node:
To start the local darwinia koi testnet node:

1. In the same terminal where you compiled your node, you can now start the node in development mode by running the following command:

```bash
./target/release/darwinia --chain pangolin-dev --alice --tmp --rpc-external --rpc-cors all
./target/release/darwinia --chain koi-dev --alice --tmp --rpc-external --rpc-cors all
```

The darwinia command-line options specify how you want the running node to operate. In this case, the `--dev` option specifies that the node runs in development mode using the predefined `development` chain specification. By default, this option also deletes all active data—such as keys, the blockchain database, and networking information when you stop the node by pressing Control-c. Using the `--dev` option ensures that you have a clean working state any time you stop and restart the node.
The darwinia command-line options specify how you want the running node to operate. In this case, the `--dev` option specifies that the node runs in development mode using the predefined `development` chain specification. By default, this option also deletes all active data—such as keys, the blockchain database, and networking information when you stop the node by pressing `Ctrl-c`. Using the `--dev` option ensures that you have a clean working state any time you stop and restart the node.

2. Verify your node is up and running successfully by reviewing the output displayed in the terminal. The terminal should display output similar to this:

```bash
2023-07-19 17:28:48 Darwinia
2023-07-19 17:28:48 ✌️ version 6.3.4-93d2e8acc04
2023-07-19 17:28:48 ❤️ by Darwinia Network <hello@darwinia.network>, 2018-2023
2023-07-19 17:28:48 📋 Chain specification: Pangolin2 Development
2023-07-19 17:28:48 🏷 Node name: Alice
2023-07-19 17:28:48 👤 Role: AUTHORITY
2023-07-19 17:28:48 💾 Database: RocksDb at /tmp/substrate2cWt4x/chains/pangolin2-development/db/full
2023-07-19 17:28:48 ⛓ Native runtime: Pangolin2-6340 (DarwiniaOfficialRust-0.tx0.au0)
2023-07-19 17:28:49 [pallet::staking] assembling new collators for new session 0 at #0
2023-07-19 17:28:49 [pallet::staking] assembling new collators for new session 1 at #0
2023-07-19 17:28:49 Parachain id: Id(2105)
2023-07-19 17:28:49 Parachain Account: 5Ec4AhNxga1JYLioRBNxfRnovheDELVbZTRSnKMgvSVPvNcN
2023-07-19 17:28:49 Parachain genesis state: 0x0000000000000000000000000000000000000000000000000000000000000000002c5871dbc5c80fec32f7372f029e271039a29c91b5ad4b0d286277de0daa05b203170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c11131400
2023-07-19 17:28:49 Is collating: yes
2023-07-19 17:28:49 [pallet::staking] assembling new collators for new session 0 at #0
2023-07-19 17:28:49 [pallet::staking] assembling new collators for new session 1 at #0
2023-07-19 17:28:50 🔨 Initializing Genesis block/state (state: 0xb1f3…1cda, header-hash: 0x040e…561a)
2023-07-19 17:28:51 🏷 Local node identity is: 12D3KooWPPLzbofiQNjSiW6CmzPmQQkaWGvUuLXjHeDc5BiwgwXE
2023-07-19 17:28:51 💻 Operating system: linux
2023-07-19 17:28:51 💻 CPU architecture: x86_64
2023-07-19 17:28:51 💻 Target environment: gnu
2023-07-19 17:28:51 💻 CPU: AMD Ryzen 7 5700G with Radeon Graphics
2023-07-19 17:28:51 💻 CPU cores: 8
2023-07-19 17:28:51 💻 Memory: 63586MB
2023-07-19 17:28:51 💻 Kernel: 5.19.0-46-generic
2023-07-19 17:28:51 💻 Linux distribution: Ubuntu 22.04.1 LTS
2023-07-19 17:28:51 💻 Virtual machine: no
2023-07-19 17:28:51 📦 Highest known block at #0
2023-07-19 17:28:51 〽️ Prometheus exporter started at 127.0.0.1:9615
2023-07-19 17:28:51 Running JSON-RPC server: addr=127.0.0.1:9944, allowed origins=["http://localhost:*", "http://127.0.0.1:*", "https://localhost:*", "https://127.0.0.1:*", "https://polkadot.js.org"]
2023-07-19 17:28:56 💤 Idle (0 peers), best: #0 (0x040e…561a), finalized #0 (0x040e…561a), ⬇ 0 ⬆ 0
2024-06-12 11:39:11 Darwinia
2024-06-12 11:39:11 ✌️ version 6.6.3-2dadcd456ab
2024-06-12 11:39:11 ❤️ by Darwinia Network <hello@darwinia.network>, 2018-2024
2024-06-12 11:39:11 📋 Chain specification: Darwinia Koi D
2024-06-12 11:39:11 🏷 Node name: Alice
2024-06-12 11:39:11 👤 Role: AUTHORITY
2024-06-12 11:39:11 💾 Database: RocksDb at /tmp/substrategTTTOz/chains/darwinia-koi-d/db/full
2024-06-12 11:39:12 Parachain id: Id(2105)
2024-06-12 11:39:12 Parachain Account: 5Ec4AhNxga1JYLioRBNxfRnovheDELVbZTRSnKMgvSVPvNcN
2024-06-12 11:39:12 Is collating: yes
2024-06-12 11:39:12 [pallet::staking] assembling new collators for new session 0 at #0
2024-06-12 11:39:12 [pallet::staking] assembling new collators for new session 1 at #0
2024-06-12 11:39:13 🔨 Initializing Genesis block/state (state: 0xed27…e560, header-hash: 0x1411…ebf9)
2024-06-12 11:39:14 🏷 Local node identity is: 12D3KooWJMkgwqQuq71NepWoZBsjk3EpZAxHeDdyhUF99zu86rVH
2024-06-12 11:39:14 💻 Operating system: linux
2024-06-12 11:39:14 💻 CPU architecture: x86_64
2024-06-12 11:39:14 💻 Target environment: gnu
2024-06-12 11:39:14 💻 CPU: AMD Ryzen 7 5700G with Radeon Graphics
2024-06-12 11:39:14 💻 CPU cores: 8
2024-06-12 11:39:14 💻 Memory: 63578MB
2024-06-12 11:39:14 💻 Kernel: 6.5.0-35-generic
2024-06-12 11:39:14 💻 Linux distribution: Ubuntu 22.04.4 LTS
2024-06-12 11:39:14 💻 Virtual machine: no
2024-06-12 11:39:14 📦 Highest known block at #0
2024-06-12 11:39:14 〽️ Prometheus exporter started at 127.0.0.1:9615
2024-06-12 11:39:14 Running JSON-RPC server: addr=0.0.0.0:9944, allowed origins=["*"]
2024-06-12 11:39:19 💤 Idle (0 peers), best: #0 (0x1411…ebf9), finalized #0 (0x1411…ebf9), ⬇ 0 ⬆ 0
2024-06-12 11:39:24 🙌 Starting consensus session on top of parent 0x14110d2746620059805fd18a6047003fcedf6c3f85642c968f7b398536abebf9
2024-06-12 11:39:24 🎁 Prepared block for proposing at 1 (0 ms) [hash: 0x7d3ce7da0e2850bc1cbba208f4c408ff5ed4732e3bb363409af5ba73df202cff; parent_hash: 0x1411…ebf9; extrinsics (2): [0xeb54…e7f6, 0x2934…47d2]
2024-06-12 11:39:24 🔖 Pre-sealed block for proposal at 1. Hash now 0x8d4eca909342cac95a7d4e4fc40eae0de9a3b781706838aa67a91ee5eb17c4e4, previously 0x7d3ce7da0e2850bc1cbba208f4c408ff5ed4732e3bb363409af5ba73df202cff.
2024-06-12 11:39:24 ✨ Imported #1 (0x8d4e…c4e4)
2024-06-12 11:39:24 💤 Idle (0 peers), best: #1 (0x8d4e…c4e4), finalized #1 (0x8d4e…c4e4), ⬇ 0 ⬆ 0
2024-06-12 11:39:29 💤 Idle (0 peers), best: #1 (0x8d4e…c4e4), finalized #1 (0x8d4e…c4e4), ⬇ 0 ⬆ 0
2024-06-12 11:39:34 💤 Idle (0 peers), best: #1 (0x8d4e…c4e4), finalized #1 (0x8d4e…c4e4), ⬇ 0 ⬆ 0
2024-06-12 11:39:36 🙌 Starting consensus session on top of parent 0x8d4eca909342cac95a7d4e4fc40eae0de9a3b781706838aa67a91ee5eb17c4e4
2024-06-12 11:39:36 🎁 Prepared block for proposing at 2 (0 ms) [hash: 0x65b1fd87b1ba6aa247a232f9f240eba0b44f27b8b61689e60ab6fd7bdbfae65b; parent_hash: 0x8d4e…c4e4; extrinsics (2): [0x2611…0617, 0xe585…ad8d]
2024-06-12 11:39:36 🔖 Pre-sealed block for proposal at 2. Hash now 0xa87b9c78352ce2e0f4ba2f2e10043b10b7cc49070ee6274199793b0c465263ae, previously 0x65b1fd87b1ba6aa247a232f9f240eba0b44f27b8b61689e60ab6fd7bdbfae65b.
2024-06-12 11:39:36 ✨ Imported #2 (0xa87b…63ae)
....
```

If the number after `finalized` is increasing, your blockchain is producing new blocks and reaching consensus about the state they describe.

3. Keep the terminal that displays the node output open to continue.
3. Keep the terminal displaying the node's output open to continue. You can use the `curl` command to check the block number and verify that the node is functioning correctly.
## Connected to the Polkadot App
```bash
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' -H "Content-Type: application/json" http://localhost:9944 | jq
```
Once the node is up and producing new blocks, you can connect to the Polkadot app to explore more advanced features, such as token transfer and more.
The output:
```json
{
"jsonrpc": "2.0",
"result": "0x1a",
"id": 1
}
```
![evm-tutorial-dev-node-1](../../../images/evm-tutorial-dev-node-1.png)
![evm-tutorial-dev-node-2](../../../images/evm-tutorial-dev-node-2.png)
Once the node is up and producing new blocks, you can connect to node to explore more advanced features, such as token transfer and contract development.
2 changes: 1 addition & 1 deletion docs/build/getting-started/networks/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ The Darwinia ecosystem consists of four official long-term networks:
| :-------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------: |
| **[Darwinia](./darwinia.md)** | EVM-compatible blockchain using the Substrate framework, featuring cross-chain capabilities. |
| **[Crab](./crab.md)** | Canary network for Darwinia, similar to Kusama for Polkadot, designed to expect and handle chaos. |
| **[Pangolin](./pangolin.md)** | Primary test network for Darwinia, maintained to rigorously test new features before mainnet deployment. |
| **[Koi](./koi.md)** | Primary test network for Darwinia, maintained to rigorously test new features before mainnet deployment. |
| **[Rollup](./rollup.md)** | Partnership with AltLayer to develop an advanced Ethereum Op Stack rollup testnet, supported by Avail DA, showcasing cutting-edge blockchain data services. |
2 changes: 1 addition & 1 deletion docs/build/getting-started/networks/pangolin.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Pangolin Chain

!!! warning
The Pangolin network, which was previously the official test network for the Darwinia Network, has been replaced by the [Koi chain](../networks/koi.md). Therefore, please refer to the network information and business guidance of the Koi chain for further information.
The Pangolin chain, which was previously the official test network for the Darwinia Network, has been replaced by the [Koi chain](../networks/koi.md). Therefore, please refer to the network information and business guidance of the Koi chain for further information.
Loading

0 comments on commit 9da0476

Please sign in to comment.