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

Uploaded CPython 3.12Windows x86-64

colibri_stateless-1.0.1-cp312-cp312-manylinux_2_17_x86_64.whl (496.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

colibri_stateless-1.0.1-cp312-cp312-macosx_15_0_universal2.whl (372.8 kB view details)

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

colibri_stateless-1.0.1-cp38-cp38-win_amd64.whl (376.3 kB view details)

Uploaded CPython 3.8Windows x86-64

colibri_stateless-1.0.1-cp38-cp38-manylinux_2_17_x86_64.whl (493.5 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

colibri_stateless-1.0.1-cp38-cp38-macosx_15_0_universal2.whl (371.3 kB view details)

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

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.0.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 597d99a248ada4eae126b38808374447e8e108ed4209f94361a10a33b2e347ec
MD5 d2642677c410f6c0724ba0dc32a425ab
BLAKE2b-256 a411d4f02e9c9a667c6020a35d8560ffa4ae8e9faec1d8ceb362ca9a1f287d7c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.0.1-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 5deebb1ba3efab478530fbd80eb5180e4945f67fb61dfd9ecc96e1d52c54d9e6
MD5 b608f6db39b4a2418ef7f3859b228a1b
BLAKE2b-256 db75c66322c7d17c287195b11657e4381b29c3f81191dc69c7fa7e3581f03f20

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.0.1-cp312-cp312-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 dbcde75840c7a827eddce6d017368e962550267822588ed1ca4a9aaa06814ab0
MD5 c25f56807ad85fd873f9b1c9ca8f0ddb
BLAKE2b-256 d28ccaee3cdaf0f1b4eb3d6cd456baef1201f3f55541fed9c500194b9ddf9470

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.0.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 bdabf6ba7b719d356c26927d56e282d9f25996da6ff46715e8c460eef3a57cf2
MD5 1ca06da1b8e98f0b9e50927bc786bdff
BLAKE2b-256 582547dd90ba32040d56378d2eeb84356724da29d5cf3abd8348a9393cd81206

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.0.1-cp38-cp38-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 4ce0d81e2fd21d63a9bd4d813bdad7cf31ea3d8ada71e31df488af892b0a97aa
MD5 ac41612287bd6bc2c889126a8762253f
BLAKE2b-256 d5f9659a0b89e463f8f9e8875627626eca2b935914f48e610633e4137d54d938

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.0.1-cp38-cp38-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 6af695bf5fe659b90dfb818f94f9b118bc859d381f4de49091c690f31eb24abb
MD5 dbe5f5b0355d32e803355a01e0088a35
BLAKE2b-256 1bb8ef8a5413cdb594e56ad28302548d7a771cc91d74da4a9e6e968640c75c91

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