# Case study: a stablecoin on/off-ramp built in four weeks | tracee

> How we built and tested a EUR to USDC on/off-ramp: DFNS orchestration and MPC custody, Swan, Circle, Sumsub, OpenSanctions, a back office and 10 real testnet orders.

Source: https://traceegroup.com/case-studies/stablecoin-onoff-ramp

---

# A stablecoin on/off-ramp, built and tested in four weeks.

EUR in, USDC out, and back again, on Stellar, Ethereum and Solana testnets. DFNS orchestrates every transfer and keeps the keys in MPC wallets. Swan runs the bank side, Circle supplies the liquidity, Sumsub and OpenSanctions run compliance. One back office reconciles every coin.

- OpenSanctions

- 10orders completed end to end, 8 buys and 2 sells

- 22sfrom bank payment matched to coins confirmed on chain

- 2sfrom deposit confirmed to SEPA payout settled

- 0reconciliation breaks on 5 December, 22 balances checked

- 327.51USDC delivered on chain through DFNS, in 8 transfers

- EUR 231.46paid out by SEPA through Swan, for 260.01 USDC received

- 30nightly reconciliation runs. Every break traced to a real movement.

- 8,183audit log entries, hash-chained. The chain verifies.

- 65automated tests, about 37,000 lines of TypeScript

## Most ramp demos stop at the happy path.

A quote, a payment, coins arrive. The hard part sits behind it. Who holds the keys. Where the float comes from. How a bank payment finds its order. What happens when a customer forgets a memo. Whether the books still match the chain a month later.

We built the whole loop on testnets to answer those questions with working software and real transactions. It is our own build, run the way we run a client engagement.

## Five decisions before any code.

Every ramp sits on the same five decisions. They set the architecture, so we took them first.

- 01LicenceWho owns the licence?

- 02ArchitectureBuy, build or embed

- 03PartnersKeys, liquidity, bank, compliance

- 04ProductWho it serves, whether it holds balances

- 05Business modelSpread, commission or revenue share

- Web app

- Mobile app

- Embedded API

- Circle CPN

- Stellar anchors

- Fireblocks Network

- Borderless

OAuth, email, OTP, wallet connect

Policies, roles, limits, approvals

- Quote

- ›

- Check

- ›

- Execute

- ›

- Settle

Every balance, fee and obligation

Reconciliation, reporting, audit

- Decision

- Our answer for this build

- Licence

- None for the sandbox. A live EU launch needs a MiCA authorisation, ours or a partner's.

- Architecture

- Build the core: orders, ledger, treasury, compliance logic, back office. Buy custody, banking, liquidity and screening.

- Partners

- DFNS, Swan, Circle, Sumsub, OpenSanctions.

- Product

- Buy and sell for individuals, plus a widget and API for partners. Coins go straight to the customer's own wallet. No customer balance is held.

- Business model

- Fee by payment method (1% bank transfer, 3.99% card, EUR 1.99 minimum), 0.30% spread on the mid rate, optional partner fee on widget orders. Sandbox defaults, set in the back office.

## We built the core. We bought the rest.

Three front ends share one core. The core runs on Cloudflare and owns orders, the ledger and every decision. Each partner does one job behind it.

Banking as a service

Mint, liquidity, CCTP rebalancing

KYC, KYB, KYT, Travel Rule

AML screening via API

- Role

- Partner

- What it does here

- On 5 Dec

- Orchestration

- DFNS

- Builds, signs, broadcasts and tracks every transfer we request by API, with a webhook for every wallet event

- Live on testnets

- Custody

- DFNS

- MPC wallets. Our app never holds a key.

- Live on testnets

- EUR bank

- Swan

- A virtual IBAN per customer, SEPA in, SEPA Instant payouts

- Live in sandbox

- Liquidity

- Circle Mint

- USDC and EURC float, withdrawn to our hot wallets

- Live in sandbox

- Cross-chain USDC

- Circle CCTP V2

- Moves USDC float between networks

- Adapter built

- Compliance

- Sumsub

- KYC, KYB, wallet and transaction monitoring (KYT), Travel Rule

- Live

- Person screening

- OpenSanctions

- Sanctions and PEP check on every approved customer

- Live

- Wallet screening

- OFAC SDN list

- Every destination and deposit address

- Live

- Sign-in

