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.28-cp314-cp314-win_amd64.whl (530.6 kB view details)

Uploaded CPython 3.14Windows x86-64

colibri_stateless-1.1.28-cp314-cp314-manylinux_2_17_x86_64.whl (614.1 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

colibri_stateless-1.1.28-cp314-cp314-macosx_15_0_universal2.whl (472.1 kB view details)

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

colibri_stateless-1.1.28-cp312-cp312-win_amd64.whl (516.6 kB view details)

Uploaded CPython 3.12Windows x86-64

colibri_stateless-1.1.28-cp312-cp312-manylinux_2_17_x86_64.whl (614.1 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

colibri_stateless-1.1.28-cp312-cp312-macosx_15_0_universal2.whl (471.8 kB view details)

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

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.28-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 5f662948fcffee4b646b8db26a8c5775eba5d8bd827dfbb84e1ffec905490d79
MD5 2081f09aba49e10268e9a10a0bcd3c4f
BLAKE2b-256 d6e9210de545aef9c07ce9ad9f6af3e94833964f6b79cf46b6cabc6c8ee7a3bc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.28-cp314-cp314-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 cacedfb805738338be5472129326073890d4e7cde95fc1e8cdda60275e17210c
MD5 3984f91937a1eb29f83580afa0986f4d
BLAKE2b-256 fd65bb4d372815f38be81f4ad004d53c7dad3b6baeb2fabfb72c74a0a9765721

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.28-cp314-cp314-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 ba6546bc69093f3cacccecbe362c5aa63598708e9e419063cffa7977e1431070
MD5 c5fa4c65c94104a770efe0de31bb1476
BLAKE2b-256 ffee4e9a8dee0eba0db5cb426c380cbd4fad8490d7f1db5e5c1c285b446e3e8f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.28-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 50aef8fefcf832d3448c20edc402ad1b9135cf0b5cd26493f2a4a25e1d972900
MD5 94bf95d8db38378cd25ad5a21f67e90a
BLAKE2b-256 c64e4121e91e118f423b54aca79621de0de2e8b15892288f216407fd49b17a08

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.28-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 fde9155cb1665d3642139256ecd131329b428dfb7e94ef887e36a36febdb245e
MD5 e3f168e8aad17305376b5f0e47360801
BLAKE2b-256 479eebe8a40fcc9954c9c5809043975e4f30777c5841ca1d19b664e7212c4e13

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.28-cp312-cp312-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 4f662948f2844a8ede0fca3d11e15a1ab58116bba07305a90442d3d4cb5d6eb8
MD5 ffea6a2cea66d960bd2f443c46be6cf8
BLAKE2b-256 20c4b8d3720347038a2f05b8ba7f999ae82894e1f389f1300f973b4da4abc5e3

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