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

Uploaded CPython 3.12Windows x86-64

colibri_stateless-0.7.4-cp312-cp312-manylinux_2_17_x86_64.whl (489.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

colibri_stateless-0.7.4-cp312-cp312-macosx_15_0_universal2.whl (366.4 kB view details)

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

colibri_stateless-0.7.4-cp38-cp38-win_amd64.whl (372.0 kB view details)

Uploaded CPython 3.8Windows x86-64

colibri_stateless-0.7.4-cp38-cp38-manylinux_2_17_x86_64.whl (487.0 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

colibri_stateless-0.7.4-cp38-cp38-macosx_15_0_universal2.whl (364.9 kB view details)

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

File details

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

File metadata

File hashes

Hashes for colibri_stateless-0.7.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 12e868cc1fca543933cf1aceb3e39eff2a4af3c10319b2df8fca0643b1ad82aa
MD5 34d43f7bcdcade71ca3cd654b16c5706
BLAKE2b-256 5ab094483edd8490dd548054155940433558d9010a89090e4a6f008bbd7a4976

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-0.7.4-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 37810c2f8e102ee2037c4926031737461c58750c018c1514899168c71ec3fbb1
MD5 cb0a3542b745a9dfaf3ef9b1d089f9ee
BLAKE2b-256 cdf0e26dc72e9c6ccc1dc5fffe12afbe739da45d1c6d6406780b9c1aa5f524ac

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-0.7.4-cp312-cp312-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 eae74caca36b543963b739f430271027f2dd2ed94f6756389e5488b6e2cf019f
MD5 c9cdc61db87da9f6288adc2d586feae2
BLAKE2b-256 49e02b02973d2fa081e6f62863243dd818df5e54ef9c98bfc6e84cd494b5d9ab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-0.7.4-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 22787e608e7c7166fd68e70405ad7c6b65b39a4d3f91e8b447cf0f41197c4ba3
MD5 4f3ad39723b869e08c3e9b3bc0fd4e00
BLAKE2b-256 048a82b41a0443550f0ff0f4175b57cb58c84666cfbcf8e642adf073fff2a020

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-0.7.4-cp38-cp38-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 d2e844b39e27d65d72b63720b4a5106b92f511862ae4ff43db922ac04aa94374
MD5 79ac1267f288a4c0edc05445b11a170e
BLAKE2b-256 c11f3f6df107e5f2cc88b2398854579604708e3b563602dbc2c92d617b887cb8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-0.7.4-cp38-cp38-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 f95bb6c47e728bf238850678339547eb998ebcc6809c5da00c9c369906bb4cd3
MD5 bc564fa3c9503cc8952e71f64216d48a
BLAKE2b-256 a1157cb88cdfcc486c5719cb3eb856cfde6814a506f75774f8871f1609c93b43

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