Tommi Versetti pfp
Tommi Versetti

@tommiversetti

# Example usage: # Instantiate the Blockchain blockchain = Blockchain() # Example transactions blockchain.new_transaction('Alice', 'Bob', 1) blockchain.new_transaction('Bob', 'Alice', 5) # Mine a new block last_block = blockchain.last_block last_proof = last_block['proof'] proof = blockchain.proof_of_work(last_proof) # Add the block to the blockchain previous_hash = blockchain.hash(last_block) block = blockchain.new_block(proof, previous_hash) # Output the blockchain print(json.dumps(blockchain.chain, indent=2))
0 reply
0 recast
0 reaction