Skip to main content

Python SDK for on-chain smart contract attestation (ERC-8004)

Project description

contract-attestation (Python SDK)

Python client for the Contract Attestation API — on-chain security attestation for smart contracts (ERC-8004).

Install

pip install contract-attestation
# Optional crypto helpers
pip install "contract-attestation[crypto]"

Development Install

pip install -e .
pip install -e ".[dev]"
# Optional crypto helpers while developing
pip install -e ".[dev,crypto]"

Quickstart (async)

from contract_attestation import AsyncClient

async def main() -> None:
    async with AsyncClient(api_key="your-key") as client:
        review = await client.review("contract C {}")
        print(review.score, review.evidence_level)

Quickstart (sync)

from contract_attestation import SyncClient

with SyncClient(api_key="your-key") as client:
    review = client.review("contract C {}")
    print(review.score, review.attestation_status)

CI Gate

from contract_attestation import GatePolicy, check_contract

policy = GatePolicy(min_score=80)
result = check_contract("contract C {}", api_key="your-key", policy=policy)
if not result.passed:
    raise SystemExit(1)

Optional Crypto Helpers

from contract_attestation import verify_response_hash, decrypt_findings

ok = verify_response_hash(ipfs_payload, on_chain_hash)
findings = decrypt_findings(ipfs_payload, private_key_hex)

Manual Publish Fallback

pip install build twine
cd sdk/python
python -m build
TWINE_USERNAME=__token__ TWINE_PASSWORD="$PYPI_TOKEN" twine upload dist/*

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

contract_attestation-0.2.0.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

contract_attestation-0.2.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file contract_attestation-0.2.0.tar.gz.

File metadata

  • Download URL: contract_attestation-0.2.0.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for contract_attestation-0.2.0.tar.gz
Algorithm Hash digest
SHA256 1ef0fe6ae6e269aeae36cc2d13443b4feb608ef4bac287e32690c50f4e17cd3d
MD5 8e611049dc6695b1dbd80acf3d88b6ae
BLAKE2b-256 3cabe5195c84cc3455c93ab442080da9792e45709028bd7e2e8d3e05fc5ca89d

See more details on using hashes here.

File details

Details for the file contract_attestation-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for contract_attestation-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 643d3d8c214673886de08612a2f6620ecb29300597442a3aa75a22c02d08073f
MD5 2937f371282cb238d04b54c1ff6e38c2
BLAKE2b-256 f20ac111082d6180e297f2ab745d1956240328f74413493dd34874241a223a4c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page