2

I want to connect 2 nodes via custom chain specification via Internet IP public

I. STEP 1: Create Aura and grandpa

--- NODE 01----

  1. Create Aura-01:
    Secret phrase:       glory icon taste syrup such guard correct occur coyote frequent thing water
      Network ID:        substrate
      Secret seed:       0x070c94ef16c1a629ddf6b9d1416fa2665e7d5f01bd2113e61a78c53f6e5cda87
      Public key (hex):  0x0adf0e0405dbc259257c2eb6700d00849a94edf496872dbea5547d236a9aff00
      Account ID:        0x0adf0e0405dbc259257c2eb6700d00849a94edf496872dbea5547d236a9aff00
      Public key (SS58): 5CJxbavev61VDuLbyMErtE7PvjA8osHhDkv3gKttHsSZFMdJ
      SS58 Address:      5CJxbavev61VDuLbyMErtE7PvjA8osHhDkv3gKttHsSZFMdJ
  1. Create Grandpa-01
    Secret phrase:       glory icon taste syrup such guard correct occur coyote frequent thing water
      Network ID:        substrate
      Secret seed:       0x070c94ef16c1a629ddf6b9d1416fa2665e7d5f01bd2113e61a78c53f6e5cda87
      Public key (hex):  0x8e34ea1bd11bd532427f82daae6aa3a855fdc948136753905a74796a5b7146c8
      Account ID:        0x8e34ea1bd11bd532427f82daae6aa3a855fdc948136753905a74796a5b7146c8
      Public key (SS58): 5FHANk2EkM6sTeGnkZ2HaRCj356NVWg4DSJag4gsz6Jupazt
      SS58 Address:      5FHANk2EkM6sTeGnkZ2HaRCj356NVWg4DSJag4gsz6Jupazt

---NODE 02-------------------

  1. Create Aura-02:
    Secret phrase:       praise scout author learn bounce funny pulp caution young collect whip limb
      Network ID:        substrate
      Secret seed:       0x16df58dcb530ece94270a6154c7d8ad1b3d4aebe69ce55ed2cfe620f6e357a1d
      Public key (hex):  0x16134c09a7818a590ebc5f9b336c22fe3d23e88e6449edbb996116449430be01
      Account ID:        0x16134c09a7818a590ebc5f9b336c22fe3d23e88e6449edbb996116449430be01
      Public key (SS58): 5CZeeFRsRSUweVkqZR3hDTN9khk3U3oa4rjaFg2S96WPpRhd
      SS58 Address:      5CZeeFRsRSUweVkqZR3hDTN9khk3U3oa4rjaFg2S96WPpRhd
  1. Create Grandpa-02:
    Secret phrase:       praise scout author learn bounce funny pulp caution young collect whip limb
      Network ID:        substrate
      Secret seed:       0x16df58dcb530ece94270a6154c7d8ad1b3d4aebe69ce55ed2cfe620f6e357a1d
      Public key (hex):  0x3612c18b4ae0e6b7e5b5bd79b5353cc20af70ba1302fe638884114ee0b9a7452
      Account ID:        0x3612c18b4ae0e6b7e5b5bd79b5353cc20af70ba1302fe638884114ee0b9a7452
      Public key (SS58): 5DHc1oW2bBAfu46v5mxNu97iWohvEvsdT2TyaBirXuQzC18F
      SS58 Address:      5DHc1oW2bBAfu46v5mxNu97iWohvEvsdT2TyaBirXuQzC18F

II. STEP 2: Node 01 Export the local chain specification to a file named customSpec.json

    ./target/release/node-template build-spec --disable-default-bootnode --chain local > customSpec.json

III. STEP 3: Node-01 Add Aura and Grandpa both of node into customSpec.json

IV. Convert customSpec to RAW

    ./target/release/node-template build-spec --chain=customSpec.json --raw --disable-default-bootnode > customSpecRaw.json

V.Share customSpecRAW file to node-02

Link RAW file

VI.NODE-01 Run:

    ./target/release/node-template \
    --base-path /tmp/node01 \
    --chain ./customSpecRaw.json \
    --port 30333 \
    --ws-port 9945 \
    --rpc-port 9933 \
    --telemetry-url "wss://telemetry.polkadot.io/submit/ 0" \
    --validator \
    --rpc-methods Unsafe \
    --name MyNode01

