微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

不使用默认密钥的基板节点模板私有网络

如何解决不使用默认密钥的基板节点模板私有网络

我正在尝试构建一个 5 节点网络(Aura 和 GRANPA 的所有验证者和成员),我的目标是使用自定义密钥,而不是预定义的 Alice 等。因此添加了 SR和自定义规范 JSON 文件中的 ED 权限密钥。节点模板版本是来自 Github 的未更改的 V3。

我按照教程 (https://substrate.dev/docs/en/tutorials/start-a-private-network/customchain) 进行操作,但出现此错误


2021-07-26 09:17:35 Substrate Node
2021-07-26 09:17:35 ✌️ version 3.0.0-unkNown-x86_64-linux-gnu
2021-07-26 09:17:35 ❤️ by Substrate DevHub <https://github.com/substrate-developer-hub>,2017-2021
2021-07-26 09:17:35 ? Chain specification: The Batman Chain
2021-07-26 09:17:35 ? Node name: Node1
2021-07-26 09:17:35 ? Role: AUTHORITY
2021-07-26 09:17:35 ? Database: RocksDb at /peer-data-1/chains/TBC_testnet/db
2021-07-26 09:17:35 ⛓ Native runtime: node-template-100 (node-template-1.tx1.au1)
2021-07-26 09:17:36 ? Initializing Genesis block/state (state: 0x531c…653b,header-hash: 0x4c1f…570d)
2021-07-26 09:17:36 ? Loading GRANDPA authority set from genesis on what appears to be first startup.
2021-07-26 09:17:36 ⏱ Loaded block-time = 6000 milliseconds from genesis on first-launch
2021-07-26 09:17:36 Using default protocol ID "sup" because none is configured in the chain specs
2021-07-26 09:17:36 ? Local node identity is: 12D3KooWRzP2WuCbHENdXkf5ZvBStmgYn2N8mkwPofQparf58tkF
2021-07-26 09:17:36 ? Highest kNown block at #0
2021-07-26 09:17:36 〽️ Prometheus server started at 0.0.0.0:9615
2021-07-26 09:17:36 Listening for new connections on 0.0.0.0:9944.
2021-07-26 09:17:37 ? discovered new external address for our node: /ip4/10.42.0.82/tcp/30333/p2p/12D3KooWRzP2WuCbHENdXkf5ZvBStmgYn2N8mkwPofQparf58tkF
2021-07-26 09:17:37 GRANDPA Voter error: Signing("Failed to sign GRANDPA Vote for round 1 targetting 0x4c1f6404ff3236cbd58fa62dffe9b8e2b2ac670f06516541a641158c0a0a570d")
2021-07-26 09:17:37 Essential task `grandpa-Voter` Failed. Shutting down service.
Error: Service(Other("Essential task Failed."))

要启动节点,我使用以下命令:

node-template key insert \
    --base-path /peer-data-1 \
    --chain local \
    --key-type aura \
    --suri "0x0e32f2687f1234deb25e20a50c39db5cdf0a2f2ccb84995189522fc9f20beb37";

node-template key insert \
    --base-path /peer-data-1 \
    --chain local \
    --key-type gran \
    --suri "0x0e32f2687f1234deb25e20a50c39db5cdf0a2f2ccb84995189522fc9f20beb37";
ls -l /peer-data-1/chains/local_testnet/keystore;

RUST_LOG=runtime=debug
node-template \
    --base-path /peer-data-1 \
    --name Node1 \
    --node-key 0x0e32f2687f1234deb25e20a50c39db5cdf0a2f2ccb84995189522fc9f20beb37 \
    --chain /genesis/customSpecRaw.json \
    --keystore-path /peer-data-1/chains/local_testnet/keystore/ \
    --port 30333 \
    --ws-port 9944 \
    --rpc-port 9933 \
    --unsafe-ws-external \
    --unsafe-rpc-external \
    --rpc-cors=all \
    --prometheus-external \
    --log info \
    --wasm-execution Compiled \
    --ws-max-connections 1000 \
    --pool-limit 10000 \
    --pool-kbytes 20480 \
    --max-runtime-instances 100 \
    --validator \
    --bootnodes /ip4/$SUBSTRATE_0_SERVICE_HOST/tcp/30333/p2p/12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp

自定义规范 JSON 文件是:

{
 "...": "...","palletAura": {
        "authorities": [
          "5HVmrhNjMCfqRmjfcWTeEhgLMm1mgG9wAeQtKv1jZsUXrJjR","5ChaeMbZEqvCYkh6ZZudYEPdwqApTCQzhbUPyX6Hxs5VX6yd","5DB3vFrmvn49dpwzczYtFqxbfgn5U7DV8AHkkWFBcp3tWxwG","5GT9aamoicKpUNRkWzQs83kLzufWZGt7aHX8ZWaAxKLmBdCW","5CeaUtvsDQJHmuS1PJPns9kNuYEYCZdJE4ze8tdXSzgZkd4a"
        ]
      },"palletGrandpa": {
        "authorities": [
          [
            "5DvLRumQ8R9uSqV5xPmdsFBwQfjZCHzh6ebT5wqmARVRo9XE",1
          ],[
            "5CvYJbuiAyeGiBiPUtDp1Y5u3547f5AVai6qSXQBanR1j9m9",[
            "5DPmV9GaQke2jUb7DmtRaf7fmrEX4aWSwzPzUsPtUNZUnYhU",[
            "5FvcixYnySyxCEpv5QRQ9vj3h6QUH3ogpnXjGc4x4NahSXhH",[
            "5CCuMSKoa13eeyKShzsNyGKMk5iicgnQn19zach8D2yznWgz",1
          ]
        ]
      },"...": "...",}

解决方法

自己找到了答案。

  • 我颠倒了光环和爷爷权威 ID。确保AURA 使用 Sr25519 ss58 地址爷爷使用 Ed25519 ss58 地址
  • 启动节点的代码有误,我添加了 --scheme Ed25519/Sr25519 以确保密钥库中添加的密钥正确。
node-template key insert \
    --base-path /peer-data-1 \
    --chain local \
    --key-type aura \
    --scheme Sr25519 \
    --suri "0x0e32f2687f1234deb25e20a50c39db5cdf0a2f2ccb84995189522fc9f20beb37";
node-template key insert \
    --base-path /peer-data-1 \
    --chain local \
    --key-type gran \
    --scheme Ed25519 \
    --suri "0x0e32f2687f1234deb25e20a50c39db5cdf0a2f2ccb84995189522fc9f20beb37";
ls -l /peer-data-1/chains/local_testnet/keystore;
RUST_LOG=runtime=debug
node-template \
    --base-path /peer-data-1 \
    --name Node1 \
    --chain /genesis/customSpecRaw.json \
    --keystore-path /peer-data-1/chains/local_testnet/keystore/ \
    --node-key 0x0e32f2687f1234deb25e20a50c39db5cdf0a2f2ccb84995189522fc9f20beb37 \
    --port 30333 \
    --ws-port 9944 \
    --rpc-port 9933 \
    --unsafe-ws-external \
    --unsafe-rpc-external \
    --rpc-cors=all \
    --prometheus-external \
    --log info \
    --wasm-execution Compiled \
    --ws-max-connections 1000 \
    --pool-limit 10000 \
    --pool-kbytes 20480 \
    --max-runtime-instances 100 \
    --validator \
    --bootnodes /ip4/$SUBSTRATE_0_SERVICE_HOST/tcp/30333/p2p/12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。