src.proof_of_work

Implementation and verification of the proof of work.

Functions

verify_proof_of_work(block) Verify the proof of work on a block.

Classes

ProofOfWork(block) Allows performing (and aborting) a proof of work.
src.proof_of_work.verify_proof_of_work(block)

Verify the proof of work on a block.

src.proof_of_work.GENESIS_DIFFICULTY = 1000

The difficulty of the genesis block.

Right now this is the average required number of hashes to compute one valid block.

class src.proof_of_work.ProofOfWork(block)

Allows performing (and aborting) a proof of work.

Variables:
  • stopped (bool) – A flag that is set to True to abort the run operation.
  • block (Block) – The block on which the proof of work should be performed.
  • success (bool) – A flag indication whether the proof of work was successful or not.
Parameters:

block (Block) – The block on which the proof of work should be performed.

abort()

Aborts execution of this proof of work.

run()

Perform the proof of work on a block, until stopped becomes True or the proof of work was successful.

Return type:Optional[Block]