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
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_workerloop in such a way that the data from the
DigestItem::Sealfrom the imported block is pushed into
inherent_digestis inserted into the proposal - no change here
DigestItem::PreRuntimeis accessible from the Runtime (contrary to
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.