Architecture
End-to-end flow
- Browser (Next.js) — User opens
/started(or similar), connects wallet. POST /getAmount— Facilitator returns ciphertext for the demo price.- Sign message — Client builds payload (ciphertext, amount, recipient, nonce, …) and calls
signMessage. POST /verify— Facilitator checks Ed25519 signature and x402-style payload.- Simulation / handles — Client may simulate IncoToken transfer to obtain handles (see app code).
POST /settle(step 1) — Facilitator returnsrequiresPayerSignature: trueandunsignedTransaction(base64).- Sign transaction — User signs once; client serializes with
requireAllSignatures: false/verifySignatures: false(fee payer not signed yet). POST /settle(step 2) — Client sends signed tx; facilitator calls KorasignAndSendTransaction.- Kora — Adds fee-payer signature, submits to Solana; client shows Solscan link.
Components
| Layer | Role |
|-------|------|
| Next.js app | UI, wallet adapter, calls facilitator + builds/signed txs |
| Facilitator (Express) | Ciphertext, verify, build unsigned tx, proxy to Kora |
| Kora | Fee payer RPC, partially signed tx handling |
| IncoToken (Anchor) | transfer_with_authorization, Ed25519 relative index |
| Inco Lightning | Confidential SPL / FHE CPIs from IncoToken |
Devnet program IDs (reference)
Use these in Kora allowed_programs (or equivalent):
ComputeBudget111111111111111111111111111111— Compute Budget9Cir3JKBcQ1mzasrQNKWMiGVZvYu3dxvfkGeQ6mohWWi— IncoToken5sjEbPiqgZrYwR31ahR6Uk9wf5awoX61YGg7jExQSwaj— Inco LightningEd25519SigVerify111111111111111111111111111— Ed25519 verify
See my-app/README.md in the repo for the full table and troubleshooting.
