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.12-cp312-cp312-win_amd64.whl (438.1 kB view details)

Uploaded CPython 3.12Windows x86-64

colibri_stateless-1.1.12-cp312-cp312-manylinux_2_17_x86_64.whl (544.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

colibri_stateless-1.1.12-cp312-cp312-macosx_15_0_universal2.whl (411.1 kB view details)

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

colibri_stateless-1.1.12-cp38-cp38-win_amd64.whl (436.8 kB view details)

Uploaded CPython 3.8Windows x86-64

colibri_stateless-1.1.12-cp38-cp38-manylinux_2_17_x86_64.whl (542.5 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

colibri_stateless-1.1.12-cp38-cp38-macosx_15_0_universal2.whl (410.1 kB view details)

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

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.12-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 99445575c691c75f86ab12cf3f55719f648e099cc544a764f2e85f111be03619
MD5 e7db4abf22de99e4698ce74ab2a8f98a
BLAKE2b-256 45c327e2b6562fed2f61955a17d42ab0fed45b458cacf6b9ae0c08a79bad3fad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.12-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 9aa952ebc2024c3a8a22b58d07cc313c269342d923b22dba6a89d1dce893ce48
MD5 ddb4f52d4bf0ec386ecd8a57ee88c6e0
BLAKE2b-256 46b8551de3481e8784f0245f3baaf457870798c3974dfa2845bba3cc8f759762

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.12-cp312-cp312-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 3788ddc2045dfb5465eb7c142779ddbcd7018141fa957cfb084f1f5f0c7a3273
MD5 1ebed660782384c8e7976a761e0e3e06
BLAKE2b-256 99d37b9b05732f5808f69fec60ec3e7a2c74fca6318f45b15dd29893012dbeed

See more details on using hashes here.

File details

Details for the file colibri_stateless-1.1.12-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for colibri_stateless-1.1.12-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 fe7c18e8585fb6b5bafd6e3dc0b56b721cf03ae951edda81762f3583362e5c74
MD5 79f1235026b1ebe24aa52d14488a1942
BLAKE2b-256 3f7d417fc729edb223a3c31662a33842edae884d88e4c843559c06fc503fc527

See more details on using hashes here.

File details

Details for the file colibri_stateless-1.1.12-cp38-cp38-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for colibri_stateless-1.1.12-cp38-cp38-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 b5059f350366adf799b924bad96137bc95bbdc406f20edb0bbcf8a614857ea2e
MD5 a5fcb51df1f353848d7c94e31cbb9dad
BLAKE2b-256 1904da8451dc222cbaa36d261cb7c256a0d340f881e4b0f6c2356c7fed031db0

See more details on using hashes here.

File details

Details for the file colibri_stateless-1.1.12-cp38-cp38-macosx_15_0_universal2.whl.

File metadata

File hashes

Hashes for colibri_stateless-1.1.12-cp38-cp38-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 ebec38d3622dae839fbe5fdff01d78218da12e5f4fb3e8a0e6f5b2f811872102
MD5 350bb7aa6a8c088ffcc334172727986f
BLAKE2b-256 ccf1f4aced73a3adcf25f628625c2291f2a847c403b7e6b9f4158f83e598a19f

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