0

I've been trying to implement a PoW consensus for my node. It was based on node template, the recipe and Kulupu's implementation of PoW. So I did quite a lot of changes to the node template and thus I'm unable to fully explain all of them in this post for you to get more details. But one important thing to mention is that I do not use Aura or GRANDPA in the node. So no finality of the blocks.
After a successful build of the node I ran it with cargo run -r -- --dev and saw that no blocks are produced:

Running `target/release/node-template --dev`
2022-05-27 19:23:49 Substrate Node    
2022-05-27 19:23:49 ✌️  version 4.0.0-dev-475e060-x86_64-linux-gnu    
2022-05-27 19:23:49 ❤️  by Substrate DevHub <https://github.com/substrate-developer-hub>, 2017-2022    
2022-05-27 19:23:49 📋 Chain specification: Development    
2022-05-27 19:23:49 🏷  Node name: abhorrent-army-7617    
2022-05-27 19:23:49 👤 Role: AUTHORITY    
2022-05-27 19:23:49 💾 Database: RocksDb at /tmp/substrateMmNJR7/chains/dev/db/full    
2022-05-27 19:23:49 ⛓  Native runtime: node-template-100 (node-template-1.tx1.au1)    
2022-05-27 19:23:50 🔨 Initializing Genesis block/state (state: 0x3c8f…1081, header-hash: 0x3b45…00e8)    
2022-05-27 19:23:50 Using default protocol ID "sup" because none is configured in the chain specs    
2022-05-27 19:23:50 🏷  Local node identity is: 12D3KooWF47RZJUama9TabHbtq8dv6q2Xr15AvWvSQ97uzi6qNSp    
2022-05-27 19:23:50 📦 Highest known block at #0    
2022-05-27 19:23:50 〽️ Prometheus exporter started at 127.0.0.1:9615    
2022-05-27 19:23:50 Listening for new connections on 127.0.0.1:9944.    
2022-05-27 19:23:50 The node is configured for mining, but no author key is provided.    
2022-05-27 19:23:50 Generated a mining key with address: A9oqjNLkQ4L2SHQAbAmwGKAr1nEewCiM6nVtrrVSEebpa26    
2022-05-27 19:23:50 You can go to "/tmp/substrateMmNJR7/chains/dev/keystore" to find the seed phrase of the mining key.    
2022-05-27 19:23:55 💤 Idle (0 peers), best: #0 (0x3b45…00e8), finalized #0 (0x3b45…00e8), ⬇ 0 ⬆ 0    
2022-05-27 19:24:00 💤 Idle (0 peers), best: #0 (0x3b45…00e8), finalized #0 (0x3b45…00e8), ⬇ 0 ⬆ 0    
2022-05-27 19:24:00 🙌 Starting consensus session on top of parent 0x3b45c3480168e05b5eb37268ff0de05d3558d22978c72918e48eab86ca6600e8    
2022-05-27 19:24:00 🎁 Prepared block for proposing at 1 (3 ms) [hash: 0xb05921caf1a325d79417083c265ff46e64b7c2f02b2d3d2cc7b4bed52dc00236; parent_hash: 0x3b45…00e8; extrinsics (1): [0x22d7…efe3]]    
2022-05-27 19:24:05 💤 Idle (0 peers), best: #0 (0x3b45…00e8), finalized #0 (0x3b45…00e8), ⬇ 0 ⬆ 0    
2022-05-27 19:24:10 💤 Idle (0 peers), best: #0 (0x3b45…00e8), finalized #0 (0x3b45…00e8), ⬇ 0 ⬆ 0    
2022-05-27 19:24:15 💤 Idle (0 peers), best: #0 (0x3b45…00e8), finalized #0 (0x3b45…00e8), ⬇ 0 ⬆ 0    
2022-05-27 19:24:20 💤 Idle (0 peers), best: #0 (0x3b45…00e8), finalized #0 (0x3b45…00e8), ⬇ 0 ⬆ 0    
2022-05-27 19:24:25 💤 Idle (0 peers), best: #0 (0x3b45…00e8), finalized #0 (0x3b45…00e8), ⬇ 0 ⬆ 0

For comparison here is an output of an unchanged node template:

     Running `target/release/node-template --dev`
