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

Uploaded CPython 3.14Windows x86-64

colibri_stateless-1.1.21-cp314-cp314-manylinux_2_17_x86_64.whl (548.2 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

colibri_stateless-1.1.21-cp314-cp314-macosx_15_0_universal2.whl (415.3 kB view details)

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

colibri_stateless-1.1.21-cp312-cp312-win_amd64.whl (446.8 kB view details)

Uploaded CPython 3.12Windows x86-64

colibri_stateless-1.1.21-cp312-cp312-manylinux_2_17_x86_64.whl (548.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

colibri_stateless-1.1.21-cp312-cp312-macosx_15_0_universal2.whl (415.1 kB view details)

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

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.21-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 a6bdfeb079eb78b481db8bf52ecfb540d2cec8cbad44348de85c0bff1abc1423
MD5 38bdea1e07d7436f4426300cbab5edb8
BLAKE2b-256 28a591ff59059662bcd89eb3aebd18674ab989454df6f167d887b99a12d6868b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.21-cp314-cp314-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 5530cd2975697791593115b3cdcde5816d9b158f00110af17674d4780cd0a9f5
MD5 343d48d06d7878195b20656747a37dd5
BLAKE2b-256 503555c22b45125131c577359cf7752b1892a287c3ee3b3b5eb08b5cddd92f73

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.21-cp314-cp314-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 f9c9646d11055ddb2743a9d14d8561b4d8dcd6961ddabd256eb4330f85d28b1a
MD5 b5683661caacb1f091f4bfb417fd31e0
BLAKE2b-256 d04d879406600d007f2896f88128f80864f5f9899e63ab70cdd68401ed89006a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.21-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 42ec85da618a2fab947aef4ca9470198f87e9158ca7f912921c46297fb9c378e
MD5 065c57d63d415e8640693436c59d8380
BLAKE2b-256 82688c4dcfcfb07cea6b625d568859586f0561081c251d14be50ba431fe627d0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.21-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 094b9311bb6023be1422fe0ec5678d429cdb4224b7f924a49b13de5500ac529d
MD5 5c6dd81d7a93d7e481a619de079841ae
BLAKE2b-256 c2bd14cb84778458a62f3dcc4301b8a6f8b07e30a944fdcc97c808c41df86122

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.21-cp312-cp312-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 64d11e14ba620d3e3e0a697aa1cba0cd162acfc1b917c24fa6cc2cd0602912eb
MD5 5fda21fa0a01401d595e22d6cc5f3be1
BLAKE2b-256 15b957106b1c5b6b7f8a49bf48af62243a3efcf950e158d93ae0a109f80119aa

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