04 — Infrastructure engineering
Cross-chain Deposit Infrastructure
Deterministic smart accounts, cross-chain transfers, durable workflows, transaction orchestration and recovery mechanisms.
- CCTPCircle's burn-and-mint protocol for native USDC transfers.
- SafeSmart accounts with deterministic deployment.
- BullMQDurable job queues with retries and backoff.
Overview
Cross-chain deposit infrastructure lets a user fund an account on one chain using assets that live on another — for example, moving native USDC from an EVM chain into the Injective ecosystem — without manually bridging, switching networks or babysitting transactions.
The problem
A cross-chain deposit is not one transaction. It's a sequence of operations across independent systems: deriving an account, approving tokens, burning on the source chain, waiting for an attestation, minting on the destination and crediting the user. Any step can fail, take minutes, or succeed while the process watching it crashes.
The system must guarantee that funds are never lost or double-credited, and that every deposit eventually reaches a clear final state.
Engineering challenges
- Deterministic accounts. Users need a deposit address before any contract exists, and the same inputs must always produce the same address.
- Long-running, multi-system workflows. Attestations can take minutes. Workers restart. RPCs time out.
- Exactly-once effects. Retries are inevitable; duplicate burns, mints or credits are unacceptable.
- Irreversible steps. Once tokens are burned on the source chain, rolling back is impossible — the only way out is forward.
Architecture
- Entry
- Deposit intentuser · amount · route
- Accounts
- Deterministic smart accountSafe · counterfactual address
- Orchestration
- Durable workflowjournal · retries · idempotency
- Job queueBullMQ · Redis
- Protocols
- CCTPburn → attest → mint
- Destination chain
- Recovery
- Reconciliationdetect & resume stuck runs
Key decisions
Counterfactual smart accounts
Deposit accounts are Safe smart accounts with deterministic addresses: the address is computed from known inputs before deployment, so a user can receive funds immediately and the account is deployed only when needed.
A journal, not a script
Each deposit is a durable workflow. Every step's result is persisted, so a crashed worker resumes from the last completed step instead of starting over. Steps run with idempotency keys, so a retry can never duplicate an on-chain effect.
Compensate before the point of no return, recover after it
Steps before the burn can be compensated (release a quote, revoke an approval). After the burn, the workflow can only retry and resume — failures there park the run for recovery rather than rolling back.
Patterns
- Saga pattern with compensations
- Idempotency keys for exactly-once effects
- Persisted workflow journal with resume
- Counterfactual (CREATE2-style) deployment
- Reconciliation jobs for stuck or parked runs
My contribution
I designed and built core parts of the orchestration: deterministic account derivation, the durable workflow and transaction orchestration layer, and the recovery mechanisms that bring interrupted deposits to a final state.