A blockchain for human
Project description
A blockchain for human
Getting Started
Create your first wallet and add your first transaction:
from easy_blockchain.wallet import Wallet from easy_blockchain.blockchain import Block, BlockChain wallet = Wallet() # wallet will auto gen your private and publickey print('wallet.getPublicKey():') print(wallet.getPublicKey()) print('wallet.getPrivateKey():') print(wallet.getPrivateKey()) pb = wallet.getPublicKey() trans01 = wallet.create_transaction('test01', 1, 0, 'one message')
In miner side, the miner receive your transaction, add it to blockchain and mining:
# add transactions to a block block = Block() block.add_transaction(trans01) coin = BlockChain() # mine a proof proof = coin.mine_proof() x = coin.add_block(block,'abc',proof=proof) # 'abc' is the miner address # the block have been added print(x) coin.save_chain()
The nodes provides get_balance and get_history also:
mycoin = coin.get_history(pb) print(json.dumps(mycoin, indent=4)) mycoin = coin.get_history('test01') print(json.dumps(mycoin, indent=4))
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
easy_blockchain-0.1.2.tar.gz
(5.6 kB
view hashes)
Built Distribution
Close
Hashes for easy_blockchain-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3326867610df79023ce880d0d8b1dc5f35a4c68217b2008f4598fda63e1a7176 |
|
MD5 | a85c09f8c2365412ae7ffa07b00b1ff5 |
|
BLAKE2b-256 | 1aa6522d3f017d0866b8e4f099f6d201f06a2ce15ff1efaf6b743f59c9883491 |