Skip to main content

Python bindings for Colibri stateless Ethereum proof library

Project description

C4 Logo

Colibri Python Bindings (corpus core colibri client)

ETH2.0_Spec_Version 1.4.0

The colibri client is a stateless and trustless ethereum client, which is optimized for the mobile apps or embedded devices, because it does not hols the state, but verifies on demand.

🚀 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())

✨ Key Features

  • 🔐 Cryptographic Verification - All RPC responses verified with Merkle proofs
  • 🚀 Async/Await Support - Modern Python async support for network operations
  • 💾 Pluggable Storage - Customizable storage backends for caching
  • 🧪 Comprehensive Testing - Mock HTTP requests and storage for testing
  • 🌐 Multi-Chain Support - Ethereum Mainnet, Sepolia, Gnosis Chain, and more
  • 📦 Easy Integration - Simple pip install with pre-built native extensions
  • 🔒 Privacy (PAP) - Optional Pragmatic Adaptive Privacy mode (privacy_mode=PrivacyMode.BASIC) to reduce intent leakage
  • 🔐 Privacy-preserving eth_call - ProverMode.HYBRID + PrivacyMode.BASIC + oblivious_nodes (default empty; e.g. https://rpc.safe-node.com/, API key for testing). Oblivious auto-enables PAP. TEE/ORAM: 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-1.1.26-cp314-cp314-win_amd64.whl (517.5 kB view details)

Uploaded CPython 3.14Windows x86-64

colibri_stateless-1.1.26-cp314-cp314-manylinux_2_17_x86_64.whl (605.6 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

colibri_stateless-1.1.26-cp314-cp314-macosx_15_0_universal2.whl (465.6 kB view details)

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

colibri_stateless-1.1.26-cp312-cp312-win_amd64.whl (505.0 kB view details)

Uploaded CPython 3.12Windows x86-64

colibri_stateless-1.1.26-cp312-cp312-manylinux_2_17_x86_64.whl (605.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

colibri_stateless-1.1.26-cp312-cp312-macosx_15_0_universal2.whl (465.4 kB view details)

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

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.26-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 3ae93ffb718065bd682307e2e0e225ac6b28423f3505ce454e105a56595dc88e
MD5 43d654c61d56be3959809b26b7e2cb9a
BLAKE2b-256 9664c5af4d765f8981852ef11f508904ac965eda2b1ee3bbe4d20564ec36d9ac

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.26-cp314-cp314-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 b01628f8531de8cde9eb5f06ddf86e6f5bf595b0344c0829e65b55b134787e14
MD5 4924cb0cc8ef961bdfed743ce4248d91
BLAKE2b-256 2cbcfdcd08d03ec0d4d95d4a2dc30c43566f6b90d092dd551f547b0b0408b684

See more details on using hashes here.

File details

Details for the file colibri_stateless-1.1.26-cp314-cp314-macosx_15_0_universal2.whl.

File metadata

File hashes

Hashes for colibri_stateless-1.1.26-cp314-cp314-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 a9ccde5e629262d8e1cae6cd5317f12fbe1f4b85b5cbed75259686bd5f94a1b8
MD5 8fd5b1e8680c28e12b53e354fe7900de
BLAKE2b-256 20494bd6b3737821bd65001470b37ddf773f55f97a1776d79dc24a8e2f81302f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.26-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5c1c16a3f002a43bf7e21e797cd56d6b536a6fec67ebba194d24935f75578007
MD5 9b9cae700dbfe04a67f970b25ff1d6af
BLAKE2b-256 f6bc773f144ffbd30326c4087f2d11e9993ec334caa01a25128af6b3ac1061e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.26-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 ed66290bee3576a15ef603e7ed2207e5007418f9dc0be41dfaac91735b340613
MD5 0287f6eb6b3ed064e7aead5bfa96d913
BLAKE2b-256 e0ebc51ea6ce8e8c7fa70fad23e11a278b3eb0de6d3d81bffaf4e8f8bf923144

See more details on using hashes here.

File details

Details for the file colibri_stateless-1.1.26-cp312-cp312-macosx_15_0_universal2.whl.

File metadata

File hashes

Hashes for colibri_stateless-1.1.26-cp312-cp312-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 0496af0f32ded3a6375a5abe55891ce8968d74cbcf97c624406be2dfb220d0f1
MD5 12feddb1b7511736ee736588b8ffb33d
BLAKE2b-256 c2c53b7dfd504f3dffcb8dc67af3da69d4d42754453499ff124a7a801b5dd9fe

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