Skip to content

Turkijan083/blockchain-node

Repository files navigation

Cere Blockchain Node

Build

Rust Setup

First, complete the basic Rust setup instructions.

Build Environment Setup

./scripts/init.sh

Build

Use the following command to build the node without launching it:

cargo +nightly-2023-05-23 build --release

Run

Single-Node Development Chain

This command will start the single-node development chain with non-persistent state:

./target/release/cere --dev

Purge the development chain's state:

./target/release/cere purge-chain --dev

Start the development chain with detailed logging:

RUST_BACKTRACE=1 ./target/release/cere -ldebug --dev

Development chain means that the state of our chain will be in a tmp folder while the nodes are running. Also, alice account will be authority and sudo account as declared in the genesis state. At the same time the following accounts will be pre-funded:

  • Alice
  • Bob
  • Alice//stash
  • Bob//stash

In case of being interested in maintaining the chain' state between runs a base path must be added so the db can be stored in the provided folder instead of a temporal one. We could use this folder to store different chain databases, as a different folder will be created per different chain that is ran. The following commands shows how to use a newly created folder as our db base path.

// Create a folder to use as the db base path
$ mkdir my-chain-state

// Use of that folder to store the chain state
$ ./target/release/cere --dev --base-path ./my-chain-state/

// Check the folder structure created inside the base path after running the chain
$ ls ./my-chain-state
chains
$ ls ./my-chain-state/chains/
dev
$ ls ./my-chain-state/chains/dev
db keystore network

Local Testnet Development Chain

Purge the Alice's node state:

./target/release/cere purge-chain --base-path /tmp/alice --chain local -y

Start Alice's node:

./target/release/cere \
  --base-path /tmp/alice \
  --chain local \
  --alice \
  --port 30333 \
  --ws-port 9945 \
  --rpc-port 9933 \
  --rpc-cors "http://localhost:*","http:127.0.0.1:*","https://localhost:*","https:127.0.0.1:*","https://explorer.cere.network","https://polkadot.js.org" \
  --node-key 0000000000000000000000000000000000000000000000000000000000000001 \
  --validator

Purge the Bob's node state:

./target/release/cere purge-chain --base-path /tmp/bob --chain local -y

Start Bob's node:

./target/release/cere \
  --base-path /tmp/bob \
  --chain local \
  --bob \
  --port 30334 \
  --ws-port 9946 \
  --rpc-port 9934 \
  --rpc-cors "http://localhost:*","http:127.0.0.1:*","https://localhost:*","https:127.0.0.1:*","https://explorer.cere.network","https://polkadot.js.org" \
  --validator \
  --bootnodes /ip4/127.0.0.1/tcp/30333/p2p/12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp

Development chain means that the state of our chain will be in a tmp folder while the nodes are running. Also, alice and bob accounts will be authority accounts and alice sudo account as declared in the genesis state. At the same time the following accounts will be pre-funded:

  • Alice
  • Bob
  • Alice//stash
  • Bob//stash

Zombienet

Zombienet is a cli tool to easily spawn ephemeral networks and perform tests against them. Its installation and usage guide is available here.

The following scenarios expect the node binary available at ./target/release/cere.

Test block building

Spawn 2 nodes network and test if it produces blocks and finalized transaction.

zombienet -p native test zombienet/0000-block-building/block-building.zndsl

Spawn 5 DDC validation nodes

The following command spawns 5 validator nodes with DDC validation enabled as well as 1 non-validator node to check it is not affected. Set DAC_URL environment variable with an address to webdis which will proxy validator's requests for DDC activity data to DAC DataModel Redis.

export DAC_URL=http://localhost:7379/
zombienet -p native test zombienet/0001-ddc-validation/ddc-validation.toml

Runtimes

The node supports 2 runtimes.

Runtime cere

Runtime cere uses by default in Cere Mainnet/Testnet/QAnet. You can start the node with it by:

  1. Running the node connected to Cere Mainnet, Cere Testnet or Cere QAnet
  2. Running the node with a custom spec. Be sure that id does not start with cere_dev
    ./target/release/cere --chain=./target/release/customSpecRaw.json

Runtime cere-dev

Runtime cere-dev uses by default in Cere Devnet. You can start the node with it by:

  1. Running the node connected to Cere Devnet
  2. Running the Single-Node Development Chain
  3. Running the Local Testnet Development Chain
  4. Running the node with a custom spec. Be sure that id starts with cere_dev and you pass --force-cere-dev parameter
    ./target/release/cere --chain=./target/release/customSpecRaw.json --force-cere-dev

Connect to Cere Networks

Mainnet

./target/release/cere --chain=cere-mainnet

Testnet

./target/release/cere --chain=cere-testnet

QAnet

./target/release/cere --chain=cere-qanet

Devnet

./target/release/cere --chain=cere-devnet

Connect with Cere Explorer Front-end

Once the node is running locally, you can connect it with Cere Explorer front-end to interact with your chain. Click here connecting the Explorer to your local node.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages