How it works
Architecture
Which part does what, and how a payment moves between the browser, Sui and the server.
On this page
The parts#
Floe is a Next.js app with three small API routes and one Move module. There is no database and no user table.
| Part | Responsible for | Never has |
|---|---|---|
| Browser | Link keys, transactions, the sender’s history and reading Sui | The sponsor’s private API key |
| Move contract | Holding coins, checking signatures and paying out | The link’s private key |
| /api/claim | Checking a signed claim and asking Enoki to pay its gas | The key or note |
| /api/prices | Live SUI and $LOFI prices | Anything about a payment |
| /api/impact | Water totals, read from public claims | The key or note |
| Walrus | Encrypted cards, photos and voice notes | The key that opens them |
| Enoki | Google zkLogin accounts and gas sponsorship | The link’s private key |
| Sui nodes | Current objects over gRPC, and past events over GraphQL | The key or note |
Creating a link#
- The browser makes a new Ed25519 keypair in memory. Each link has its own.
- The sender signs a transaction that calls
create_escrowwith the coins and the public key. - Before sending, Floe computes the transaction digest and saves a history record under it. The record never includes the private key.
- The browser sends the signed bytes. If the reply is lost, it looks the digest up on the full node and in GraphQL before saying what happened.
- Once the escrow ID is known, the browser builds the link from the ID, the private key and the note.
Claiming a link#
- The claim page reads the escrow ID from the query and the key from the fragment, then loads the escrow from Sui.
- The recipient logs in with Google or connects a wallet, which gives an address.
- The key in the link signs 64 bytes: the escrow ID, then that address. The signature goes into a
claim_escrowtransaction. The key does not. - The recipient’s account signs the transaction, with Enoki set to pay the gas.
- POST /api/claim checks and simulates it, then Enoki sponsors and runs it.
- The contract verifies the signature, pays the recipient and the treasury, and deletes the escrow.
Refunding a link#
The sender calls reclaim_escrow directly from their account. No Floe server takes part, and the claim key isn’t needed.
Withdrawing#
The account page sends a plain transfer from the browser and pays its own gas, so it doesn’t touch the contract or a Floe server. It is built and simulated first to check that it can be afforded. Like a create, it is signed once, and only those same bytes are ever sent again.
The life of an escrow#
create_escrow ──▶ open ──┬── claim_escrow, up to expiry ──▶ deleted, recipient paid
│
└── reclaim_escrow, any time ────▶ deleted, sender refundedAn escrow is a shared object that is deleted when it closes, so it can pay out only once. If a claim and a refund race, Sui orders them and the second one fails.
How status is worked out#
The dashboard asks a full node for each open escrow, 50 at a time. If one is gone, Floe finds the transaction that closed it and reads its event to tell a claim from a refund. Those lookups use GraphQL, because full nodes drop old transactions.
An unreadable escrow is never treated as missing. Its last known status stays until Sui gives a definite answer.
Stack#
| Layer | Technology |
|---|---|
| App | Next.js 15, React 19, TypeScript |
| Style and motion | Tailwind CSS, Framer Motion |
| Sui | @mysten/sui, @mysten/dapp-kit-react |
| Login and gas | @mysten/enoki |
| Contract | Move, 2024 edition |