Metadata-Version: 2.0
Name: easy-blockchain
Version: 0.1.2
Summary: A blockchain for human
Home-page: https://github.com/minhtuan221/py-blockchain
Author: Minh Tuan Nguyen
Author-email: ntuan221@gmail.com
License: BSD
Description-Content-Type: UNKNOWN
Keywords: microservice,http,flask,ecdsa,blockchain
Platform: any
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: BSD License
Classifier: Environment :: Web Environment
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Application
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Dist: cython-npm
Requires-Dist: ecdsa
Requires-Dist: flask (==0.12.2)
Requires-Dist: requests (==2.18.4)
Requires-Dist: sanic

py-blockchain
=============

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


