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
  • 🔒 Privacy (PAP) - Optional Pragmatic Adaptive Privacy mode (privacy_mode=PrivacyMode.BASIC) to reduce intent leakage

📖 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.16-cp312-cp312-win_amd64.whl (445.2 kB view details)

Uploaded CPython 3.12Windows x86-64

colibri_stateless-1.1.16-cp312-cp312-manylinux_2_17_x86_64.whl (557.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

colibri_stateless-1.1.16-cp312-cp312-macosx_15_0_universal2.whl (420.1 kB view details)

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

colibri_stateless-1.1.16-cp38-cp38-win_amd64.whl (444.2 kB view details)

Uploaded CPython 3.8Windows x86-64

colibri_stateless-1.1.16-cp38-cp38-manylinux_2_17_x86_64.whl (555.5 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

colibri_stateless-1.1.16-cp38-cp38-macosx_15_0_universal2.whl (419.1 kB view details)

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

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.16-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 2bb11bc8be2aac5e8db35e366d549b095e17c9c893872cc4fbc12ed6da58948c
MD5 0ac8dfbf8ac42724277362cecafb5cec
BLAKE2b-256 3ebb92c347ce475d1d179ba58d30935d9dd150b12980e439a3ccc138b1eb3238

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.16-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 3cf0f293239358269c564fc45492b025eb22d5a6f9f7d299dacfdbdd7a159f4e
MD5 9729066d76fa73f8cd261fe85d96cbd1
BLAKE2b-256 f798510744c438057631da1b987f0517f4aeb4be91fafd4e0fec8d3ee2af5352

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.16-cp312-cp312-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 4964be1b4b73d33fc6052b2fff8d38774aead8015a1fde8bbeafd06130f297a7
MD5 4f914962160e9a0b17f41922339e38ab
BLAKE2b-256 ab5345349e8a3d444a09296ea82204b11ab9eca43c6b15cdb541e2178f63dd9b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.16-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 20c21a3e562c0006d9c2400e022b4a5c2a47f08bc7b25017a23b395d0cf402cb
MD5 416a245a0e5ab8602043d29644e79742
BLAKE2b-256 6f9a4dc3c31c0a25997e47c95bb6906c0ba512aa82e82b834262b1cd133430b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.16-cp38-cp38-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 0de984442ed75c5f5b9d44df447333ad9c3451d214e755465dd123ef2b71287d
MD5 637a8777bb2f7997c0bca8d5d3201904
BLAKE2b-256 d825c2eb966f75943eaa6679258e6e174bfeed2ff9b66d2ead7ae1fbaa50e3ba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.16-cp38-cp38-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 e27b2a43362220f58d01b1086e062ccf9b902a0d501fe093906e65a53d4953a6
MD5 987e3a57311eea63efa53403480bd8e9
BLAKE2b-256 018f4206f1aa99beb865a1713ffb07f67d4e945307dccba0bef240c6d27d629c

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