Skip to main content

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
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()

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

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.

Files for easy-blockchain, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size easy_blockchain-0.1.2-py3-none-any.whl (12.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size easy_blockchain-0.1.2.tar.gz (5.6 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page