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

Uploaded CPython 3.12Windows x86-64

colibri_stateless-0.7.9-cp312-cp312-manylinux_2_17_x86_64.whl (494.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

colibri_stateless-0.7.9-cp312-cp312-macosx_15_0_universal2.whl (371.0 kB view details)

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

colibri_stateless-0.7.9-cp38-cp38-win_amd64.whl (376.3 kB view details)

Uploaded CPython 3.8Windows x86-64

colibri_stateless-0.7.9-cp38-cp38-manylinux_2_17_x86_64.whl (491.3 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

colibri_stateless-0.7.9-cp38-cp38-macosx_15_0_universal2.whl (369.5 kB view details)

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

File details

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

File metadata

File hashes

Hashes for colibri_stateless-0.7.9-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d7f2d2c7376474803af48022e63394cef4f991e89f65913541d222420fb4d455
MD5 1f32a6de8e6f21f4c7e127fa09474177
BLAKE2b-256 a8d20f830df37dc310b7ea142071d4c33639459d4f401fd2bca6bc96908ddb6e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-0.7.9-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 eb0b39e3213f8f8c02e851e4f646aceb528fa0c430d588c6d90fd3315e22065f
MD5 f72263736e46dcc1dcba20734f780b9d
BLAKE2b-256 d82377cde766986d1df427369220ef41edeeba2c0846a28aa3e17e6a0abc4a6d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-0.7.9-cp312-cp312-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 7192d09b4f6ac51650b4de6a0c7b3b72c78920706fba0721c8aa4d55c519aef5
MD5 4a1ea2cb8b1748beb99ada9325140649
BLAKE2b-256 b2270a8c328e37fa3020514c3fbe7b0832a8f0a29540361bf79e2c70f8250b38

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-0.7.9-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 9b76200fa59ef5b2236a9616b28b8054eed21723053eaefb8601337d59c8c84c
MD5 befde2c1e89ec73df3312335d8fcadd4
BLAKE2b-256 56a912b244095babb788cc0a102d794a7fc706b5e8e264d4ffbf52e1f820dfda

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-0.7.9-cp38-cp38-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 7a712a8275f1b73ab10fb145a0f270b235f828f625f29e7d7cdc3871048a7ff5
MD5 c3bb54b62952a356e355d9b597e95053
BLAKE2b-256 b7d530f304a0c05fcb09456110660daf2b247462539281cbc98d599ce071f238

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-0.7.9-cp38-cp38-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 6b4ef426218bf662ee9e02f93d37d7b89000d69472b951c979a5c9ce6e12f0c0
MD5 e29679533761f5b687a9d9aefb7550ba
BLAKE2b-256 da780048183f08d0c4289c54700301db1990414890c8a7f78bc66355125c004d

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