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

Uploaded CPython 3.12Windows x86-64

colibri_stateless-1.1.8-cp312-cp312-manylinux_2_17_x86_64.whl (524.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

colibri_stateless-1.1.8-cp312-cp312-macosx_15_0_universal2.whl (395.3 kB view details)

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

colibri_stateless-1.1.8-cp38-cp38-win_amd64.whl (418.5 kB view details)

Uploaded CPython 3.8Windows x86-64

colibri_stateless-1.1.8-cp38-cp38-manylinux_2_17_x86_64.whl (521.8 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

colibri_stateless-1.1.8-cp38-cp38-macosx_15_0_universal2.whl (393.8 kB view details)

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

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.8-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 c5206ceadc244a544e3e23c85cbe747588921121f942fddb7a60a948e7787d71
MD5 9698e43a219c788c0d0273ee15056bf7
BLAKE2b-256 d17c5df24c19845b056d95c102dc357c6fb9333af9a25ae55d8b0b5b1f4bcc3d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.8-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 3a3a074184ce25d2063a1009bf66cf50fc4d557b9ea22fded6da4ae70684298a
MD5 d67954629ad96831c146cfcd3d5ac969
BLAKE2b-256 406664b920ea19c64c58673fc81a13c4b6edeb5d6dab2ae3d1f83d69798eb7fb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.8-cp312-cp312-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 d5b1b276c7f28ca9bb7a6eec5d5da733c80ab2a22787ace3f104dee50bcd2671
MD5 718a25b510041e2cd3c9f2fc9d459947
BLAKE2b-256 72dc8ab68a7d126d081c3f6ea922a8684f0f1b10710fd3bbb6da3e336250b561

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.8-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 72716229d8c7f30dfdda68e069c4684f567e4918be365561cd68456a5dc05618
MD5 a0a317aa4dd170ff4037180dc0a88420
BLAKE2b-256 fb945afa1e823ea3a73aab7157302af14d07a8cb1f2e6faeb94a60890fbc7cb4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.8-cp38-cp38-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 eb15b25319110e86f04c665c0b68a67eea2c6b0ee97d82cf41f0d522cb58ecd0
MD5 1e712f6799c3f4840034b612da0c73ab
BLAKE2b-256 991c7ef64e00acbf1a840044be1fa06e3dfd7e6d4cb6fd330a4eb9f106f650b8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.8-cp38-cp38-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 9cbe364f3467c26e30ce7f5dbc013954031f8d16e84c928dfe8f73c64bec417c
MD5 5afe9773136e7e1d78c38cf8d18efaa5
BLAKE2b-256 1238c77c5ae0ae9384fa881c9ddf56bc9344e890f062b396a76440c125929087

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