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

Uploaded CPython 3.14Windows x86-64

colibri_stateless-1.1.18-cp314-cp314-manylinux_2_17_x86_64.whl (557.1 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

colibri_stateless-1.1.18-cp314-cp314-macosx_15_0_universal2.whl (420.3 kB view details)

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

colibri_stateless-1.1.18-cp312-cp312-win_amd64.whl (445.1 kB view details)

Uploaded CPython 3.12Windows x86-64

colibri_stateless-1.1.18-cp312-cp312-manylinux_2_17_x86_64.whl (557.1 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

colibri_stateless-1.1.18-cp312-cp312-macosx_15_0_universal2.whl (420.1 kB view details)

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

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.18-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 925f24a6cf6d2a1df4faded9d77d40a5826747ddcaa1e084340f0f25060095ff
MD5 0711bba8c1f32e274c819636d2831367
BLAKE2b-256 eace5f62c52ce064ad9303806419b9f44aaeabd6d0f23dfba493c4f252095b40

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.18-cp314-cp314-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 8ad3a1e2d2b7f649924f255c94acefad26e23ff2bc6c8fce8bacdffd63a443b6
MD5 241fae1bfaca35805c005360472e734e
BLAKE2b-256 e82ee70c24c83867fd7fa5a856165d4c4c39af867d95646084abf64725735c26

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.18-cp314-cp314-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 2a658a6890a78e824b00028eb593ed81a8a017e35a8a64fd2290066c4cbdb8f7
MD5 87157847740e7af0296a7a6799e2a6fe
BLAKE2b-256 ebfc14c1c3b8a9d784a46c0b3f75fba00faf90898759b7b8062fec1f6bee3319

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.18-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8e771a3bf27821d5c0ac6fb0cfeee07694e24b67f080ee35d09607751436b74f
MD5 6013c002b583143027d2c5cc0030a228
BLAKE2b-256 0806f2f0112351e440642a52a0bbe4a88160c8487e0cc8cd3df858a0cb923b48

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.18-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 9709d62819139e5e048c45c34e2f292053cb46d07a6de0446a9da36f2e6561f9
MD5 b4a31788982234f8e895d06ff2fed746
BLAKE2b-256 863eb93bc105a7ababa987a46702ec4a6eff7e665f274f60e0d084fb3eddfe03

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.18-cp312-cp312-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 e1232bcf6556f3a7650b2115a8d975cd0d69e15d07a99cac273e3d03d04eb1de
MD5 998a7676c48da5bbea634054a617d8b6
BLAKE2b-256 159dad84dc65943f92061816e9a5f1e7d2a179f83b686736acd10d37e3ab1069

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