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

📖 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.3-cp312-cp312-win_amd64.whl (420.0 kB view details)

Uploaded CPython 3.12Windows x86-64

colibri_stateless-1.1.3-cp312-cp312-manylinux_2_17_x86_64.whl (523.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

colibri_stateless-1.1.3-cp312-cp312-macosx_15_0_universal2.whl (394.6 kB view details)

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

colibri_stateless-1.1.3-cp38-cp38-win_amd64.whl (418.3 kB view details)

Uploaded CPython 3.8Windows x86-64

colibri_stateless-1.1.3-cp38-cp38-manylinux_2_17_x86_64.whl (520.9 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

colibri_stateless-1.1.3-cp38-cp38-macosx_15_0_universal2.whl (393.2 kB view details)

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

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8b4473237995a00f817f3fff9c1657711ba5ce96b0a2e8c331280f4186f1a35e
MD5 481f4471dc8da2b89b4c1daa8294eb9a
BLAKE2b-256 12f646a486838f990b557cc30d40bc6d991947e2b594533a979be57c14b8d86a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.3-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 0b5424d96044c7a4ef1bbcc7d19dba4c3905de31f6f42f2e5d32f4357dfe4576
MD5 a6409c55e292103d7282f71f4b798f89
BLAKE2b-256 a13af67ec811ffe65462c344417371b7f12191b79492304553f3bd3f08e140f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.3-cp312-cp312-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 5e794c3eea63f02ec7befec552ced19c379f98e83a37a40605110cf86cee3a2b
MD5 d89cd3753b2374979c818190798aee89
BLAKE2b-256 47c4f90c6685d38f62e6aa197d0e2777a4dcb4d33bf464fcde556dc484d00743

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.3-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 f70c10ca2d7a6c39c019fad91a47a074bc5371d123b390d517ca46beec20a7ab
MD5 2a7de30d49cfc24e60fbc82139fd03aa
BLAKE2b-256 11aa466178e8d13026fa010d4f1ba488c94fc06d250a1f18c65caf8c6832df42

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.3-cp38-cp38-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 9fd2507cdd311b2a2ea2ebe7846f1d07b0f06916997a5cdc366052425adc77cf
MD5 18b8adbab3c97b548800689ca8adae0c
BLAKE2b-256 b56c6f5272665af85d933d299063f8a3b7e3e133ab1198f03e8b0d02e7f3297a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.3-cp38-cp38-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 b49d63625c82eabe7e49dab6fb515a9215c02566b0d56f14a1cebf8ad9958dd1
MD5 b00e4d04507b206b36c0dda61edbb4b2
BLAKE2b-256 84bccbaf9e9cb92b6f1a1d88f9460e549d7d0bb2ec75efb67b80ab6ef4dae021

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