VII.NODE-01 Add key to Keystore with password 123456

./target/release/node-template key insert --base-path /tmp/node01 \
--chain customSpecRaw.json \
--scheme Sr25519 \
--suri '0x070c94ef16c1a629ddf6b9d1416fa2665e7d5f01bd2113e61a78c53f6e5cda87' \
--password-interactive \
--key-type aura


./target/release/node-template key insert --base-path /tmp/node01 \
--chain customSpecRaw.json \
--scheme Ed25519 \
--suri '0x070c94ef16c1a629ddf6b9d1416fa2665e7d5f01bd2113e61a78c53f6e5cda87' \
--password-interactive \
--key-type gran

VIII. NODE-01 verify key

ls /tmp/node01/chains/local_testnet/keystore

IX.NODE-02 run:

./target/release/node-template \
--base-path /tmp/node02 \
--chain ./customSpecRaw.json \
--port 30334 \
--ws-port 9946 \
--rpc-port 9934 \
--telemetry-url "wss://telemetry.polkadot.io/submit/ 0" \
--validator \
--rpc-methods Unsafe \
--name MyNode02 \
--bootnodes /ip4/171.245.164.166/tcp/30333/p2p/12D3KooWBNTdqMcbcE3gqNWtvKWZWsFnHaehtMtbiq3kVeUk3JSE \
--password-interactive

X.NODE-02 Add key to keystore with password 123456

./target/release/node-template key insert --base-path /tmp/node02 \
--chain customSpecRaw.json \
--scheme Sr25519 \
--suri '0x16df58dcb530ece94270a6154c7d8ad1b3d4aebe69ce55ed2cfe620f6e357a1d' \
--password-interactive \
--key-type aura


./target/release/node-template key insert --base-path /tmp/node02 \
--chain customSpecRaw.json \
--scheme Ed25519 \
--suri '0x16df58dcb530ece94270a6154c7d8ad1b3d4aebe69ce55ed2cfe620f6e357a1d' \
--password-interactive \
--key-type gran

XI. NODE-02 verify key store

ls /tmp/node02/chains/local_testnet/keystore

Result is both nodes can peer without producing and finalizing blocks. enter image description here

Also same problem with 3 nodes. Can anyone help me this issue? Thank you.

2

4 Answers 4

1

Steps in configuring local_testnet (private network)

  1. Create bootnode keys:
# botnode aura
$ subkey generate --scheme sr25519
Secret phrase:       tackle memory pepper lake seed afford since state power label brick copy
  Network ID:        substrate
  Secret seed:       0x81d794359885bb885c357dbf1bf75aff0f6744d532340d9418557ee43c8642ee
  Public key (hex):  0x34edf846c91511ca2b33d201a82b4a801b177feb6583dd56b8b589226441b272
  Account ID:        0x34edf846c91511ca2b33d201a82b4a801b177feb6583dd56b8b589226441b272
  Public key (SS58): 5DG73DMGcRCdJD55tnMuzAfb9MkwKsgpW5ft7DBpnUxpW3Wg
  SS58 Address:      5DG73DMGcRCdJD55tnMuzAfb9MkwKsgpW5ft7DBpnUxpW3Wg

# botnode gran
$ subkey inspect --scheme ed25519 "tackle memory pepper lake seed afford since state power label brick copy"
Secret phrase:       tackle memory pepper lake seed afford since state power label brick copy
  Network ID:        substrate
  Secret seed:       0x81d794359885bb885c357dbf1bf75aff0f6744d532340d9418557ee43c8642ee
  Public key (hex):  0x468d07453610d714e22a33c03b3004dc3b8efb146ec1f2200ae8d68102f0ffe7
  Account ID:        0x468d07453610d714e22a33c03b3004dc3b8efb146ec1f2200ae8d68102f0ffe7
  Public key (SS58): 5DfD6wftdWs3VqsajyEZMZjsBLk9jTZV5PfihZ3GFCe8YCu7
  SS58 Address:      5DfD6wftdWs3VqsajyEZMZjsBLk9jTZV5PfihZ3GFCe8YCu7
  1. Create node2 keys:
