Bitchain is a simple lockchain emulator written in Python. Aimed at fostering education and understanding of blockchain technologies, Bitchain provides a clear and easy-to-understand interface to interact with a blockchain.
- Block Creation: Easily create new blocks with customizable data.
- Transaction Handling: Simulate transactions between parties in the blockchain.
- Chain Validation: Verify the integrity of the blockchain through hash calculations.
- Persistence: Keep a record of transactions until they are incorporated into a block.
- Python 3.6 or higher
- Git (optional)
To install Bitchain, clone the repository using Git:
git clone https://github.com/username/bitchain.git
cd bitchain
or:
pip install bitchain
see: https://pypi.org/project/bitchain/
You can also download the source code as a zip file and extract it.
Once you have the Bitchain code on your local machine, you can run it using Python:
python3 main.py
Bitchain includes a main
function that creates a simple blockchain, adds transactions to it, and prints out the entire chain.
Here's a quick example of creating a blockchain, adding transactions, and creating new blocks:
blockchain = Bitchain()
blockchain.new_transaction("Satoshi", "Mike", '5 BTC')
blockchain.new_transaction("Mike", "Satoshi", '1 BTC')
blockchain.new_transaction("Satoshi", "Hal Finney", '5 BTC')
blockchain.new_block(12345)
blockchain.new_transaction("Mike", "Alice", '1 BTC')
blockchain.new_transaction("Alice", "Bob", '0.5 BTC')
blockchain.new_transaction("Bob", "Mike", '0.5 BTC')
blockchain.new_block(6789)
print("Genesis block: ", blockchain.chain)
python3 -m pip install --upgrade build
python3 -m build
Please refer to the docstrings in the Bitchain
class for detailed information on the functionality of each method.
This is an open-source project by the Block Foundation.
The Block Foundation mission is enabling architects to take back initiative and contribute in solving the mismatch in housing through blockchain technology. Therefore the Block Foundation seeks to unschackle the traditional constraints and construct middle ground between rent and the rigidity of traditional mortgages.
website: www.blockfoundation.io
We'd love for you to contribute and to make this project even better than it is today! Please refer to the contribution guidelines for information.
Copyright © 2023 Stichting Block Foundation. All Rights Reserved.
Except as otherwise noted, the content in this repository is licensed under the Creative Commons Attribution 4.0 International (CC BY 4.0) License, and code samples are licensed under the Apache 2.0 License.
Also see LICENSE and LICENSE-CODE.
THIS SOFTWARE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.