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百倍拆分