0xShikhar
Projects

ChainPay

On-chain payouts where the books and the chain never disagree.

ShippedCode

Zero-Drift Ledger

  • Engineered for zero balance drift across on-chain transfers and internal balances
  • Atomic batch dispatch saving up to 40% in transaction gas fees

# What it is

ChainPay is an enterprise Web3 settlement engine built on Java 21 and Spring Boot 3.3. It combines strict double-entry ledger accounting with atomic EVM batch transaction execution and automated reconciliation.

# Why it exists

Web3 payment systems frequently suffer from balance drift between off-chain database records and on-chain transaction outcomes during RPC timeouts or chain reorgs.

# How it works

A Spring Boot service posts every money movement as immutable double-entry journal lines guarded by mathematical parity invariants, then dispatches atomic EVM batch payouts via Web3j with dynamic gas replacement. An on-chain event reconciler continuously closes the loop between ledger records and chain state, with idempotency keys making every retried dispatch exactly-once.

# Decisions worth explaining

  1. 01

    Immutable double-entry journal as the only balance source

    Mutable balance columns drift under retries and reorgs; journal-derived balances make every state reconstructable and auditable.

  2. 02

    Atomic batch EVM payouts with dynamic gas replacement

    Per-payment transactions waste gas and straggle under congestion; batching cuts gas spend ~40% while replacement keeps inclusion latency bounded.

# Details

  • Zero-drift double-entry ledger enforcing strict debit/credit mathematical parity
  • Atomic batch EVM payout dispatch via Web3j with dynamic gas replacement
  • Automated on-chain event reconciliation and idempotency keys
  • High-concurrency PostgreSQL transaction locks with optimistic retry handling

# Built with

Java 21/25 · Spring Boot 3.3 · Web3j · PostgreSQL · EVM Settlement