A Rust-based preconfirmation gateway that enables Ethereum validators to issue commitments for transaction inclusion. The gateway implements the Commitments API specification and integrates with the Constraints API for relay communication, providing near-instant preconfirmation responses to users while ensuring compliance with Ethereum's block construction requirements.
- Rust (latest stable version)
- Cargo
- Taskfile
- PostgreSQL 15+ (for database operations)
The gateway requires PostgreSQL for storing commitments, delegations, and slot metadata.
# Start PostgreSQL using docker-compose
docker-compose up -d postgres
# Set database URL
export DATABASE_URL=postgresql://postgres:postgres@localhost:5432/preconfirmation_gateway# Install PostgreSQL (macOS example)
brew install postgresql@15
# Start PostgreSQL
brew services start postgresql@15
# Create database
createdb preconfirmation_gateway
# Set database URL
export DATABASE_URL=postgresql://postgres:postgres@localhost:5432/preconfirmation_gatewayThe gateway uses SQLx for database migrations. Migrations are automatically run on startup, but you can also run them manually:
# Install sqlx-cli (one-time setup)
cargo install sqlx-cli --no-default-features --features postgres
# Run migrations
sqlx migrate run
# Check migration status
sqlx migrate infoNote: The DATABASE_URL environment variable must be set before running the gateway or migrations. You can also configure it in config.toml.
task buildtask runThis starts the RPC server on 127.0.0.1 with a random port and demonstrates client connectivity.
task formattask linttask testThe preconfirmation gateway implements a comprehensive system for Ethereum transaction preconfirmations:
- Commitments API: Implements 4 JSON-RPC methods (
commitmentRequest,commitmentResult,slots,fee) - Validator Integration: Issues commitments on behalf of Ethereum proposers
- Constraint Management: Creates and disseminates constraints to builders via relay integration
- Gas Pricing: Dynamic pricing using rETH gas oracle with configurable pricing curves
- First-Come-First-Serve: Ensures fair commitment dispensing with near-instant response times
- PostgreSQL Integration: Persistent storage for commitments, delegations, and slot metadata
- BLS/ECDSA Cryptography: Secure signature verification and commitment signing
- Slot Timing Management: 8-second constraint submission windows with automated scheduling
- Relay Communication: Integration with Constraints API for builder coordination
- jsonrpsee: JSON-RPC 2.0 server implementation
- tokio: Async runtime with multi-threading support
- deadpool-postgres: Async PostgreSQL connection pooling
- tracing: Structured logging and diagnostics
This project implements the following Ethereum preconfirmation specifications: