Polkadot github项目地址:https://github.com/paritytech/polkadot
- build
git checkout <latest tagged release>
./scripts/init.sh
cargo build --release
# 编译完后check version
./target/release/polkadot --version
- 生成私链配置
./target/release/polkadot build-spec --chain=polkadot-local > local.json
- 将local.json中的properties修改成DOT对应的参数
{
"ss58Format": 0,
"tokenDecimals": 12,
"tokenSymbol": "DOT"
}
- 生成raw.json
./target/release/polkadot build-spec --chain=./local.json --raw > localRaw.json
- 启动私链
#alice
./target/release/polkadot --chain=./localRaw.json --base-path alice --alice --validator --port 30334
#bob,对应的nodeID可以从alice启动后的日志中得知
./target/release/polkadot --chain=./localRaw.json --base-path bob --bob --port 20222 --bootnodes /ip4/127.0.0.1/tcp/30334/p2p/12D3KooWPesXqtyQKxALywSs4hvBihr3CRy8QmTssAjXSprbGo9E --validator
#charlie 此节点可开通ws端口以供外部访问
./target/release/polkadot --chain=./localRaw.json --base-path charlie --charlie --rpc-cors all --pruning archive --port 30335 --bootnodes /ip4/127.0.0.1/tcp/30334/p2p/12D3KooWPesXqtyQKxALywSs4hvBihr3CRy8QmTssAjXSprbGo9E --ws-external --ws-port 9966
- 重置链
./target/release/polkadot purge-chain --base-path alice --chain=./localRaw.json
./target/release/polkadot purge-chain --base-path bob --chain=./localRaw.json
./target/release/polkadot purge-chain --base-path charlie --chain=./localRaw.json
- tokeDecimals修改
可直接编辑localRaw.json,将tokeDecimals改成10,再启动链,即可实现DOT百倍拆分