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

Uploaded CPython 3.12Windows x86-64

colibri_stateless-1.1.13-cp312-cp312-manylinux_2_17_x86_64.whl (545.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

colibri_stateless-1.1.13-cp312-cp312-macosx_15_0_universal2.whl (412.3 kB view details)

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

colibri_stateless-1.1.13-cp38-cp38-win_amd64.whl (438.3 kB view details)

Uploaded CPython 3.8Windows x86-64

colibri_stateless-1.1.13-cp38-cp38-manylinux_2_17_x86_64.whl (543.6 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

colibri_stateless-1.1.13-cp38-cp38-macosx_15_0_universal2.whl (411.2 kB view details)

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

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.13-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8edf551c17442b583fc144c13b514f2eb900630ab67b58f0c912257dee91b93f
MD5 a46cd98c2a89fefbf0335215d81a93e1
BLAKE2b-256 a03a7ffa40341d3875b4890cf559674c0a07b543cc35eb2b2615358cd2439923

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.13-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 cc2badec0d045220a1280068167ec1ab26551f7b6e71ff18c5b1778b7aec356a
MD5 f6b57ebdd87daac1322c509fcac36d53
BLAKE2b-256 16087906ce0f7f1ba44631bb3cf19b09aaafcecc612b061c67598da053aa4ec5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.13-cp312-cp312-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 0a7f4e59017c035a277d853bd7060fb7e17ae5b683d55057a7e98f4484169d15
MD5 77d128ed3beefeb262f269fcc625c2bc
BLAKE2b-256 2c0f3dc07b6438c0640e19efa4a097de9f93ba83359057c3214a9fb780b16056

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.13-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 c608221a2adeda22ef57993008778226ad44d27674ae997339bf305a41c83667
MD5 6dfc8acecdeeab4a66e5a2f832e9cb50
BLAKE2b-256 474d4ec7d52b02aa4a2ce3f7d9cb150d834ef2d790be5dbb0af2dfc44a52d01f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.13-cp38-cp38-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 d287e4b4c8c24f31193229884570acd2adcc537f0c38757dc13dfeba69a44e67
MD5 a8e8f229a8909635497a60b1b51c9792
BLAKE2b-256 5578bac591dea9195b255fccdf4dce4df02e9c5e185c01a5eb74253c42563c46

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for colibri_stateless-1.1.13-cp38-cp38-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 82d551af1068defcdda4a4e1d6f757a61150f70e2596bf4e7f55c9ad32b97825
MD5 4721e969ac26935458865cb7faf0d8ee
BLAKE2b-256 387d2c00bf62ce43be8cfa4d970219c0827731dc88697dfb52d5453ea66a1180

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