Provable SDK for Python
provable-sdk-py is the Kayros API and verification SDK for Python.
Installation
pip install provable-sdk
Usage
1. Default usage
Use the built-in key and the default provable_sdk data type.
from provable_sdk import prove_single_hash, get_record_by_hash, verify, verify_with_inclusion
data_item = "ab" * 32
proof = prove_single_hash(data_item)
kayros_hash = proof["hash"]
record = get_record_by_hash(kayros_hash)
verified = verify({
"data_type": "provable_sdk",
"data_item": data_item,
"kayros_hash": kayros_hash,
})
inclusion = verify_with_inclusion({
"data_type": "provable_sdk",
"kayros_hash": kayros_hash,
})
2. Usage with API key and custom data type
import os
from provable_sdk import prove_single_hash, verify, verify_with_inclusion, set_api_key
settings = {
"api_key": os.environ["KAYROS_API_KEY"],
"data_type": "kayros_indexer_v1",
}
set_api_key(settings["api_key"])
proof = prove_single_hash(
"ab" * 32,
data_type=settings["data_type"],
api_key=settings["api_key"],
)
kayros_hash = proof["hash"]
verified = verify({
"data_type": settings["data_type"],
"data_item": "ab" * 32,
"kayros_hash": kayros_hash,
"api_key": settings["api_key"],
})
inclusion = verify_with_inclusion({
"data_type": settings["data_type"],
"kayros_hash": kayros_hash,
"api_key": settings["api_key"],
"verify_batch_existence": True,
})
Main API
prove_single_hash(data_hash, data_type=None, api_key=None)get_record_by_hash(kayros_hash, data_type=None, api_key=None)get_record_by_data_item(data_type, data_item, api_key=None)get_merkle_proof(data_type, hash=..., position=..., api_key=None)verify_hash_existence({"data_type": ..., "level": ..., "position": ..., "hash": ...}, api_key=None)verify_hash_batch({"data_type": ..., "level": ..., "start": ..., "hashes": [...]}, api_key=None)verify({"data_type": ..., "data_item"?: ..., "kayros_hash"?: ..., "api_key"?: ...})verify_with_inclusion({"data_type": ..., "data_item"?: ..., "kayros_hash"?: ..., "api_key"?: ..., "trusted_root_hash"?: ..., "trusted_level"?: ..., "trusted_position"?: ..., "levels_hash_type"?: ..., "verify_batch_existence"?: ..., "level_checks"?: [...]})
data_type is required for verification. Provide at least one of data_item or kayros_hash.
levels_hash_type controls the Merkle rollup hash used for local inclusion replay. It defaults to sha3-256 and also accepts sha256.
License
MIT
Release files for provable-sdk 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| provable_sdk-0.1.2.tar.gz | 21.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| provable_sdk-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 40.5 kB
Release files / provable_sdk-0.1.2.tar.gz
| Download URL | provable_sdk-0.1.2.tar.gz |
|---|---|
| Size | 21.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c4d6f4a1b9d9679566c429ef7029cbe00a12636ad62e1446de9235d9346f476c
|
|
BLAKE2b-256 checksum How to use checksums |
a72141e3e439840eabb61c7f944dfbea7efebd6c2134b3f92d75eca89e553e5d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.4
|
Release files / provable_sdk-0.1.2-py3-none-any.whl
| Download URL | provable_sdk-0.1.2-py3-none-any.whl |
|---|---|
| Size | 18.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6be4adf9f93f59e936b31f42dd7ade085d49fc9e88c071876a1f5e1c0eeed283
|
|
BLAKE2b-256 checksum How to use checksums |
e315770629371af38f5ac52a9c6691721929e785f218cb236b90194d059b941c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.4
|