Skip to main content

Python bindings for Colibri stateless Ethereum proof library

Project description

Colibri Logo

Colibri Stateless — Python

Verify Ethereum RPC data cryptographically — without running a full node.

ETH2.0 Spec Version 1.4.0 License PyPI

Colibri Stateless is a highly efficient prover/verifier for Ethereum (with upcoming support for Layer-2s such as OP-Stack). These Python bindings wrap the C core and give you an async API that verifies every RPC response against the beacon chain — no full node, no continuous sync.

Website · Docs · Whitepaper · Privacy (PAP)

Why Colibri?

  • Stateless — verification needs nothing but the proof and the sync committee it is checked against. The committee is cached locally so it does not have to travel with every request, but it works just as well with an empty cache or none at all. No persistent state, no full node.
  • Cryptographically verified RPC — every RPC response is checked against BLS signatures.
  • Offline verification — proofs are fully self-contained and verify without any network connection, thanks to zk-proofs for the sync committee and signed checkpoints.
  • On-demand, not always-on — work happens only when you make a request; no background sync burning bandwidth, CPU, or battery.
  • Verifies historical data (older than ~27h / 8192 blocks) — via historical_summaries proofs, where other light clients simply fail.
  • eth_getLogs completeness proofs — optional logs_completeness=True proves no matching log was omitted in the requested range.
  • Fully verified local transaction simulation — simulate a transaction against verified state before signing.
  • Privacy-aware — Pragmatic Adaptive Privacy (PAP) mode (privacy_mode=PrivacyMode.BASIC). Experimental.

Quick Start

Installation

python3 -m pip install colibri-stateless

Basic Usage

import asyncio
from colibri import Colibri

async def main():
    # Initialize client for Ethereum Mainnet
    client = Colibri(chain_id=1, provers=["https://mainnet.colibri-proof.tech"])
    
    # Make verified RPC call
    result = await client.rpc("eth_blockNumber", [])
    print(f"Current block: {result}")
    
    # Get account balance with proof verification
    balance = await client.rpc("eth_getBalance", [
        "0x95222290DD7278Aa3Ddd389Cc1E1d165CC4BAfe5", 
        "latest"
    ])
    print(f"Balance: {balance}")

# Run async function
asyncio.run(main())

