Demo project for Final Project on Rootstock Dev Course
Simple Escrow is a minimal, educational smart contract that demonstrates time-based escrow - a fundamental blockchain primitive where funds are held until both parties approve OR a deadline passes for refund.
Core Primitive: Time-based state machine with multi-party approval
Key Concept: Funds are held in the contract until:
- ✅ Both parties approve (success) → funds go to payee
- ⏰ Deadline passes without full approval → payer gets refund
- Network: RSK Testnet
- Contract Address:
0x24a9f4ba13a490f7165725d311bb668814edb8d1 - Explorer Link: View on RSK Explorer
- Contract Verified: ✅
- ✅ Smart contract deployed on RSK Testnet
- ✅ Create escrow with single payee
- ✅ Deposit RBTC to escrow
- ✅ Release funds to approval state
- ✅ Approve from both parties (payer + payee)
- ✅ Automatic completion when both approve
- ✅ Refund after deadline passes
AWAITING_PAYMENT → AWAITING_APPROVAL → COMPLETED
↘ EXPIRED
Happy Path (Success):
- Payer creates escrow with RBTC deposit
- Payer releases funds to contract
- Payer approves
- Payee approves
- Funds automatically sent to payee
Refund Path (Dispute/No Action):
- Payer creates escrow
- Payer releases funds
- Deadline passes (e.g., 7 days)
- Payer calls refund
- Funds returned to payer
-
Connect MetaMask to RSK Testnet
- Network: RSK Testnet
- Chain ID: 31
- RPC: https://public-node.testnet.rsk.co
-
Get tRBTC from faucet
- Visit RSK Faucet
- Enter your wallet address
- Request funds
-
Create an escrow
- Enter title, payee address, amount, deadline
- Confirm MetaMask transaction
-
Release and approve
- Click "Release" to move funds to approval state
- Approve from payer account
- Switch to payee account in MetaMask
- Approve from payee account
-
Complete
- Funds automatically transfer to payee
- Status shows "Completed"
| Design Choice | Reason |
|---|---|
| Two parties only | Clear responsibility, easier to understand |
| 4-state machine | Complete coverage of all scenarios |
| Separate release & approve | Explicit intent, safety net |
| Time-based refund | No external oracles needed |
| No DeFi features | Focus on one primitive, matches feedback |
split-bill/
├── contracts/
│ └── SimpleEscrow.sol # ~120 lines - core escrow logic
├── frontend/
│ └── src/
│ ├── App.js # React frontend
│ └── abis/
│ └── SimpleEscrow.json
├── scripts/
│ └── deploy.js # Deployment script
├── test/
│ └── SimpleEscrow.test.js
├── hardhat.config.js
└── package.json
| Component | Technology |
|---|---|
| Smart Contract | Solidity 0.8.20 |
| Development | Hardhat |
| Frontend | React + Ethers.js |
| Wallet | MetaMask |
| Network | RSK Testnet |
# Clone repository
git clone https://github.com/Rsync25/Split-Bill.git
cd Split-Bill
# Install dependencies
npm install
cd frontend && npm install && cd ..
# Compile contracts
npx hardhat compile
# Deploy to RSK Testnet
npx hardhat run scripts/deploy.js --network rskTestnet
# Run frontend
cd frontend
npm start| Rule | How It's Enforced |
|---|---|
| Only payer can create/release/refund | require(msg.sender == escrow.payer) |
| Only payer/payee can approve | require(msg.sender == payer OR payee) |
| Cannot approve twice | require(!escrow.payerApproved) |
| Cannot approve before release | State must be AWAITING_APPROVAL |
| Refund only after deadline | require(block.timestamp > deadline) |
| Requirement | How This Project Meets It |
|---|---|
| One clear primitive | Time-based escrow state machine |
| Not product-oriented | Focuses on mechanism, not platform |
| Educational value | Demonstrates state management, time-based logic |
| Complete but simple | 4 states, 5 functions, ~120 lines |
| Demo-friendly | 2-minute walkthrough shows both paths |
| Deployed on RSK | Testnet deployment verified |
- Contract Address:
0x24a9f4ba13a490f7165725d311bb668814edb8d1(RSK Testnet) - Explorer: View Contract
- GitHub: github.com/Rsync25/Split-Bill
For questions about this project, please reach out via the course platform.
Made for RSK Developer Course Capstone Project 🚀