Gyidi
Peer-to-peer trades between Ghanaian cedis and USDC or USDT, with no trust needed. A Soroban contract holds the coins and releases them only when the bank's signed alert proves the cedis arrived.
- Role
- Sole designer and engineer
- When
- 2026
- Status
- Running on Stellar testnet, pre-audit
- Stack
- Rust, Soroban, Next.js 15, TypeScript, Prisma, PostgreSQL, Turborepo, Railway
- Try it
- Testnet demo
The problem
In Ghana, a lot of people buy USDC and USDT person to person, paying in cedis by mobile money or bank transfer. Someone has to go first. Either the buyer sends cedis and hopes the coins arrive, or the seller sends coins and hopes the cedis arrive. The usual fix is a platform that holds everyone's money, which brings its own risk.
Gyidi puts the coins in a smart contract instead. The seller's coins go into escrow before the buyer pays. Once the trade is accepted, the coins can only go to the buyer or back to the seller. Cedis never pass through Gyidi; they move directly between the two people.
What I built
- The escrow contract, in Rust on Soroban: offers, reservations, both trade directions, manual and attested release, refunds, timelocked configuration, and disputes settled by a 2-of-3 arbiter multisig.
- A TypeScript monorepo (pnpm and Turborepo) with a chain-agnostic core: trade lifecycle, money math and matching rules sit behind
EscrowAdapterandWalletProviderinterfaces, so only one package knows about Stellar. - The web app, in Next.js 15: a dealer dashboard, private trade links for clients, a public order book and coin-to-coin swaps.
- Background services: an indexer that mirrors contract events into Postgres through Prisma, and a keeper that refunds reservations when their payment window lapses.
- A payment verifier that reads bank credit alerts and releases coins automatically (more below).
The hard parts
Releasing coins when the cedis arrive, without trusting a server
A manual flow needs the seller to confirm they were paid. I wanted the release to happen on its own, but a server that can release escrow is a single point of failure. So the verifier only acts on evidence that a bank signed:
- Banks send credit alerts as email. The verifier takes the raw MIME, checks the DKIM signature, domain alignment, signed headers, the registered recipient, credit versus debit, and the account mask.
- Each trade asks for a unique amount (GHS 500.71, not 500.00) plus a reference, so a payment matches exactly one trade. A partial unique index in Postgres stops two open trades from ever expecting the same amount from the same receiver.
- On a match, the verifier signs a secp256k1 attestation and submits
release. The contract checks the signature itself. - One payment, one release: the attestation's reference hash is unique in Postgres and in the contract's own used set. Replaying the same attestation against a new trade fails on-chain with
RefUsed. - The attestation encoding is implemented twice, in Rust and TypeScript, and both test suites pin it with the same test vector.
People who have never held crypto
A new Stellar account needs XLM for reserves and fees, which is a dead end for someone who just wants dollars. In Gyidi the platform is the source account and fee payer for every action, client accounts are created with sponsored reserves and a trustline, and users only sign their own Soroban auth entries. The prepared transaction is kept on the server, so a browser can add its signature but can't change what the platform signs.
Getting ready for an audit
The Rust toolchain is pinned so the contract's wasm builds byte for byte the same every time. The build that goes to audit is the build that ships.
Proof
I ran three trades through the web app on Stellar testnet, each with a fresh browser wallet that never held XLM. Every step is a real transaction you can look up. Testnet is reset from time to time, so older links may stop resolving.
| Trade | Step | Transaction |
|---|---|---|
| EV-9RUNUT Client buys 40 TUSDC, pays GHS 500.71 by mobile money, dealer confirms | reserve | 8536e57de2…9a7d4f |
| mark_paid | 324b685778…bb3267 | |
| release | aa99e292d5…b0e364 | |
| EV-P6KAUP Client sells 20 TUSDC, dealer pays GHS 250.56, client confirms | reserve | c5d5cd1490…65ae74 |
| mark_paid | 6644669fad…a85cb0 | |
| release | 91e24d0eb8…d51336 | |
| EV-K7D8HZ Client buys 25 TUSDC; released automatically by a DKIM-signed bank alert, nobody pressed a button | reserve | 299ac88219…86d988 |
| release (attested) | 80ae4b3f41…a82476 |
Where it stands
Gyidi runs on testnet until the contract is audited. Real banks are registered with their DKIM domains, but their alerts are rejected until I write parsers against real samples; adding a bank is one config entry. Still open: choosing an embedded-wallet vendor, seating the arbitration panel, and moving the verifier and platform keys into a KMS.