# node2 aura
$ subkey generate --scheme sr25519
Secret phrase:       clump distance vast head photo mass run mosquito chicken wash tattoo escape
  Network ID:        substrate
  Secret seed:       0xca425677c85da882ecec057b47af3ab282253b9d27ed35f9835bc2b794c3d348
  Public key (hex):  0xd4aa883727fb3c36507dbba6b45fed749c3d2abbf7411b52461445b0a3403e15
  Account ID:        0xd4aa883727fb3c36507dbba6b45fed749c3d2abbf7411b52461445b0a3403e15
  Public key (SS58): 5GsYff9q6wdjt2hXcWyt6W9K7mctwDWpT8QJguMj2svuvnU9
  SS58 Address:      5GsYff9q6wdjt2hXcWyt6W9K7mctwDWpT8QJguMj2svuvnU9

# node2 gran
$ subkey inspect --scheme ed25519 "clump distance vast head photo mass run mosquito chicken wash tattoo escape"
Secret phrase:       clump distance vast head photo mass run mosquito chicken wash tattoo escape
  Network ID:        substrate
  Secret seed:       0xca425677c85da882ecec057b47af3ab282253b9d27ed35f9835bc2b794c3d348
  Public key (hex):  0xa6c1df110420b87d24aa56d9887c6e8a346f8bf9016e685d6f1c8d7cb8085cf1
  Account ID:        0xa6c1df110420b87d24aa56d9887c6e8a346f8bf9016e685d6f1c8d7cb8085cf1
  Public key (SS58): 5FqMQ2bbE3uFmrbiAz4J3Cr3QdEq8NL48BgkVQZYbxFhnf5k
  SS58 Address:      5FqMQ2bbE3uFmrbiAz4J3Cr3QdEq8NL48BgkVQZYbxFhnf5k
  1. Authorized the aura and gran addresses for both nodes in the CustomSpec.json file.
#...
      "aura": {
        "authorities": [
          "5DG73DMGcRCdJD55tnMuzAfb9MkwKsgpW5ft7DBpnUxpW3Wg",
          "5GsYff9q6wdjt2hXcWyt6W9K7mctwDWpT8QJguMj2svuvnU9"
        ]
      },
      "grandpa": {
        "authorities": [
          [
            "5DfD6wftdWs3VqsajyEZMZjsBLk9jTZV5PfihZ3GFCe8YCu7",
            1
          ],
          [
            "5FqMQ2bbE3uFmrbiAz4J3Cr3QdEq8NL48BgkVQZYbxFhnf5k",
            1
          ]
        ]
      },
      "balances": {
        "balances": [
          [
            "5DG73DMGcRCdJD55tnMuzAfb9MkwKsgpW5ft7DBpnUxpW3Wg",
            100000000000000000000000
          ]
        ]
      },
      "transactionPayment": null,
      "sudo": {
        "key": "5DG73DMGcRCdJD55tnMuzAfb9MkwKsgpW5ft7DBpnUxpW3Wg"
      }
#...
  1. Create a bootnode (node01) shell script command:
# run-bootnode.sh
./target/release/node-template \
--base-path /tmp/node01 \
--chain ./customSpecRaw.json \
--port 30333 \
--ws-port 9944 \
--rpc-port 9933 \
--telemetry-url "wss://telemetry.polkadot.io/submit/ 0" \
--validator \
--rpc-cors all \
--ws-external \
--rpc-external \
--rpc-methods Unsafe \
--name MyNode01
  1. Create a node2 (node02) shell script command (the node id of the bootnode may change from time to time, please take note of that carefully):
# run-node2.sh
./target/release/node-template \
--base-path /tmp/node02 \
--chain ./customSpecRaw.json \
--port 30334 \
--ws-port 9945 \
--rpc-port 9934 \
--telemetry-url "wss://telemetry.polkadot.io/submit/ 0" \
--validator \
--rpc-cors all \
--ws-external \
--rpc-external \
--rpc-methods Unsafe \
--name MyNode02 \
--bootnodes /ip4/127.0.0.1/tcp/30333/p2p/12D3KooWAk2PkrAqmEaqGtGc8ieUARYWmTyJkimpndd1F1f3ZJWZ \
  1. Purge all db and keystore. Take note that if you restart your computer, your keystore also will be deleted.
