BlCh
a python package that can help you make a blockchain within 50 lines of code
Example
from blch import Block, Blockchain
def main():
blockchain = Blockchain()
database = ["Joe gives 2 coins to jack", "Jack gives 3 coins to Joe", "May gave 10 coins to Klaus", "Klaus gave 5 coins to May"]
num = 0
for data in database:
num += 1
blockchain.mine(Block(num, data=data))
for block in blockchain.chain:
print(block)
print(blockchain.isValid())
blockchain.mine(blockchain.chain[0])
if __name__ == '__main__':
main()
This is a simple example of the code which can be tweaked by your needs
If any problems please raise an issue in the github repo of this package
Repo
Please fork my repo and make sure to let me know for any ideas or problems to fix
Release files for blch 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| blch-0.5.0.tar.gz | 2.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| blch-0.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.1 kB
Release files / blch-0.5.0.tar.gz
| Download URL | blch-0.5.0.tar.gz |
|---|---|
| Size | 2.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2ff27b19d8af59ddb575c6047734f61282e3dc549f3530ce4e7eeebff41a2df2
|
|
BLAKE2b-256 checksum How to use checksums |
8d9a1cbe0200c95759bf731f582fa09032f838a50b9dff2af4774f4dd727aba7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1
|
Release files / blch-0.5.0-py3-none-any.whl
| Download URL | blch-0.5.0-py3-none-any.whl |
|---|---|
| Size | 2.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a0102894ef7d06409cc253d50f59fb7a4e7c80438f425ba4bad522fd21cd75b5
|
|
BLAKE2b-256 checksum How to use checksums |
780ddaeb4f5bab3a6c273b478bf2bd36cbeadd001347b4618a5ea7df58daa1de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1
|