Dart

Dart FFI bindings for the Colibri stateless Ethereum proof library. Generate and verify cryptographic proofs for Ethereum RPC calls from Dart applications (CLI, servers, or desktop).

Overview

The Colibri Dart bindings provide an async Dart API that calls the Colibri C core via FFI. They are used both as a standalone package (colibri_stateless) and as the runtime behind the Flutter plugin (colibri_flutter). All RPC responses can be validated with Merkle proofs; ZK proofs are requested from remote provers when configured.

Core Features

  • Cryptographic verification – RPC results verified with Merkle (and optionally ZK) proofs

  • Async/awaitFuture-based API for RPC and proof operations

  • Pluggable storage – Implement [ColibriStorage] for custom cache backends

  • Multi-chain – Configurable chain ID, provers, eth Rpcs, beacon APIs

  • No Flutter dependency – Pure Dart; use from CLI or server

Architecture

┌─────────────────────────────────────────────────────────────────┐
│                     Dart Application Layer                       │
├─────────────────────────────────────────────────────────────────┤
│                   package:colibri_stateless                      │
│  • Colibri class (rpc, createProof, verifyProof)                │
│  • ColibriStorage interface                                      │
│  • Error types (ColibriError, ProofError, RPCError, …)           │
├─────────────────────────────────────────────────────────────────┤
│                      Dart FFI Layer                              │
│  • native/ (libcolibri.dylib / .so / .dll)                       │
│  • ColibriNative (load, registerStorage, createProverCtx, …)     │
├─────────────────────────────────────────────────────────────────┤
│                      Core C Libraries                            │
│  • Prover, Verifier, storage plugin system                       │
└─────────────────────────────────────────────────────────────────┘

Installation

From pub.dev (colibri_stateless)

You must build or provide the native library separately (see Building from source). Alternatively, use colibri_flutter for mobile/desktop with bundled binaries.

Development / from source

This produces a shared library in native/ (e.g. native/libcolibri.dylib on macOS). Set COLIBRI_DART_LIBRARY to its path, or pass libraryPath to the [Colibri] constructor.

Quick Start

Basic RPC

Local proof generation

Use empty provers and provide ethRpcs and beaconApis so the client can generate proofs locally:

API Reference

Colibri class

  • rpc – Executes an RPC call with proof generation and verification (remote or local). Returns the verified result.

  • createProof – Builds a proof locally (Merkle only; zkProof is ignored for local creation).

  • verifyProof – Verifies serialized proof bytes and returns the decoded result.

  • getMethodSupport – Returns whether the method is supported locally, only remotely, or not at all.

  • close – Releases native resources; call when done.

Constructor: libraryPath overrides the default native library (or use env COLIBRI_DART_LIBRARY). storage registers a custom cache; zkProof requests ZK proofs from remote provers when using rpc with provers. onDebug can contain sensitive data; do not forward to production logging.

Storage

Implement this to provide a custom cache backend. Default on desktop is native file storage; on Android/iOS the client uses [MemoryStorage] if no storage is given (native file storage is not used on mobile).

Configuration

Chain and endpoints

Environment

  • COLIBRI_DART_LIBRARY – Path to the native shared library if not passing libraryPath.

Error handling

Building from source

Native library output:

  • macOS: native/libcolibri.dylib

  • Linux: native/libcolibri.so

  • Windows: native/colibri.dll

Testing

Set COLIBRI_DART_LIBRARY if the library is not in the default path. Coverage: ./test/run_coverage.sh (output in test/coverage/).

Further information


Last updated