I'm playing around with a variation a of Substrate's PoW block production. Contrary to existing PoW engine my design relies on a PoW generation mechanism which is external to Substrate.

The PoW results are obtained by a HTTP listener and the liveness is backed up by a secondary mechanism which involves a set of trusted nodes that produce dummy blocks based on timeouts.

I need to store certain information on chain whenever a "real" PoW block is imported.

First I tried to submit an inherent transaction with the relevant data, but I realized that the inherent transaction is not gossiped even if it is verified by implementing ValidateUnsigned. This possibly refers to Is it possible to gossip inherents?

The next possible solution was to use Pre-Runtime Digests like so:

  • inject the relevant data into the Seal
  • modify the source code of start_mining_worker loop in such a way that the data from the DigestItem::Seal from the imported block is pushed into inherent_digest as a DigestItem::PreRuntime
  • inherent_digest is inserted into the proposal - no change here
  • the DigestItem::PreRuntime is accessible from the Runtime (contrary to DigestItem::Seal)

This approach seems to work, at least I can see that the information is shared, but I'm uncertain it does not break things, like e.g. fork rules etc.

I also tried a more relaxed approach by fetching a pre-runtime digest and submitting an offchain extrinsic, but it runs too early on the imported block, while the digest is pushed to the next block proposal which is not guaranteed to be produced by the same node.

1 Answer 1


DigestItem::PreRuntime is completely fine to put in a block. Nothing checks by default these pre-runtime digests. Your runtime should reject to build a block when there is no pre-runtime digest. It should also verify that the digest is valid and allows the node to produce the block.

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.

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