Skip to main content

Pyzantium

Report Bug · Request Feature


🔗 Python implementation and building blocks for blockchain

Pyzantium is a python module that let you implement blockchain whit various capabilityies in your project.

The Module provide both high-level(Blockchain) and low-level(Block,Consensus, ...) classes in order to be highly customizable.


1. Installation

The package is pip installable:

pip install pybchain

Or, you can download it and use setuptools to build it by hand:

git clone http://github.com/rezamahdi/pybchain
cd pybchain
python setup.py install

2. Usage

To initialize a blockchain, you must specify some info as agreement:

  • Hash algorithm to use in blockchain.
  • Wath type of data you want to store. Blockchain is capable of storing anythin not only transactions.
  • An authentication scheme. Common way to do this is using ECC. this part is optional.
  • Endpoint to connect to other nodes. Common option is a HTTP api or json-rpc.

Whit having these options specified, you can initialize the node as this:

from pyzantium import Chain, Block
from pyzantium.storage import Disk
from hashlib import sha_256

chain = Chain(
  hash=sha_256,
  storage=Disk(
    "path/to/storage",
    create=True
  )
)

Next, in order to mine genesis block do this:

genesis = Block(chain)
genesis.add_part(b'000000000000000000000000000')  # or any other type of data.
# add more data parts...
genesis.finalize()  # we don't use `mine` because it is named `forge` in PoS.

result = endpoint.broadcast_new_block(genesis)

if result.is_ok():
  chain.append(genesis)

see documentation for more info

3. License

Copyright (c) Reza Mahdi 2022 This project is licensed under terms of MIT License (see LICENSE)

Metadata

Release files for pyzantium 0.0.2

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

Source distribution (sdist)

Source distribution for pyzantium 0.0.2
File Size Uploaded
pyzantium-0.0.2.tar.gz 8.2 kB Details

Built distribution (wheel)

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

Total release size: 16.8 kB

Release files / pyzantium-0.0.2.tar.gz

Download URL pyzantium-0.0.2.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ff53be6e75bc7b79d21a46ac389a71e8962bca161b3bfffdc7c54afefd2531aa
BLAKE2b-256 checksum
How to use checksums
0882d0dd7c592ef8d9e2e8e7051b16c043979b802da05f09d46236e77f0f1f91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.5

Release files / pyzantium-0.0.2-py3-none-any.whl

Download URL pyzantium-0.0.2-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
51b188543fd605126f00fdccaebc74c721e365b6cdd7b615d634cfb52a65ed69
BLAKE2b-256 checksum
How to use checksums
b2d902832c24fd04939bfab8b949405159fdd8c6ba6dd02c64457e7dcf372e43
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.5

Release history Release notifications | RSS feed

This release

0.0.2 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