$ ./target/release/node-template purge-chain --base-path /tmp/node01 
$ rm -rf /tmp/node01/chains/local_testnet/keystore
$ ./target/release/node-template purge-chain --base-path /tmp/node02
$ rm -rf /tmp/node02/chains/local_testnet/keystore
  1. Now run the two nodes i different terminal.
$ ./run-bootnode.sh
$ ./run-node2.sh
  1. Register the keys of the bootnode. bootnode/aura bootnode/gran

  2. Register the keys of node2. Make sure your polkadotJS is really connected to node2, if not this will not work. node2/aura node2/grand

  3. Check the keystore for each node

$ ls /tmp/node01/chains/local_testnet/keystore
617572611c98e60ea5fb1dfd0f72996afd2e35294ac4f33dfd4937489c43c65222e06347
6772616ea77e7345133bd15486b7745bade1eed84d8bde1abfc5ea7199411a1fc865786e

$ ls //tmp/node02/chains/local_testnet/keystore
61757261540f2298562a57b3348968793b2e6a5d623232a7d353356d621456f49ebe8902
6772616ea8b2e3955493c2d2608ce6013da726b15982710f1b045fff97e07fe0e3f753b4
  1. Re-run the node. Thats it.
1
  • i have tried ur approach, but still i can see only peer logs but, not the new blocks producing and finalizing, can you please let me know, if u have any resolution for this?
    – Mojo
    Commented Oct 11, 2023 at 14:03
1

I found the problem is substrate. Substrate version v9.20 has problem, so can not peer-id or product block or finalize block.

After I upgrade to v9.24, this issuse was gone.

enter image description here

0

Grandpa works with atleast 3 nodes because its using voting system to finalize blocks

3
  • It would help to add reference to the docs for this for people to learn :)
    – Nuke
    Commented Jun 25, 2022 at 3:16
  • I run 3 nodes, still same errors
    – oscar
    Commented Jun 29, 2022 at 8:00
  • Grandpa requires a 2f+1 non-faulty node (i.e., a two-thirds majority) to finalise blocks. So it depends on how many grandpa authorities you have configured & what is their weightage, it can't be absolute 3 nodes. More info here: docs.substrate.io/fundamentals/consensus/…
    – Toufeeq
    Commented Oct 20, 2022 at 4:22
0

Do not use "key insert". It does not work! Go to polkadot.js and use RPC Calls/Authors/Insert Keys.

Make sure to connect to the appropriate node while inserting their keys.

Make sure to purge also, you might have inserted invalid keys in there.

12
  • I try to purge then use RPC Calls/Authors/Insert Keys. -Keytype:Text = aura -suri: Text = glory icon taste syrup such guard correct occur coyote frequent thing water -publicKey = 0x0adf0e0405dbc259257c2eb6700d00849a94edf496872dbea5547d236a9aff00 (publicKey is publicKey hex, right?) -Keytype:Text = gran -suri: Text = glory icon taste syrup such guard correct occur coyote frequent thing water -publicKey = 0x8e34ea1bd11bd532427f82daae6aa3a855fdc948136753905a74796a5b7146c8 still same issue.
    – oscar
    Commented Jun 29, 2022 at 8:09
  • When I restart node-1 then have new error. GRANDPA voter error: could not sign outgoing message: Failed to sign GRANDPA vote for round 1 targetting 0x9b4ee454930c1cf0f52d592136a35c8c20ee15caa177b06f8e8502423fe5d004 2022-06-29 14:47:02 Essential task grandpa-voter failed. Shutting down service. Error: Service(Other("Essential task failed."))
    – oscar
    Commented Jun 29, 2022 at 8:11
  • A. 1. You must have two nodes to be able to run aura-gran consensus, 2. generate aura: subkey generate --scheme sr25519, generate gran: subkey inspect --scheme ed25519 <use-same-mnemonics-in-aura>, 3. Make sure that when you encode the keys you use the correct public hex for aura and gran
    – hgminerva
    Commented Jun 29, 2022 at 15:00
  • B. 1. For the second node, make sure to connect to the second node before your provide the aura and gran keys, 2. Follow the process of letter A.
    – hgminerva
    Commented Jun 29, 2022 at 15:02
  • You can check /tmp/node01/local_testnet/keystore for node01, after you put the keys.
    – hgminerva
    Commented Jun 29, 2022 at 15:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.