polkadot local testnet 波卡私链搭建以及DOT拆分模拟

Polkadot github项目地址:https://github.com/paritytech/polkadot

  1. build
git checkout <latest tagged release>
./scripts/init.sh
cargo build --release

# 编译完后check version
./target/release/polkadot --version
  1. 生成私链配置
./target/release/polkadot  build-spec --chain=polkadot-local > local.json
  1. 将local.json中的properties修改成DOT对应的参数
{
  "ss58Format": 0,
  "tokenDecimals": 12,
  "tokenSymbol": "DOT"
}
  1. 生成raw.json
./target/release/polkadot build-spec --chain=./local.json --raw > localRaw.json
  1. 启动私链
#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
  1. 重置链
./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
  1. tokeDecimals修改
    可直接编辑localRaw.json,将tokeDecimals改成10,再启动链,即可实现DOT百倍拆分
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。