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.19-cp314-cp314-win_amd64.whl (458.5 kB view details)

Uploaded CPython 3.14Windows x86-64

colibri_stateless-1.1.19-cp314-cp314-manylinux_2_17_x86_64.whl (558.5 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

colibri_stateless-1.1.19-cp314-cp314-macosx_15_0_universal2.whl (421.5 kB view details)

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

colibri_stateless-1.1.19-cp312-cp312-win_amd64.whl (446.6 kB view details)

Uploaded CPython 3.12Windows x86-64

colibri_stateless-1.1.19-cp312-cp312-manylinux_2_17_x86_64.whl (558.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

colibri_stateless-1.1.19-cp312-cp312-macosx_15_0_universal2.whl (421.3 kB view details)

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

File details

Details for the file colibri_stateless-1.1.19-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for colibri_stateless-1.1.19-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 2b37eb965fce15bce7c67556cbf9df91c04031c0e5dfab5560e8a9395eb2e6d3
MD5 fb5ddcf917f9bef3b864a184b1b05b6c
BLAKE2b-256 add3768a529baab181b7841d727a9b0a48d06c958b430cb7cabe71ff627ec6fa

See more details on using hashes here.

File details

Details for the file colibri_stateless-1.1.19-cp314-cp314-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for colibri_stateless-1.1.19-cp314-cp314-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 f939d44918a5a4835997fe7767bf748cd238244a90b718ecad25d054d7809865
MD5 f94483c452ad34f5d336dd13e86fc467
BLAKE2b-256 7645bb8f08b4097fa63017a276333008b0313821e5a919ceca64c205e9bce24c

See more details on using hashes here.

File details

Details for the file colibri_stateless-1.1.19-cp314-cp314-macosx_15_0_universal2.whl.

File metadata

File hashes

Hashes for colibri_stateless-1.1.19-cp314-cp314-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 b9c7d1ea7a1a295276db504e65055860ad192c7d433ecddcafd0f7639d316c3a
MD5 f7e854b8eb020739c18a6d400c7a23b6
BLAKE2b-256 2bdfd419c75010c5fdf6d733b3d33807ef5db19cae3c1e465b934805a673acab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.19-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 acccac42688a8e3b13cda0c901a4908d060601c589795c149710c2063f7237b7
MD5 1fd2e59606babb60940f67c1200d5388
BLAKE2b-256 4d0bf5955fad6779feaa371bb8934ef832bd9cee9b2e68711e6e7b313407e22e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.19-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 3d9e199a7e145896a11958155eca7010d0187001e5cc840ab877ca182c1740b1
MD5 faa64f91393b94529672ac7966df718b
BLAKE2b-256 dfd358187f4cf83829920e5c64e73a445b1f351a4a0f41d74b647072e95a4387

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.19-cp312-cp312-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 ed5b420c9d033fdcd4a68a61e626d9326fb2acd3e2b8280367aebd47333cc5b6
MD5 f390c1120df25a0d1c746e9fcb89a9fc
BLAKE2b-256 c97eb81121d43a8656170dc51b649f76ce9e8c9fec644224174ae43ca8734420

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