Project case study Personal project

Synapse.

Synapse is a financial infrastructure protocol and SDK engineered for the autonomous agent economy. Combining high-performance Rust services (Actix-web, SQLx) with Yellow Network's Nitrolite state channel protocol and Polygon Amoy smart contract custody, Synapse enables machines and users to stream gasless, sub-cent micropayments in real time—enabling pay-as-you-go AI model inference (e.g., 0.001 USDC per 100 generated tokens) without blockchain latency or transaction fees.

Role
Protocol & Backend Engineer
Domain
State channels · Machine-to-Machine (M2M) payments · Yellow Network Nitrolite · AI inference streaming · Polygon Amoy

System at a glance

What the system does

01

Gasless off-chain state channel streaming

02

Yellow Network Nitrolite SDK integration

03

Real-time pay-per-token LLM inference

04

High-throughput Actix Web & SQLx gateway

Architecture flow

From intent to verified state.

  1. 01

    A user or AI agent deposits funds into a Nitrolite smart contract custody on Polygon Amoy to open a state channel.

  2. 02

    During inference, the client signs off-chain cryptographic micro-payment commitments per token chunk.

  3. 03

    The Synapse Rust gateway validates each cryptographic state channel signature in milliseconds via Yellow Network nodes.

  4. 04

    Upon payment verification, the gateway streams LLM tokens generated by Ollama in real time back to the client.

  5. 05

    Channel balances settle off-chain with zero gas fees, requiring on-chain reconciliation only when closing the channel.

01 / State channel mechanics

Zero-gas, millisecond micropayments for machine communication

High-frequency financial settlement operating at the speed of data streaming.

01.1

Yellow Network Nitrolite protocol

Employs state channels to bypass blockchain block times and gas fees, allowing micro-transactions to settle at internet latency.

01.2

Off-chain cryptographic signing

Each micro-payment is an off-chain cryptographic state update signed by the client, eliminating transaction costs for sub-cent transfers.

01.3

Solvency and dispute protection

Balances remain secured by on-chain custody on Polygon Amoy, with deterministic dispute windows guaranteeing fund safety.

02 / Machine-to-machine economy

Financial sockets for autonomous software agents

Empowering AI agents to transact autonomously without human or credit card bottlenecks.

02.1

Pay-per-token inference

Demonstrates real-time AI inference where users stream fractions of a cent as text renders, paying only for the exact compute consumed.

02.2

Agent-to-agent resource trading

Provides a lightweight SDK enabling autonomous agents to purchase data, search APIs, and compute from other agents dynamically.

02.3

Eradicating subscription friction

Replaces rigid monthly SaaS subscriptions and credit card barriers with granular pay-as-you-go financial sockets.

03 / Gateway architecture

High-concurrency Rust and PostgreSQL pipeline

A resilient backend coordinating state updates, model generation, and ledger durability.

03.1

Actix Web streaming server

Manages concurrent client WebSocket and HTTP sessions, coordinating inference streams and payment checks without thread contention.

03.2

SQLx and PostgreSQL persistence

Records state transitions, channel events, and session histories with compile-time checked SQL queries and transactional durability.

03.3

Local AI model integration

Integrates with local Ollama runtimes (e.g., Gemma, Llama) to stream tokens with minimal latency overhead.

04 / On-chain custody

Trust-minimized settlement on Polygon Amoy

Smart contract custody enforcing fair exchange and capital protection.

04.1

Smart contract channel custody

Escrows collateral tokens safely in audited Nitrolite contracts on Polygon Amoy, enabling predictable deposits and withdrawals.

04.2

Multi-token payment support

Designed around flexible ERC-20 token interfaces allowing payment streaming in stablecoins (USDC) or custom protocol assets.

04.3

Graceful channel closure

Enables cooperative mutual closure with instantaneous payout settlement, or unilateral closure with provable timeout states.

Continue exploring

More systems, protocols, and practical tools.