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

📖 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.22-cp314-cp314-win_amd64.whl (473.7 kB view details)

Uploaded CPython 3.14Windows x86-64

colibri_stateless-1.1.22-cp314-cp314-manylinux_2_17_x86_64.whl (566.3 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

colibri_stateless-1.1.22-cp314-cp314-macosx_15_0_universal2.whl (427.0 kB view details)

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

colibri_stateless-1.1.22-cp312-cp312-win_amd64.whl (461.7 kB view details)

Uploaded CPython 3.12Windows x86-64

colibri_stateless-1.1.22-cp312-cp312-manylinux_2_17_x86_64.whl (566.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

colibri_stateless-1.1.22-cp312-cp312-macosx_15_0_universal2.whl (426.5 kB view details)

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

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.22-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 6d5cb583eb138c36882bf47c93f89a4a8ba4c65b9a855378e0a3617216bc2338
MD5 fbfc7901dafa93684c43ef87d13d61ce
BLAKE2b-256 b9fbceb9fd74fdc0aea6092909ae0b5e78e817d5aa5b8de542718ebd3121ea77

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.22-cp314-cp314-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 bdafdfc4a76638e11082edb9bfb95c9f61f9d5d7fdce7f85a1d15d971ca83c98
MD5 0725ddfe3ee70f1fccb0a56592a7d7d0
BLAKE2b-256 c31ba4ab4c1e6cd95117bc8983e3f66e64913bc62699db5acd81ffbdc81817f7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.22-cp314-cp314-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 7e75c072417292bf89ae327ae189782fd0f19754e3f416bab01428e65ea17778
MD5 8db538cfc5e3f8d5d93b24d8f832dca5
BLAKE2b-256 aff6cfc2714eee609e1c8cc45d7db351e8ccfa275055d681a777b4981f3f6d58

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.22-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4f7441b813d5f982952f17b5c856e2e6b57576c2a7b5dc1f1f3ab1a46848a5c1
MD5 6f8aceaf37f78ec43bcf114c9bf3ea4f
BLAKE2b-256 4f989c8696c65c8c10b3ee9d7b297d94f220f96e7b4a5078e80cfa452a79d797

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.22-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 23df35505da58243106da32bf6e01af1c380878d04b7700ab805f008c59953d0
MD5 0ddfa62448cc76b2f6e7bf6b6a74faad
BLAKE2b-256 cee6d8800b416d68f9acb2291793c8a154a37db6555dd7f1b0a69ecb323fc2c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.22-cp312-cp312-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 aeb9378cc897c50c4b26a1c09c3b627b9504e6020cc1e17aa4611547c1e58588
MD5 15499a5bb58840fdb060c1662edb43ce
BLAKE2b-256 83a263df11daa4f836f67e9e604577e139f6e8a33bcd6084de51964853bc509a

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