For Unix-based operating systems, you should run the following commands:
curl https://sh.rustup.rs -sSf | sh
rustup update nightly
rustup target add wasm32-unknown-unknown --toolchain nightly
rustup update stable
cargo install --git https://github.com/alexcrichton/wasm-gc
You will also need to install the following packages:
-
Linux:
sudo apt install cmake pkg-config libssl-dev git clang libclang-dev
-
Mac:
brew install cmake pkg-config openssl git llvm
To finish installation of Stafi-blockchain, jump down to shared steps.
Then, grab the source code:
git clone git@github.com:cennznet/stafi-blockchain.git
cd stafi-blockchain
Then build the code:
./scripts/build.sh # Builds the WebAssembly binaries
cargo build # Builds all native code
You can run all the tests if you like:
cargo test --all
Or just run the tests of a specific package (i.e. cargo test -p srml-assets
)
You can start a development chain with:
cargo run --dev
Detailed logs may be shown by running the node with the following environment variables set: RUST_LOG=debug RUST_BACKTRACE=1 cargo run --dev
.
If you want to see the multi-node consensus algorithm in action locally, then you can create a local testnet with two validator nodes for Alice and Bob, who are the initial authorities of the genesis chain specification that have been endowed with a testnet DOTs. We’ll give each node a name and expose them so they are listed on Telemetry . You’ll need two terminals windows open.
We’ll start Alice’s node first on default TCP port 30333 with her chain database stored locally at /tmp/alice
. The Bootnode ID of her node is QmQZ8TjTqeDj3ciwr93EJ95hxfDsb9pEYDizUAbWpigtQN
, which is generated from the --node-key
value that we specify below:
cargo run --release \
--base-path /tmp/alice \
--chain=local \
--alice \
--node-key 0000000000000000000000000000000000000000000000000000000000000001 \
--telemetry-url ws://telemetry.polkadot.io:1024 \
--validator
In the second terminal, we’ll run the following to start Bob’s node on a different TCP port of 30334, and with his chain database stored locally at /tmp/bob
. We’ll specify a value for the --bootnodes
option that will connect his node to Alice’s Bootnode ID on TCP port 30333:
cargo run --release \
--base-path /tmp/bob \
--bootnodes /ip4/127.0.0.1/tcp/30333/p2p/QmQZ8TjTqeDj3ciwr93EJ95hxfDsb9pEYDizUAbWpigtQN \
--chain=local \
--bob \
--port 30334 \
--telemetry-url ws://telemetry.polkadot.io:1024 \
--validator
Additional CLI usage options are available and may be shown by running cargo run --help
.