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

Uploaded CPython 3.14Windows x86-64

colibri_stateless-1.1.30-cp314-cp314-manylinux_2_17_x86_64.whl (617.0 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

colibri_stateless-1.1.30-cp314-cp314-macosx_15_0_universal2.whl (474.4 kB view details)

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

colibri_stateless-1.1.30-cp312-cp312-win_amd64.whl (518.9 kB view details)

Uploaded CPython 3.12Windows x86-64

colibri_stateless-1.1.30-cp312-cp312-manylinux_2_17_x86_64.whl (617.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

colibri_stateless-1.1.30-cp312-cp312-macosx_15_0_universal2.whl (474.1 kB view details)

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

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.30-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 948b82daf996f98eaa0bea31f7d2fb0137a8a92bbbb4a2beec0504d059c3a27c
MD5 5bc73f5ddb4b13e9de887785128fa3fa
BLAKE2b-256 878731ec13f3a9cd874fbb7231da595366adaa2949eeea7f409fdd28405c71b6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.30-cp314-cp314-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 0bc4a6df7cd71feddb06566326933bd306eeb791fd0cf251beebcf37765ec86b
MD5 cf959c04990ad0158c75c24ed74c0a9a
BLAKE2b-256 1bd7e17632c793ea01ed7cf4bd35f209411067083cdf8ba9d61def558606dd45

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.30-cp314-cp314-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 670706540d6b5c78231a15cf7c7ba437b254aff036fc0da16e19c0ab4e81193a
MD5 488dca27f9e6ba52367c71459ec3c31c
BLAKE2b-256 87a56fca67691f98d48b425518808502007e3fb1fcb55c1ac60e0d02dbc515b8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.30-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a5dcc92cf172e4e9a4a075d854ce0723d793708f6649d7a69c381076ac68ecd4
MD5 7ef4d0a9b8242d76b639b1262a2e38d7
BLAKE2b-256 1e1f87f98ebe40b4707e296e7ab2672316efa1ba14506f6a65e3d5dac4a2225a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.30-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 3a4e73f001e8b5583dec9bab0e7d9a93c2403654b0eb46427fccfb4683dfc85b
MD5 789bb3bb0c10a4f08aa89c9cee0edc6c
BLAKE2b-256 d8cba2e290825105478258954803b2720e5b841e1d3fca485734aad3f0b306f3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.30-cp312-cp312-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 647f25d6c42ddc2c136fb9914cec3506ea5b21acac18b316d42d54bde4e296a4
MD5 c89ab386705ba6710f1cf8c38fd9c23a
BLAKE2b-256 b609390ac04896e0dc3468815efbc7a486a80b087e1045fd0da58b75ab81ec91

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