Python API
Bitcoin Cash full node as a Python library
Knuth Python API is a high performance implementation of the Bitcoin Cash protocol focused on users requiring extra performance and flexibility. It is a Bitcoin Cash node you can use as a library.
Getting started with Python
- Create a new Python console project:
$ mkdir HelloKnuth
$ cd HelloKnuth
- Add a reference to our Python API package:
$ pip install kth
- Create a new file called
index.pyand write some code:
import kth
import signal
import asyncio
running_ = False
def shutdown(sig, frame):
global running_
print('Graceful shutdown ...')
running_ = False
async def main():
global running_
signal.signal(signal.SIGINT, shutdown)
config = kth.config.getDefault(kth.config.Network.mainnet)
with kth.node.Node(config, True) as node:
await node.launch(kth.primitives.StartModules.all)
print("Knuth node has been launched.")
running_ = True
(_, height) = await node.chain.getLastHeight()
print(f"Current height in local copy: {height}")
if await comeBackAfterTheBCHHardFork(node):
print("Bitcoin Cash has been created!")
# node.close()
print("Good bye!")
async def comeBackAfterTheBCHHardFork(node):
hfHeight = 478559
while running_:
(_, height) = await node.chain.getLastHeight()
if height >= hfHeight:
return True
await asyncio.sleep(10)
return False
asyncio.run(main())
- Enjoy Knuth node as a Python library:
$ python index.py
Issues
Each of our modules has its own Github repository, but in case you want to create an issue, please do so in our main repository.
Metadata
Release files for kth 0.8.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 | Provenance | Actions |
|---|---|---|---|---|
| kth-0.8.0.tar.gz | 26.7 kB | Without provenance | Details for kth-0.8.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kth-0.8.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for kth-0.8.0-py2.py3-none-any.whl |
Total release size: 57.4 kB
Release files / kth-0.8.0.tar.gz
| Download URL | kth-0.8.0.tar.gz |
|---|---|
| Size | 26.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2712f8ff8cdac18278e6fdf7afc6fd8e88055e8a0ce59d11e185804108ed943d
|
|
BLAKE2b-256 checksum How to use checksums |
ba1cdf3fee4bad914593c7fcabdae27f31459f608276c58569d59f3f698fe4f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.8
|
Release files / kth-0.8.0-py2.py3-none-any.whl
| Download URL | kth-0.8.0-py2.py3-none-any.whl |
|---|---|
| Size | 30.6 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
31457c627d8421054660ba968a59e107f20c0aedab23a5a7019522086b81c817
|
|
BLAKE2b-256 checksum How to use checksums |
57667a191c00939fca19df569e6bc7ae20639568763f0417acbe0c262fd11c6d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.8
|
Security for kth 0.8.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.