Skip to main content

A blockchain, coin or building tools for human. It doesn’t include servers.

Getting Started

Installation:

pip install easy_blockchain

Create your first wallet and add your first transaction:

from easy_blockchain.wallet import Wallet
from easy_blockchain.blockchain import Block, BlockChain

# Create the first user
wallet = Wallet()
user01 = wallet.getPublicKey()
trans01 = wallet.create_transaction('test01', 1, 0.5, 'one message')
trans02 = trans01.copy() # create a forgery attack
print('Check if a forgery attack have same as real transaction')
print('trans01 == trans02', trans01 == trans02)

# Create the second user
wallet02 = Wallet()
user02 = wallet02.getPublicKey()
trans03 = wallet02.create_transaction(user01, 1.5, 0.12,'user02 send to user01')

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)
block.add_transaction(trans02)  # check adding a forgery attack
block.add_transaction(trans03)

# check how many transactions were added
print('--------------------------------------')
print('The block 1 have 2 real transaction:')
print(json.dumps(block.transactions, indent=2))
# create a blockchain and become an miner
coin = BlockChain()
# mine a proof
proof = coin.mine_proof()
print('The first proof is:',proof)
# save blockchain to local database
coin.save_chain()

The blockchain also provides balance and history of trading:

print('--------------------------------------')
print('The transaction history and the balance of users:')
mycoin = coin.get_history(user01)
print('User: user01 balance:', coin.get_balance(user01))
print(json.dumps(mycoin, indent=4))

mycoin = coin.get_history(user02)
print('User: user02 balance:', coin.get_balance(user02))
print(json.dumps(mycoin, indent=4))

mycoin = coin.get_history(user03)
print('User: user03 balance:', coin.get_balance(user03))
print(json.dumps(mycoin, indent=4))

Metadata

Release files for easy-blockchain 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for easy-blockchain 0.1.6
File Size Uploaded Provenance Actions
easy_blockchain-0.1.6.tar.gz 7.3 kB Without provenance Details for easy_blockchain-0.1.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for easy-blockchain 0.1.6
File Interpreter ABI Platform Actions
easy_blockchain-0.1.6-py3-none-any.whl Python 3 none any Details for easy_blockchain-0.1.6-py3-none-any.whl

Total release size: 22.6 kB

Release files / easy_blockchain-0.1.6.tar.gz

Download URL easy_blockchain-0.1.6.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f0465d50517f13e601befbe64847cd3b7a0f4429e90098d1a7dbf1a8d4ad8e9b
BLAKE2b-256 checksum
How to use checksums
6aa1a9a93e3a6070ce441d08752d9c0582724ff10ddfba317ada84c53c04edf7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / easy_blockchain-0.1.6-py3-none-any.whl

Download URL easy_blockchain-0.1.6-py3-none-any.whl
Size 15.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3f09e1ee7059b330a7aa6e83ead02c84f1482abfeec6dd0b83e16e07d2dead97
BLAKE2b-256 checksum
How to use checksums
f51c46ce3cf68938f30f08d5e196781a0afe22b8be581caaeb85cb9d2be9e58f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for easy-blockchain 0.1.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page