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

Uploaded CPython 3.12Windows x86-64

colibri_stateless-1.1.10-cp312-cp312-manylinux_2_17_x86_64.whl (532.1 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

colibri_stateless-1.1.10-cp312-cp312-macosx_15_0_universal2.whl (402.3 kB view details)

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

colibri_stateless-1.1.10-cp38-cp38-win_amd64.whl (424.9 kB view details)

Uploaded CPython 3.8Windows x86-64

colibri_stateless-1.1.10-cp38-cp38-manylinux_2_17_x86_64.whl (530.6 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

colibri_stateless-1.1.10-cp38-cp38-macosx_15_0_universal2.whl (401.1 kB view details)

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

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.10-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8cca122e727ddac05a15f07032518fe20f49e83f6b332c91389376115dbfcd2e
MD5 4ec20cc153c5fd391de30c580517db65
BLAKE2b-256 4cb2c845cb619b4b6d7ceeb82c9b70221904003443cd13a4a8e4fd3baa2bea02

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.10-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 47eff17172c89a6fcef608d21e9782043a0913a1adb0b005f136592bb33ad4ae
MD5 17541c396b027dc4f54408409f902783
BLAKE2b-256 13fccd5258b54968649dd2719ee5f085deb9a9d883120c8db1a283fb39c31562

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.10-cp312-cp312-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 b01b0a6ca0f108afaf39322d608f70ac34703cb342757eac6200d857873a9186
MD5 897239d0e6e8de86f750e764235373d9
BLAKE2b-256 2b50b8ebc8812fa9b4b70f677b31461c25ccb4148f9050a02cf0ea719d411329

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.10-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 0ff6a5363d1d080e204b3b1f9efc0236603b207aa0883704057aeb53f8f73474
MD5 e30c46b807e597fb831c7a9b9da16dab
BLAKE2b-256 44959fea2a06b15a2c1723b67fe5b6fbf7ebe97e3a8e2c048e8f1d8ba45eda90

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.10-cp38-cp38-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 7643a7284e7b592556af63170bea2c81cce83964f41a091a2e19b9ccf9570210
MD5 9af9bbc3ba190d823ed972210cafb275
BLAKE2b-256 b3f661fd7bc08388aaa2b4ed47e97121f6b63ae43937f8b4d335857e541f1215

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.10-cp38-cp38-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 7272f7ba942fc51e4987d3cc936c84fb04297700d8053317f7106bd422a2ef62
MD5 b2426d2ce7ac60286825bf9504cf83d2
BLAKE2b-256 e71ba21ca82067e85d30fb871a0d4af65222ff5d526afa065d8c5de68006c8ab

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