substrate 入门操作

install

To get going as fast as possible, there is a simple script that installs all required dependencies and installs Substrate into your path. Just open a terminal and run:

curl https://getsubstrate.io -sSf | bash

You can start a local Substrate development chain with running substrate --dev

Specify the chain specification (one of dev, local or staging)

To create your own global network/cryptocurrency, make a chainspec file
First let’s get a template chainspec that you can edit. We’ll use the “staging” chain, a sort of default chain that the node comes pre-configured with:

substrate --chain=dev build-spec > ~/chainspec.json

Error: Execution: Instantiation: Export ext_storage_changes_root has different signature Signature { params: [I64, I32], return_type: Some(I32) }

rm -rf ~/.local/share/Substrate/
or
substrate --dev purge-chain

Building from source

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
brew install cmake pkg-config openssl git llvm
git clone https://github.com/paritytech/substrate.git
cd substrate
./scripts/build.sh # Builds the WebAssembly binaries
cargo build # Builds all native code

You can run the tests if you like:

cargo test --all

You can start a development chain with:

cargo run -- --dev

// Detailed log
RUST_LOG=debug RUST_BACKTRACE=1 cargo run —- --dev