The first PIX-to-blockchain bridge in Brazil. Send a PIX (Brazil's instant payment system), receive crypto directly in your own wallet — no exchange account, no custody, no KYC gate. A few minutes end-to-end.
Live prototype: https://moeda.casa
This project was born from two research grants aimed at bringing Brazil's real-time payment rail into the blockchain world:
- Celo Community Fund — funded the integration and supported the creation of cREAL, the Brazilian Real–pegged stablecoin on Celo.
- Zcash Community Grants (ZOMG) — funded exploration of payment privacy through Zero-Knowledge Proofs, integrating PIX with Zcash's shielded pool.
Both grants converged into the same working prototype: moeda.casa, built and operated under Moedax Ltda.
A user picks a token (a stablecoin, ZEC, or a Celo-native asset), enters the destination wallet, and pays a PIX. The backend:
- Validates the destination address against the correct format for the chosen
network before anything else happens (
Token#which_chain?) — malformed or incompatible addresses are rejected before funds ever move. - Watches the PIX inbound stream in near real time (
OrderController.observe_pix), matching each incoming transfer to its order by transaction code and confirmed amount. - Buys the crypto on the market the instant the PIX clears (
Order#swap!, via the Binance integration inapp/lib/exchange.rb), applying a live cash-back adjustment and network fee before pricing the trade. - Sends the crypto out to the user's wallet (
Order#send_cripto!) — either through an exchange withdrawal for standard networks, or directly on-chain for Celo and Zcash, bypassing the exchange entirely for those rails.
Every order carries an expiry, an auditable state machine
(waiting_payment → pix_received → sent / error / refunded / expired), and a slippage
check between the quoted and executed price so a user is never silently short-changed.
app/lib/pix.rb— PIX integration with Gerencianet (Efí), using mTLS client certificates and OAuth2 client-credentials to read incoming transfers and, on the outbound side, trigger PIX refunds programmatically.app/lib/celo.rb— direct interaction with the Celo network viacelocli: reading the on-chain stablecoin exchange rates (cREAL/cUSD/cEUR) and sending cREAL peer-to-peer with no exchange in the loop, which is what let cREAL settle a PIX purchase in seconds.app/lib/zk.rb— a Ruby wrapper around the fullzcash-cliRPC surface (transparent + shieldedz_*commands), enabling shielded (zs...) addresses as a first-class withdrawal destination — the ZK-proof side of the ZOMG grant, letting a PIX payment settle into a shielded, privacy-preserving balance.app/models/chain.rb/app/models/token.rb— a small multi-chain registry (regex-validated addresses/memos per network, per-network fees and minimums) that lets the same order pipeline route to a centralized-exchange withdrawal, a Celo direct transfer, or a Zcash shielded transaction without special-casing the checkout flow.
Ruby (Sinatra) · ActiveRecord + SQLite · Slim templates · Binance API · Gerencianet
(PIX/Efí) API · Celo (celocli) · Zcash (zcash-cli) · Puma/Foreman.
Deliberately minimal: no frontend framework, no job queue, no message broker — a single small Ruby service handling payment matching, market execution, and multi-chain settlement in one auditable loop, running lean enough for a self-funded, grant-backed prototype.