Python-specific features

  • Async/await — modern async API for all network operations.
  • Pluggable storage — customizable storage backends for caching.
  • Easy integrationpip install with pre-built native extensions.
  • Testing utilities — mock HTTP requests and storage for deterministic tests.
  • Multi-chain — Ethereum Mainnet, Sepolia, Gnosis Chain, and more.
  • Privacy-preserving eth_call — combine ProverMode.HYBRID + PrivacyMode.BASIC + oblivious_nodes (default empty; e.g. https://rpc.safe-node.com/, API key for testing). Setting oblivious_nodes auto-enables PAP. TEE/ORAM background: Oblivious Labs.

Documentation

Full documentation: GitBook Guide

  • API Reference — complete class and method documentation
  • Storage System — custom storage implementations
  • Testing Framework — mock data and integration tests
  • Configuration — chain setup and advanced options
  • Building from Source — development and contribution guide

Development

Building from Source

# Clone repository
git clone https://github.com/corpus-core/colibri-stateless.git
cd colibri-stateless/bindings/python

# Build native extension
./build.sh

# Option 1: Use virtual environment (recommended)
python3 -m venv venv
source venv/bin/activate
pip install -e .
pip install -r requirements-dev.txt

# Run tests
pytest tests/ -v

# Deactivate when done
deactivate

Alternative without virtual environment:

# Install test dependencies with --user flag
python3 -m pip install --user pytest pytest-asyncio aiohttp

# Run tests directly with PYTHONPATH
PYTHONPATH=src python3 -m pytest tests/ -v

Quick Debug Build

For faster iteration during development:

# Build in debug mode
./build_debug.sh

# Run tests without installation
PYTHONPATH=src python3 -m pytest tests/ -v

Integration Tests

# Run with real blockchain data (offline)
from colibri.testing import discover_tests, run_test_case

tests = discover_tests()
for test_name, test_config in tests.items():
    result = await run_test_case(test_name, test_config)
    print(f"Test {test_name}: {'PASSED' if result else 'FAILED'}")

System Requirements

  • Python 3.8+
  • CMake 3.20+ (for building from source)
  • C++17 compiler (for building from source)

Related Projects

  • Core Library: colibri-stateless
  • Swift Bindings: iOS/macOS native integration
  • Kotlin Bindings: Android/JVM integration
  • JavaScript Bindings: Web/Node.js integration

License

MIT License - see LICENSE for details.

Contributing

Contributions welcome! Please read our Contributing Guide and check the Development Documentation.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

colibri_stateless-2.0.1-cp314-cp314-win_amd64.whl (547.2 kB view details)

Uploaded CPython 3.14Windows x86-64

colibri_stateless-2.0.1-cp314-cp314-manylinux_2_17_x86_64.whl (632.1 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

colibri_stateless-2.0.1-cp314-cp314-macosx_26_0_universal2.whl (486.1 kB view details)

Uploaded CPython 3.14macOS 26.0+ universal2 (ARM64, x86-64)

colibri_stateless-2.0.1-cp312-cp312-win_amd64.whl (533.9 kB view details)

Uploaded CPython 3.12Windows x86-64

colibri_stateless-2.0.1-cp312-cp312-manylinux_2_17_x86_64.whl (632.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

colibri_stateless-2.0.1-cp312-cp312-macosx_26_0_universal2.whl (485.8 kB view details)

Uploaded CPython 3.12macOS 26.0+ universal2 (ARM64, x86-64)

File details

Details for the file colibri_stateless-2.0.1-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for colibri_stateless-2.0.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 7cae74272e26bf8a05b94fee520613e58638a5065e51b8c5fcfe786172cb1211
MD5 5e4f3a9e8dc6ae86258ff5ce23f0d209
BLAKE2b-256 e1996b1e7c7d738a759e89f0629d7688cf5e13b32e33f089ac1628c9a1d7d327

See more details on using hashes here.

File details

Details for the file colibri_stateless-2.0.1-cp314-cp314-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for colibri_stateless-2.0.1-cp314-cp314-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 f940308d867b150d0ae989e09a860f6520fb7f06c47543ee2fa26599610ae478
MD5 57f999322581209358fb98e86615e193
BLAKE2b-256 e517a6991ed310b5f4d60a83b0f8ca9d6b91a463018bfe4a6c419aab9281b370

See more details on using hashes here.

File details

Details for the file colibri_stateless-2.0.1-cp314-cp314-macosx_26_0_universal2.whl.

File metadata

File hashes

Hashes for colibri_stateless-2.0.1-cp314-cp314-macosx_26_0_universal2.whl
Algorithm Hash digest
SHA256 25445d221103450edfa94b2a191cae6d6fa98e0c62dbf4268891980b1a8a7798
MD5 5db6b1ae1585a323a88998e1cc2a7e81
BLAKE2b-256 33b4d5069c57863ec4e8274dbc86a6b9bb530833484762866059340e7a3c1ea6

See more details on using hashes here.

File details

Details for the file colibri_stateless-2.0.1-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for colibri_stateless-2.0.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ebec3d6b254959a68b3b1c466ed7e1ebabbb03349e7e3b69ffa55bc7f110e5b5
MD5 e458d43ac27a296c7a6d59d760142dda
BLAKE2b-256 77f95ae49f95175384e4c23e098c373aa8e7b1a55dfc5393b4e9bf4c2530e312

See more details on using hashes here.

File details

Details for the file colibri_stateless-2.0.1-cp312-cp312-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for colibri_stateless-2.0.1-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 71190603e677406c138344d2a7ce636dbf4a79121c830044a1be09b2775ddf43
MD5 b64b91161f56c2866d34aa12224c4680
BLAKE2b-256 e2a1dec4af596d88ea184e204971ca00805e1b2d606ea4a4bbd5abefe3240c24

See more details on using hashes here.

File details

Details for the file colibri_stateless-2.0.1-cp312-cp312-macosx_26_0_universal2.whl.

File metadata

File hashes

Hashes for colibri_stateless-2.0.1-cp312-cp312-macosx_26_0_universal2.whl
Algorithm Hash digest
SHA256 b8668313eaa25242f329ef4eac716abe14c7bed8d873f777f2cc6903c2bfdfe8
MD5 941fe95a4f9f3f7c4cf033b8f918fcca
BLAKE2b-256 fc53ece4c8338e2b943ee1332d81ccbf11116dab08bc584521527bc1baf33c03

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