Ripple Mart: Trustless E-Commerce on XRPL

Inspiration

E-commerce has a persistent "trust gap." Buyers worry they won't receive what they paid for, and sellers worry about fraudulent chargebacks. While the XRP Ledger (XRPL) offers a powerful Escrow feature to solve this, the barrier to entry is high—requiring users to manually handle cryptographic conditions and fulfillment secrets.

Ripple Mart was born from a simple goal: To make trustless e-commerce as "seamless" as a traditional checkout experience. We wanted to build a platform where the blockchain works silently in the background, securing funds and tracking journeys without the user ever needing to copy-paste a single hex string.

What it does

Ripple Mart is a functional e-commerce demo that uses the XRPL to secure payments.

  • Secure Escrows: When a buyer checks out, funds are locked on-chain using the EscrowCreate transaction.
  • Delivery Simulation: We built a custom "Oracle" that simulates a real-world shipping journey (e.g., Shenzhen to Singapore).
  • Automated Handshakes: The backend generates cryptographic conditions, and the frontend handles the Crossmark wallet interaction automatically.
  • Buyer Protection: Funds are only released to the merchant when the buyer confirms receipt, or they can be refunded via EscrowCancel if conditions aren't met.

How we built it

The project is split into a modern full-stack architecture:

  • Frontend: Built with Next.js 15 and Tailwind CSS. We integrated the Crossmark SDK to provide a smooth, browser-based wallet experience.
  • Backend (The Oracle): A Node.js/Express server that acts as the trusted intermediary. It manages the lifecycle of the escrow and handles the "Fulfillment" secrets.
  • Database: MongoDB tracks the state of every order, mirroring the ledger status for high-performance UI updates.
  • Ledger Integration: We used xrpl.js and five-bells-condition to handle the heavy lifting of on-chain escrow logic.

Challenges we ran into

The biggest hurdle was the "Wallet Hang." Initially, our frontend would wait indefinitely for a response from the wallet after a transaction. On the testnet, WebSocket timeouts frequently caused the UI to freeze, even if the transaction was successful.

We solved this by implementing a Resilient State Management pattern:

  1. We switched to "fire-and-forget" transaction submission.
  2. We built a Backend Ledger Listener that monitors the XRPL in real-time.
  3. The frontend polls our Oracle for the "Truth." If the listener sees the transaction on the ledger, the UI updates instantly, regardless of whether the wallet extension is still "loading."

Accomplishments that we're proud of

  • Successful Integration of RLUSD: We overcame tecPATH_DRY errors by implementing proper Trustline management for the RLUSD stablecoin.
  • Seamless UI: Moving from manual hex-code entry to a single-click checkout flow using Crossmark.
  • Atomic Concurrency: Ensuring that funds cannot be released and refunded simultaneously through backend locking mechanisms.

What we learned

We gained a deep appreciation for the EscrowFinish and EscrowCancel mechanics. Learning how to properly bridge "off-chain" delivery events with "on-chain" fund releases taught us a lot about the importance of robust error handling and state synchronization in decentralized applications.

What's next for Ripple Mart

We envision a future where Ripple Mart integrates with real-world shipping APIs (like DHL or FedEx). The Oracle could then automatically release funds the moment a "Delivered" status is confirmed by the carrier, creating a truly automated, trustless global marketplace.

Built With

Share this project:

Updates