Skip to main content

Bitchain: A Simple Blockchain Emulator in Python

Overview

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

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)

Documentation

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

Contributing

We welcome all contributions to Bitchain! Whether it's bug fixes, feature additions, or documentation improvements, your input is greatly appreciated. Please check the CONTRIBUTING.md file for detailed instructions on how to contribute.

Metadata

Release files for bitchain 0.0.0

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

Source distribution (sdist)

Source distribution for bitchain 0.0.0
File Size Uploaded
bitchain-0.0.0.tar.gz 4.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bitchain 0.0.0
File Interpreter ABI Platform
bitchain-0.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.0 kB

Release files / bitchain-0.0.0.tar.gz

Download URL bitchain-0.0.0.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f4387034ba2a3cab9849ce4f923a77ee87f912e5caa68046b5fa0c4810525aae
BLAKE2b-256 checksum
How to use checksums
567e9a98f4019e54ba63303fc4b9214f5f76a8c7f506d9b82140b91eef61e5b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.13

Release files / bitchain-0.0.0-py3-none-any.whl

Download URL bitchain-0.0.0-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9472fe2711e1d29f99f18394f2c22564455fea290fc8a7f83b3e3de7026fef94
BLAKE2b-256 checksum
How to use checksums
6bb8ada3619f0f2d63ddb3de02c2ae600ee5238d68a87d4a672a426b66296682
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.13

Release history Release notifications | RSS feed

This release

0.0.0 This release

2 release files

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