2022-05-27 19:54:17 Substrate Node    
2022-05-27 19:54:17 ✌️  version 4.0.0-dev-596285a-x86_64-linux-gnu    
2022-05-27 19:54:17 ❤️  by Substrate DevHub <https://github.com/substrate-developer-hub>, 2017-2022    
2022-05-27 19:54:17 📋 Chain specification: Development    
2022-05-27 19:54:17 🏷  Node name: shrill-angle-1096    
2022-05-27 19:54:17 👤 Role: AUTHORITY    
2022-05-27 19:54:17 💾 Database: RocksDb at /tmp/substrate2stTwU/chains/dev/db/full    
2022-05-27 19:54:17 ⛓  Native runtime: node-template-100 (node-template-1.tx1.au1)    
2022-05-27 19:54:18 🔨 Initializing Genesis block/state (state: 0x3175…351a, header-hash: 0xc066…5faa)    
2022-05-27 19:54:18 👴 Loading GRANDPA authority set from genesis on what appears to be first startup.    
2022-05-27 19:54:19 Using default protocol ID "sup" because none is configured in the chain specs    
2022-05-27 19:54:19 🏷  Local node identity is: 12D3KooWRTwHVqzU79bmYe3iU8xdBZvT5s1rmB27tYU8A7R4fyFB    
2022-05-27 19:54:19 📦 Highest known block at #0    
2022-05-27 19:54:19 〽️ Prometheus exporter started at 127.0.0.1:9615    
2022-05-27 19:54:19 Listening for new connections on 127.0.0.1:9944.    
2022-05-27 19:54:24 🙌 Starting consensus session on top of parent 0xc066a81dfd21fe12f9de736d82a3be0bb07f2d8bdbab3194d640c8cf90b65faa    
2022-05-27 19:54:24 🎁 Prepared block for proposing at 1 (2 ms) [hash: 0x9bdc3457f4eff54374f48ee81fa1f8cb517d316d839aeed89f644d33848a3081; parent_hash: 0xc066…5faa; extrinsics (1): [0xaee5…4dfb]]    
2022-05-27 19:54:24 🔖 Pre-sealed block for proposal at 1. Hash now 0x7d733a0dd007003fd6f47e8a21cb9a3ae75f78193fc950765094f40b0eba78ee, previously 0x9bdc3457f4eff54374f48ee81fa1f8cb517d316d839aeed89f644d33848a3081.    
2022-05-27 19:54:24 ✨ Imported #1 (0x7d73…78ee)    
2022-05-27 19:54:24 💤 Idle (0 peers), best: #1 (0x7d73…78ee), finalized #0 (0xc066…5faa), ⬇ 0 ⬆ 0    
2022-05-27 19:54:29 💤 Idle (0 peers), best: #1 (0x7d73…78ee), finalized #0 (0xc066…5faa), ⬇ 0 ⬆ 0    
2022-05-27 19:54:30 🙌 Starting consensus session on top of parent 0x7d733a0dd007003fd6f47e8a21cb9a3ae75f78193fc950765094f40b0eba78ee    
2022-05-27 19:54:30 🎁 Prepared block for proposing at 2 (0 ms) [hash: 0x2d3bcdcbca3e532335a4432ad0b09a8ac43b013c3ff1c7b21cf3a4c2828f4093; parent_hash: 0x7d73…78ee; extrinsics (1): [0x2b98…1eba]]    
2022-05-27 19:54:30 🔖 Pre-sealed block for proposal at 2. Hash now 0x0b8c6f146d82aad9a91fc9ddba2ca3564b64e19de6af71ff6fc28ce403bbd192, previously 0x2d3bcdcbca3e532335a4432ad0b09a8ac43b013c3ff1c7b21cf3a4c2828f4093.    
2022-05-27 19:54:30 ✨ Imported #2 (0x0b8c…d192)    
2022-05-27 19:54:34 💤 Idle (0 peers), best: #2 (0x0b8c…d192), finalized #0 (0xc066…5faa), ⬇ 0 ⬆ 0    
2022-05-27 19:54:36 🙌 Starting consensus session on top of parent 0x0b8c6f146d82aad9a91fc9ddba2ca3564b64e19de6af71ff6fc28ce403bbd192    
2022-05-27 19:54:36 🎁 Prepared block for proposing at 3 (0 ms) [hash: 0x58f1c1353be2dbc743c4f815578a3bfde111f9a183b16e988cb6fc6fab7f0cf3; parent_hash: 0x0b8c…d192; extrinsics (1): [0xc94c…4b2b]]    
2022-05-27 19:54:36 🔖 Pre-sealed block for proposal at 3. Hash now 0x11f06abace5630ccfd2f021644f2ea23e8503783b7d2ccce5356e5920f9dec2f, previously 0x58f1c1353be2dbc743c4f815578a3bfde111f9a183b16e988cb6fc6fab7f0cf3.    
2022-05-27 19:54:36 ✨ Imported #3 (0x11f0…ec2f)    
2022-05-27 19:54:39 💤 Idle (0 peers), best: #3 (0x11f0…ec2f), finalized #1 (0x7d73…78ee), ⬇ 0 ⬆ 0 

The differences I see are:

  • No GRANDPA loaded. Which is fine because I deleted it.
  • No Imported blocks in the first case
  • No Pre-sealed blocks in the first case
  • Number of best blocks does not grow in the first case

The question is:
What might be the problem? Please note, that I do not ask for a complete solution, just an advise on what I should take a look at first.

I suppose that it's something wrong about the consensus block configuration in my chain_spec.rs file. Again, I used a combination of chain specs from Josh Orndorff`s recipe, node template and Kulupu

2
  • Have you tried adding peers and sending transactions?
    – Burak
    May 28, 2022 at 17:43
  • No, I did not. If I'm not mistaken, a single PoW node should be able to produce blocks because a --force-authoring key was passed.
    – CREESTL
    May 29, 2022 at 8:33

0

Your Answer

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