- Better Auth

- Email and password, Google, SSO, TOTP, passkeys

- Live

- Infrastructure

- Cloudflare

- Workers, D1, Workflows, cron

- Live

- Every provider sits behind a port with a mock twin.One interface per capability, a mock that behaves like the real thing, and a live adapter that switches on when its key is set. The full flow ran on mocks on day one. We changed KYC provider on day three without touching the order flow.

- Every order is a durable workflow.A Cloudflare Workflow runs each order. It sleeps while it waits for a bank or chain event, and resumes where it stopped after a restart.

- The books are double-entry.A database trigger rejects any journal entry that does not balance per currency. Entries cannot be edited or deleted.

## Two real orders, step by step.

Every order goes through the same four moves: quote, check, execute, settle. Below are the first live buy and the largest sell, with the timestamps from the database.

- 11:57:26 UTCQuotetraceeMid rate from the ECB, spread and fee applied, quote locked.

- Before paymentChecktraceeKYC tier and limits, destination wallet screened, Travel Rule record written.

- 11:57:34PaySwanSEPA transfer to the customer's virtual IBAN, matched by IBAN and reference.

- 11:57:35ExecuteDFNSDFNS signs and sends the USDC from our Stellar hot wallet.

- 11:57:56SettleDFNS, ledgerThe DFNS webhook confirms, the ledger posts, the order completes.

- 17:49:24 UTCQuotetraceeThe order asks for an exact amount, 250.0077 USDC. The last four decimals identify the order.

- 17:51:07DepositDFNSThe customer sends to our Stellar hot wallet. DFNS reports it, the app matches it to the order.

- On depositChecktraceeSending address screened, Travel Rule record written.

- 17:51:09PayoutSwanSEPA Instant payout of EUR 224.53, consent signed by our server.

## DFNS moves the coins. We never touch a key.

DFNS does two jobs. Its orchestration layer builds, signs, broadcasts and tracks every transfer the app asks for. Its custody layer keeps the keys in MPC wallets. Our app asks DFNS to send, and DFNS tells us what landed.

- One service account signs every API call with its own key, kept in Cloudflare's secret store.

- One hot wallet per network, created by our bootstrap through the API. On Stellar, the bootstrap funds the account and opens the USDC and EURC trustlines, one DFNS signature each.

- 84 webhook events received and verified: every deposit and every transfer status.

The 10-wallet limit changed the design. The DFNS trial allows 10 wallets per organisation. A deposit wallet per order would have run out within days, and every deposit wallet needs its own gas to sweep coins on. So sells pay the hot wallet directly and are matched by exact amount, and by memo on Stellar. No deposit wallets, no sweeps, no gas to manage.

Two things we hit. DFNS's firewall rejects requests with no User-Agent, and Cloudflare Workers send none: one header fixed it. Two Stellar transactions sent back to back from one wallet fail on sequence numbers: the bootstrap now waits for each one to settle.

## One back office for every coin and every euro.

Staff sign in with a second factor, TOTP or passkey. Settings changes and treasury sends go through approvals: a second person in production, self-approved and logged in the sandbox.

- Section

- What staff do there

- Overview

- Orders, float and open cases at a glance

- Orders

- Every order with its timeline, screening and Travel Rule record

- Customers

- Identity status, risk, wallets, banks, AML results

- Cases

- Screening hits, suspense and reconciliation breaks to clear

- Transactions

- Every chain and bank transfer, both ends named. Unmatched deposits settled here.

- Treasury

- Balances per wallet, on chain against the books, float rules, send from treasury

- Ledger

- Accounts and sealed journal entries

- Reconciliation

- Nightly and on-demand checks, with every break listed

- Partners

- Partner accounts, API keys, fees

- Providers

- Which adapter runs live and which runs on its mock

- Settings

- Pricing, limits, compliance switches, treasury rules

- Audit log

- Every action, hash-chained, with a verify button

- Outbox

- Every email the system sent

## Real tests, real transactions.

Every completed order below is a testnet transaction you can open in a block explorer.

- Date

- Order

- Paid

- Received

- Network

- Transaction

- 8 Nov

- Buy, SEPA

- EUR 10.00

- 8.905245 USDC

- Stellar

- ed9aff…18be

- 8 Nov

- Buy, SEPA

- EUR 5.00

- 3.339466 USDC

