Python - example of proof-of-work mechanism in Bitcoin

Published on Author admin

Simple Python script presenting proof-of-work mechanism in Bitcon.
https://github.com/openterprise/scripts/blob/master/blockchain-proof-of-work-example.py

Script output:

Nonce: 118
Hash(Nonce): 00cc2e9f7a37a0fdf0fc99d8fa0c7ce8f7cae298854c8581886c66dc1776fd00
Seconds: 0.0002713203430175781
Nonce: 145875
Hash(Nonce): 000003b0c79c3faff75237486788d0f6cc53c8d0f2a285fefcd6431cff8bbe35
Seconds: 0.34033846855163574
Nonce: 12007876
Hash(Nonce): 000000f022498f1e990efb8ec4d730c5ce4248097489beace7ec0accb1ae656c
Seconds: 29.438159942626953
Nonce: 11042531297
Hash(Nonce): 00000000cb5b5928f89ed2a91fda881ffa4e5597fc07d4da22d1259771272cb3
Seconds: 27913.442200899124