53 releases (35 breaking)

0.44.0 Sep 26, 2024
0.43.0 Jul 18, 2024
0.41.0 Jul 12, 2024
0.36.0 Mar 18, 2024
0.8.0-alpha.5 Mar 24, 2020

#2 in #difficulty

Download history 3/week @ 2024-07-29 9/week @ 2024-08-26 3/week @ 2024-09-09 24/week @ 2024-09-16 141/week @ 2024-09-23 72/week @ 2024-09-30 9/week @ 2024-10-07 2/week @ 2024-10-14 32/week @ 2024-11-04 22/week @ 2024-11-11

54 downloads per month
Used in polkadot-sdk

GPL-3.0-or-later…

1MB
19K SLoC

Proof of work consensus for Substrate.

To use this engine, you can need to have a struct that implements PowAlgorithm. After that, pass an instance of the struct, along with other necessary client references to import_queue to setup the queue.

This library also comes with an async mining worker, which can be started via the start_mining_worker function. It returns a worker handle together with a future. The future must be pulled. Through the worker handle, you can pull the metadata needed to start the mining process via MiningWorker::metadata, and then do the actual mining on a standalone thread. Finally, when a seal is found, call MiningWorker::submit to build the block.

The auxiliary storage for PoW engine only stores the total difficulty. For other storage requirements for particular PoW algorithm (such as the actual difficulty for each particular blocks), you can take a client reference in your PowAlgorithm implementation, and use a separate prefix for the auxiliary storage. It is also possible to just use the runtime as the storage, but it is not recommended as it won't work well with light clients.

License: GPL-3.0-or-later WITH Classpath-exception-2.0

Release

Polkadot SDK stable2409

Dependencies

~93MB
~2M SLoC