I'm trying to implement Layer 2 to Substrate. Substrate node runs BABE and GRANDPA to produce blocks and finalize.

Layer 2 comes built into the Substrate (planning to develop this way). It will have a faster slot-based block production and maybe finalization as well.

I'm thinking of having 2 consensus algorithms in parallel built into the Substrate node. Let's say that layer 2 produces 6 blocks for every block time for the Substrate node and sends the block proofs via runtime-api (or rpc).

Visual explination

I've hacked the Substrate to achieve this. First, added AURA to the node that has BABE. I separated the tasks so block production and finalization wouldn't affect different consensus algorithms. I didn't count for Prometheus. It compiled ok but got this error

Failed to register proposer prometheus metrics: Duplicate metrics collector registration attempted. Essential task basic-block-import-worker failed. Shutting down service.

I haven't dug more after this. I'm questioning the possibility of this at this point.

  • Should there be 2 separate runtimes? Or is the node's runtime enough?
  • How would block finalization be done?
  • 1
    Sounds interesting, not an expert, but I think a layer-2 should have its own runtime and then just update the block_hash at regular intervals to layer-1. Anything more complicated than this you are just re-building a relaychain-parachain model. Also iiuc parachains can become their own relaychains in future.
    – 1x2454
    Apr 20, 2022 at 11:27
  • I think you're right. Doing this in a single runtime could have bottlenecks. What I need and it's not possible atm is having a 2nd order Relay chain under the Kusama/Polkadot Relay chain. I've decided to go with 2 blockchains. Layer 1 will have room for layer 2 blockchains. Let's see where I'll end up
    – Burak
    Apr 20, 2022 at 18:04
  • I am also working on hybrid consensus. please let me know do u achieve your goal Jun 9 at 10:53


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.

Browse other questions tagged or ask your own question.