Skip to content

Simple Blockchain emulator in Python for educational purposes.

License

CC-BY-SA-4.0 and 2 other licenses found

Licenses found

CC-BY-SA-4.0
LICENSE
Apache-2.0
LICENSE.txt
Apache-2.0
LICENSE-CODE
Notifications You must be signed in to change notification settings

block-foundation/bitchain

GitHub License devContainer


Block Foundation Logo

Bitchain

A Simple Blockchain Emulator in Python


Block Foundation Brand

Contents



Report a Bug Request a Feature Ask a Question Make a Suggestion Start a Discussion

Introduction

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.

Key Features

  • 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.

Installation

Requirements

  • 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.

Usage

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.

Example

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)

Building

python3 -m pip install --upgrade build
python3 -m build

Documentation

Please refer to the docstrings in the Bitchain class for detailed information on the functionality of each method.


Colophon

Authors

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

Development Resources

Contributing

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.

Legal Information

Copyright

Copyright © 2023 Stichting Block Foundation. All Rights Reserved.

License

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.

Disclaimer

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.

Releases

No releases published

Sponsor this project

Packages

No packages published