Skip to content

totem-tech/totem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Totem Live Accounting Main Code Repository

Content

This repository contains:

  • The Totem pallets,
  • The Kapex — Totem Parachain — node and runtime,
  • The Wapex — Totem Testnet Parachain to be run on Westend — node and runtime,
  • The Lego — Totem test parachain to be run in local mode — node and runtime,
  • The Pre-MainNet — node and runtime,
  • The Dockerfile to build the nodes.

Documentation

Embedded Nodes Docs

Once the project has been built, the following command can be used to explore all parameters and subcommands:

./target/release/[parachain-totem-kapex-node | parachain-totem-wapex-node | parachain-totem-lego-node | totem-mainnet-node] -h

The Totem Docs

Run

Test

Use Rust's native cargo command to build and launch the KAPEX node:

cargo run --release -p parachain-totem-kapex-node -- --dev --tmp

Use Rust's native cargo command to build and launch the WAPEX node:

cargo run --release -p parachain-totem-Wapex-node -- --dev --tmp

Use Rust's native cargo command to build and launch the Lego node:

cargo run --release -p parachain-totem-lego-node -- --dev --tmp

Use Rust's native cargo command to build and launch the blockchain node:

cargo run --release -p totem-mainnet-node -- --dev --tmp

Single-Node Development Chain

This command will start the single-node development chain with persistent state (replace <node> with either parachain-totem-kapex-node, parachain-totem-Wapex-node, parachain-totem-lego-node or totem-mainnet-node):

./target/release/<node> --dev
# Or with compilation
cargo run --release -p <node> -- --dev

Purge the development chain's state:

./target/release/<node> purge-chain --dev
# Or with compilation
cargo run --release -p <node> -- purge-chain --dev

Start the development chain with detailed logging:

RUST_LOG=debug RUST_BACKTRACE=1 ./target/release/<node> -lruntime=debug --dev
# Or with compilation
RUST_LOG=debug RUST_BACKTRACE=1 cargo run --release -p <node> -- -lruntime=debug --dev

Connect with Polkadot-JS Apps Front-end

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

Multi-Node Local Testnet

If you want to see the multi-node consensus algorithm in action, refer to our Start a Private Network tutorial.

Docker

The dockerfile is conveniently placed here. It can build an image for either node using the following commands:

# Totem Lego Test Parachain

docker build \
--build-arg chain=parachain-totem-lego-node \
--build-arg buildtype=build -t yourtag:yourversion .

# Totem KAPEX Parachain

docker build \
--build-arg chain=parachain-totem-kapex-node \
--build-arg buildtype=build -t yourtag:yourversion .

# Totem Pre-MainNet 

docker build \
--build-arg chain=totem-mainnet-node \
--build-arg buildtype=build -t yourtag:yourversion .

Execution of Docker image

You can use the standard substrate commands to run your node. The following is an example of running an image based on the lego test parachain tagged yourtag:yourversion and executing in dev mode with automatic purging of the chain data using --tmp and automatic removal of container after it is completed using docker run --rm.

docker run --rm yourtag:yourversion parachain-totem-lego-node -- --dev --tmp

Structure

A Substrate project such as this consists of a number of components that are spread across a few directories.

Node

A blockchain node is an application that allows users to participate in a blockchain network. Substrate-based blockchain nodes expose a number of capabilities:

  • Networking: Substrate nodes use the libp2p networking stack to allow the nodes in the network to communicate with one another.
  • Consensus: Blockchains must have a way to come to consensus on the state of the network. Substrate makes it possible to supply custom consensus engines and also ships with several consensus mechanisms that have been built on top of Web3 Foundation research.
  • RPC Server: A remote procedure call (RPC) server is used to interact with Substrate nodes.

There are several files in the node directory - take special note of the following:

  • chain_spec.rs: A chain specification is a source code file that defines a Substrate chain's initial (genesis) state. Chain specifications are useful for development and testing, and critical when architecting the launch of a production chain. Take note of the development_config and testnet_genesis functions, which are used to define the genesis state for the local development chain configuration. These functions identify some well-known accounts and use them to configure the blockchain's initial state.
  • service.rs: This file defines the node implementation. Take note of the libraries that this file imports and the names of the functions it invokes. In particular, there are references to consensus-related topics, such as the longest chain rule, the Aura block authoring mechanism and the GRANDPA finality gadget.

About

Totem Parachain and MainNet Repository

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages