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

Uploaded CPython 3.12Windows x86-64

colibri_stateless-1.1.6-cp312-cp312-manylinux_2_17_x86_64.whl (524.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

colibri_stateless-1.1.6-cp312-cp312-macosx_15_0_universal2.whl (394.8 kB view details)

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

colibri_stateless-1.1.6-cp38-cp38-win_amd64.whl (418.1 kB view details)

Uploaded CPython 3.8Windows x86-64

colibri_stateless-1.1.6-cp38-cp38-manylinux_2_17_x86_64.whl (521.2 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

colibri_stateless-1.1.6-cp38-cp38-macosx_15_0_universal2.whl (393.3 kB view details)

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

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.6-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 011e0d7e5829659885c2e42b482269f4397b505dfd1ea454705fc3a19be8f15f
MD5 e88081cad31ca354f49717c201331950
BLAKE2b-256 cc4aef5f100f23b0316fa552876b2f672943eadb79a603694fc5e7839bbd3f88

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.6-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 28f7ad90bc751beeaef622e9d6b473f395f14040b25a26b16c128ada1d1a23a1
MD5 9a5ca9f3d0bf71177a8bbe24e1aeaf4e
BLAKE2b-256 125f01d3a7d1880f8d71ff9160703b2ca159a855213f3b88d33ab42deed92bba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.6-cp312-cp312-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 2ad5a15ffce9611cc9c448492b76bdb9bd791d9eb68cad209cb19ca6a337b13d
MD5 4a8b0857bc8c3bfaf04b5cbf6c88922e
BLAKE2b-256 58afb61f46c4823e430a3d7fc2fb570254a6ea0b21d115962f9343a706981fee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.6-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 8dc63e65b20d5384a7c7498195b6d56b73b8e931289588a7cebdb9ecde5d1062
MD5 0609deba54eb0f36f682794185460e57
BLAKE2b-256 3f1be83427a2611e298340c70d577dc4bb6ff3acd2872c9c95686552231a86b2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.6-cp38-cp38-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 b4fc3d47c008ae19bccf80d372b41ceec00ae3d31d4f4b07387ddd01cf5d3463
MD5 52a149ef203f158bc87e8053312df2ff
BLAKE2b-256 bf26ce6f3352552e14fa19812ce5fd2b8f4bbfd025425547d786ba7c5f997369

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.6-cp38-cp38-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 b2589ff1074aa07cd4f42b84dff2499f23ed07e14a4265c3e46fc57721df5d4c
MD5 f25a4aa5754a773fe2b56cbdc22af0c2
BLAKE2b-256 035c3e63c65345774ce921d39e4bce6cb2921589c28d537c9f7e17786b30df67

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