Skip to content

Byte-Builders-28/InterLock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

48 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” DAFE : Soroban Escrow with OTP-Based Delivery Confirmation

A decentralized escrow smart contract system built on Stellar Soroban, enabling secure token-based payments with OTP-verified delivery confirmation. Designed for trust-minimized commerce, hackathons, and real-world Web3 payments.


πŸš€ Overview

DAFE implements a secure escrow workflow where:

  • A buyer locks funds into a Soroban smart contract
  • A merchant delivers goods/services
  • The buyer confirms delivery using a one-time password (OTP)
  • Funds are released automatically only after successful verification

No intermediaries. No manual disputes. Pure on-chain logic.


🧠 Why This Matters

Traditional escrow systems:

  • Rely on centralized authorities
  • Are slow, opaque, and trust-heavy

This system:

  • Is fully on-chain
  • Uses cryptographic OTP verification
  • Leverages Soroban smart contracts + Freighter wallet
  • Works seamlessly on Stellar Testnet

πŸ—οΈ System Architecture

sequenceDiagram
    participant Buyer as Buyer (Freighter)
    participant SC as Soroban Escrow Contract
    participant Merchant as Merchant

    Buyer->>SC: init_escrow(OTP_HASH, amount)
    Note over SC: Funds Locked
    Merchant->>Buyer: Goods Delivered (Off-chain)
    Buyer->>SC: confirm_delivery(OTP)
    Note over SC: Verify OTP + Auth
    SC->>Merchant: Release Funds
Loading

πŸ” Security Model

OTP-Based Verification

  • OTP is never stored in plaintext
  • Only the SHA-256 hash is stored on-chain
  • Raw OTP is hashed inside the contract during confirmation

Authorization

  • Only the buyer can confirm delivery
  • Enforced using require_auth() in Soroban

Trust Minimization

  • No admin keys
  • No off-chain verification
  • Contract logic is final

🧩 Tech Stack

Smart Contract

  • Rust
  • Soroban SDK
  • Stellar Testnet

Frontend

  • React (Vite)
  • @stellar/stellar-sdk
  • Freighter Wallet API
  • Tailwind CSS (Cyberpunk/Neon UI)

πŸ“‚ Project Structure

β”œβ”€β”€ contract/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ lib.rs                # Soroban smart contract logic
β”‚   β”‚   β”œβ”€β”€ escrow.rs             # Escrow data model
β”‚   β”‚   └── errors.rs             # Custom error handling
β”‚
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ stellar/
β”‚   β”‚   β”‚   β”œβ”€β”€ contract.js       # Contract interaction layer
β”‚   β”‚   β”‚   └── wallet.js         # Freighter wallet integration
β”‚   β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”‚   β”œβ”€β”€ StorePage.jsx
β”‚   β”‚   β”‚   └── PaymentPage.jsx
β”‚   β”‚   └── components/
β”‚
└── README.md

πŸ” Escrow Flow (Step-by-Step)

1️⃣ Lock Funds

  • Buyer enters card details & system generates OTP
  • System hashes OTP (SHA-256)
  • Funds are locked in the Soroban escrow contract

2️⃣ Delivery

  • Merchant delivers goods/services off-chain

3️⃣ Confirm Delivery

  • Buyer enters the OTP in the dashboard
  • Contract hashes the input OTP
  • Hashes are compared on-chain

4️⃣ Release Funds

  • If OTP matches β†’ funds transferred to merchant
  • Otherwise β†’ transaction fails safely

πŸ–ΌοΈ Visual Walkthrough

πŸ”Ή Home Page

The DAFE landing page introducing the decentralized finance and secure escrow features. DAFE Landing Page

πŸ”Ή Secure Checkout

The checkout process where users connect their Freighter wallet and enter payment details for tokenization. Secure Checkout

πŸ”Ή Wallet Confirmation

The Freighter wallet integration in action, asking for user authorization to lock funds into the Soroban escrow contract. Wallet Confirmation


πŸ§ͺ Testing

  • Network: Stellar Testnet
  • Wallet: Freighter
  • RPC: https://soroban-testnet.stellar.org

Manual Test Flow

  1. Connect buyer wallet using Freighter.
  2. Select items in the Store and proceed to Checkout.
  3. Use the "Card" payment method to simulate tokenization.
  4. "Sign & Lock" funds into the escrow contract.
  5. Enter the generated OTP in the "Confirm Delivery" section.
  6. Verify the success message and fund release.

πŸ› οΈ Future Improvements

  • πŸ” Refund Timeout: Automatic refund if merchant doesn't deliver within a time limit.
  • πŸ§‘β€βš–οΈ Dispute DAO: Community-governed dispute resolution.
  • πŸ“± Mobile UI: Native mobile experience for on-the-go payments.
  • πŸ” ZK-OTP: Zero-knowledge proofs for even more private verification.

πŸ“œ License

MIT License - Free to use, fork, and build upon.


πŸ™Œ Acknowledgements

  • Stellar & Soroban team for the robust SDKs.
  • Freighter Wallet for the seamless integration.
  • Hackathon community for the inspiration...

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors