Python

Python bindings for the Colibri stateless Ethereum proof library. Generate and verify cryptographic proofs for Ethereum RPC calls without trusting centralized infrastructure.

Overview

The Colibri Python Bindings provide a modern, async-first Python API for verified blockchain interactions. Built with pybind11 for optimal performance and memory management, these bindings enable secure Web3 functionality without dependency on centralized RPC providers.

Core Features

  • 🔐 Cryptographic Verification - All RPC responses validated 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 Installation - Simple pip install with pre-built native extensions

Architecture

┌─────────────────────────────────────────────────────────────────┐
│                    Python Application Layer                     │
├─────────────────────────────────────────────────────────────────┤
│                     colibri.client API                          │
│  • Colibri class (main interface)                               │
│  • Async RPC methods                                            │
│  • Storage & HTTP abstractions                                  │
│  • Error handling & type conversion                             │
├─────────────────────────────────────────────────────────────────┤
│                  Python-C++ Bridge Layer                        │
│  • _native.so (pybind11 extension)                              │
│  • Function pointer callbacks                                   │
│  • Memory management & cleanup                                  │
├─────────────────────────────────────────────────────────────────┤
│                   Core C Libraries                              │
│  • Prover (proof generation)                                   │
│  • Verifier (proof verification)                                │
│  • Storage plugin system                                        │
│  • Cryptographic libraries (blst, ed25519)                      │
└─────────────────────────────────────────────────────────────────┘

Installation

Pre-built wheels are available for:

  • Linux: x86_64

  • macOS: ARM64 (Apple Silicon) and x86_64 (Intel)

  • Windows: x86_64

Development Installation

Quick Start

Basic RPC Calls

Local Proof Generation

Multi-Chain Setup

API Reference

Colibri Class

Core Methods

Storage System

Built-in Storage Implementations

Default File Storage

Memory Storage

Custom Storage Implementation

Testing Framework

Mock Testing

Integration Testing

Custom Test Data

Configuration

Chain Configuration

Advanced Configuration

Error Handling

Exception Types

Graceful Degradation

Building from Source

Prerequisites

Build Process

Development Build

Running Tests

Performance Optimization

Connection Pooling

Storage Caching

Troubleshooting

Common Issues

Import Error: "No module named '_native'"

"Segmentation fault on exit"

This was a known issue with Python/C++ object lifetime. Fixed in current version.

RPC Calls Fail with Proof Errors

Windows Build Issues

Debug Mode

Memory Usage Monitoring

Platform Specifics

Linux Considerations

  • glibc version: Pre-built wheels require glibc 2.28+ (Ubuntu 20.04+)

  • Security: Runs in user space, no special permissions required

  • Performance: Native performance with direct C++ integration

macOS Considerations

  • Apple Silicon: Native ARM64 support with optimal performance

  • Intel Macs: x86_64 compatibility maintained

  • Code Signing: All native libraries are properly signed

  • Minimum Version: macOS 10.15+ (Catalina)

Windows Considerations

  • Unicode: Full UTF-8 support for all text operations

  • Path Length: Handles long file paths correctly

  • Permissions: No administrator privileges required

  • Minimum Version: Windows 10 (1809+)

CI/CD Integration

GitHub Actions

Docker Integration

Further Information

Last updated