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

Uploaded CPython 3.12Windows x86-64

colibri_stateless-1.1.5-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.5-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.5-cp38-cp38-win_amd64.whl (418.0 kB view details)

Uploaded CPython 3.8Windows x86-64

colibri_stateless-1.1.5-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.5-cp38-cp38-macosx_15_0_universal2.whl (393.2 kB view details)

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

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5d41de10207be83a542acc6e83e9519f9edd85ad742470daf0a0568c06283261
MD5 eec0dd55b33cf72e18937ff29d17c36e
BLAKE2b-256 0d9482134fb55fe12b7cf551304b4b96c7ac308baa31b1370f37cbce35307173

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.5-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 57eb0b47782a3c56dccfa8c425b61f684443e9ae7ab6cdec0031d9a9420ee2a6
MD5 4720a2ddade43194d4540a595e7e59c7
BLAKE2b-256 0d0951c38ed4bdcec39267c92037c317b24177a5350e50d3716046146ea986b7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.5-cp312-cp312-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 9105ea22946204c6e3096d97450a2711c56ff738530e557dc0e7c74da6cae9b8
MD5 017f151e4124c46547b49d243a004baf
BLAKE2b-256 56c89ab2a9a2920569df2c2594895e185740316dc657844e4039343db8a3184b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.5-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 7f99b556965b21183e2fc073b80d842dd9cec6452e9d0dcf3f3d8e9ec6cfdc31
MD5 a3cbb076ab622bcad5dcaf64c02de6a4
BLAKE2b-256 86a2866fa3b8382fd587c1194f1e13905bcf54e84e5ea647f11e9c600a8ff78c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.5-cp38-cp38-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 d99fc9efbfee2df6bc06c5c576e0d5cdf7edb43e4920ad6c2e8db22147f345a2
MD5 bbf7c7a6bc99fd309cb72b119366dbd4
BLAKE2b-256 7f0a85db82df11e7b5a2bc6ced0c517cd026907c5cc315f62401df9ce0cfb1b0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.5-cp38-cp38-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 403dc5585bf0a6abd72f5424d2da93e2ae0666e40cb7eabf4506d2a3bc44931c
MD5 593185ca3bc3fb1626ccb4450e86215d
BLAKE2b-256 69c38ced53942bb22cc607640e118d3734dfca944642573b46c97151ca01def9

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