-
Notifications
You must be signed in to change notification settings - Fork 1
Lib: Blockchain
valvesss edited this page Oct 11, 2019
·
1 revision
The blockchain class handle the manipulation of blocks. It also maintain the immutable-ledger or the chain itself. It controls the requests for new blocks and new transactions over the network. And the best! It handles mining! Take a look:
- Example:
- Send transactions to all peers-shared-tx-memory
data = {'company_name': 'It works!', 'company_data': 'Bloco do Bob'}
bob.bc.new_transaction(data)
- Mine
bob.bc.mine()
- Forge a new block
bob.forge_block()
- Requesting other nodes validation for new block
bob.bc.request_add_block()
This is the easiest function! It calls the Block function and creates a new block. Then, hash this block and add this inside the block. The block is manual inserted in the chain, as the primary or first block. The genesis one.
blockchain.create_genesis_block()
PAGE IN WORK