- Stellar

- aadd7e…1ceb

- 8 Nov

- Buy, card

- EUR 10.00

- 8.905245 USDC

- Stellar

- ca95a9…0a65

- 8 Nov

- Sell

- 10 USDC

- EUR 6.93

- Stellar

- 8f8fe9…5318

- 13 Nov

- Buy, SEPA

- EUR 5.00

- 3.314340 USDC

- Stellar

- fd665f…0d7d

- 20 Nov

- Buy, SEPA

- EUR 250.00

- 270.640513 USDC

- Ethereum Sepolia

- 0xd8834b…3e44

- 20 Nov

- Sell

- 250.0077 USDC

- EUR 224.53

- Stellar

- 5e13f0…6e15

- 30 Nov

- Buy, SEPA

- EUR 15.74

- 15.009864 USDC

- Stellar

- f841a4…e5cc

- 30 Nov

- Buy, SEPA

- EUR 10.00

- 8.739368 USDC

- Stellar

- 380bb0…623f

- 3 Dec

- Buy, SEPA

- EUR 10.00

- 8.658819 USDC

- Stellar

- 422298…1233

Treasury float came from Circle Mint, withdrawn to our Ethereum hot wallet on 20 November: 8,892.39 USDC (0x3f9168…4bdb) and 7,000 USDC (0xf4ffa5…7d57).

We tested the paths that go wrong, too.

- A refund. A EUR 50 buy was returned, and Swan paid the money back by SEPA.

- A forgotten memo. A customer's first transfer on Stellar had no memo. The app kept it as unmatched, opened a suspense case, and staff settled it from the Transactions page.

- No float. A card buy came in while the Stellar hot wallet was empty. The order waited for liquidity for 20 minutes and delivered once the wallet was refilled.

- A screening hold. A USD buy is held at screening for review. Nothing moves until staff clear it.

- No deposit. Three sells expired after an hour with no coins received.

## Reconciliation told us the truth.

Every night at 03:17 UTC, the app compares each hot wallet's balance on chain, Circle's balance and the bank with what the books say. Any difference opens a case.

The breaks were not bugs in the order flow. Each was a real movement the books had not recorded:

- Faucet top-ups to the Stellar wallet, sent before the app kept unmatched deposits.

- 7,000 USDC sent to Circle straight from the DFNS dashboard, outside the app.

- Circle's opening balance of 8,892.39 USDC, never booked.

- A 100 USDC cross-chain transfer from Stellar to Ethereum that arrived as 99.944839 USDC after fees.

On 5 December each one was booked with a sealed correcting entry. The 12:22 UTC run checked 22 balances and found 0 breaks.

A custody provider's dashboard is a second door into your treasury. Restrict who can use it, and rely on reconciliation to catch what goes through it.

## A new DFNS organisation, in one day.

On 5 December the DFNS trial organisation was two days from closing. We moved to a new one the same day, with no code change.

- New organisation, a service account with the same signing key, an admin role and a webhook. Two secrets updated.

- The bootstrap created three hot wallets through the API and prepared the Stellar account: XLM, then the USDC and EURC trustlines.

- Balances moved from the old wallets to the new ones: 7 transfers.

- Old wallets retired in the books, six sealed entries posted, reconciliation run.

20,433.9 USDC and 100 EURC across three hot wallets. The books equal the chain on every line.

## What is not done yet.

- No licence. Testnet coins and sandbox bank money only.

- Card payments use a sandbox acquirer until Swan opens card acquiring on the project.

- USD runs on a sandbox bank. Swan is EUR only.

- Automatic rebalancing from Circle is blocked by an address book error on Circle's side. The hot wallets have to be registered in the Circle console first.

- One buy waits for a refund. It was placed on Base Sepolia, which we retired mid-test.

## What we would tell a team building one.

- Decide licence and partners before writing code. They set the architecture.

- Put every provider behind an interface with a mock. You test on day one and change partners in a day.

- Build the ledger and reconciliation first. They are what tell you the truth.

- Design deposit matching for how people really send. They forget memos, round amounts and send twice.

- Expect provider limits to shape the design: wallet caps, signature quotas, faucets, address books.

## We run this as an engagement.

The decisions, partner selection, the build and the back office, with the same method and the same evidence.

Read the method: Stablecoin Ramp Architecture
