Skip to content

Faraone-Dev/REVERSO

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

94 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ”„ REVERSO Protocol

REVERSO Mainnet Solidity License Verified Tests Fuzz Security

Reversible Transaction Protocol for EVM Chains

Time-locked transfers with cancel, recovery, and insurance β€” deployed on 7 chains.

🌐 Live Demo β€’ πŸ“„ Documentation β€’ πŸ”Œ API β€’ πŸ›‘οΈ Security


πŸ“Š Project Status

Component Status Details
πŸ” ReversoVault βœ… Deployed on Ethereum Verified on Etherscan β€” 1,194 lines, 5-layer protection
πŸ›‘οΈ EmergencyGuardian βœ… Deployed on Ethereum Verified on Etherscan β€” Multi-sig + 24h timelock
πŸ‘οΈ ReversoMonitor βœ… Deployed on Ethereum Verified on Etherscan β€” Anomaly detection + auto-pause
πŸ§ͺ Test Suite βœ… 163 tests passing 131 Hardhat (contracts) + 32 Jest (API) β€” HMAC, validation, denylist, plans
πŸ”Œ Enterprise API βœ… Live HMAC auth, email verification, password reset, fraud denylist, webhooks with retry
🌐 Website βœ… Live β€” reverso.one Interactive demo with wallet connection
⛓️ Multi-chain βœ… 7 Chains Live Ethereum, BSC, Base, Arbitrum, Polygon, Optimism, Avalanche
πŸ”€ Fuzz Testing βœ… 13,000+ runs 13 property tests Γ— 1,000 random inputs (Foundry)

All 3 contracts deployed and wired on 7 chains: Ethereum, BSC, Base, Arbitrum, Polygon, Optimism, Avalanche.


🎯 The Problem

Blockchain transactions are irreversible by design. Phishing, wrong-address sends, lost access, and contract bugs cause significant losses every year. Once confirmed, there is no undo.

REVERSO adds a time-locked reversibility layer on top of standard EVM transfers β€” letting senders cancel, recover, or auto-refund before finalization.


πŸ’‘ The Solution

REVERSO introduces time-locked reversible transfers with up to 5 layers of protection:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    πŸ”„ REVERSO TRANSFER FLOW                     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                 β”‚
β”‚   SEND ──▢ LOCK PERIOD ──▢ CLAIM WINDOW ──▢ COMPLETE           β”‚
β”‚     β”‚          β”‚               β”‚               β”‚                β”‚
β”‚     β”‚    [CANCEL OK]     [RECIPIENT           β”‚                β”‚
β”‚     β”‚                     CLAIMS]              β”‚                β”‚
β”‚     β”‚                          β”‚               β”‚                β”‚
β”‚     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                β”‚
β”‚                                                                 β”‚
β”‚   πŸ›‘οΈ 5 LAYERS OF PROTECTION:                                   β”‚
β”‚   β”œβ”€β”€ Layer 1: Cancel during lock period                       β”‚
β”‚   β”œβ”€β”€ Layer 2: Recovery Address 1 (hardware wallet)            β”‚
β”‚   β”œβ”€β”€ Layer 3: Recovery Address 2 (exchange backup)            β”‚
β”‚   β”œβ”€β”€ Layer 4: Auto-refund after expiry                        β”‚
β”‚   └── Layer 5: Rescue abandoned funds (90 days)                β”‚
β”‚                                                                 β”‚
β”‚   πŸ† PREMIUM INSURANCE (+0.2%):                                 β”‚
β”‚   └── Full refund even if scammer claims your funds!           β”‚
β”‚                                                                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

✨ Features

πŸ”’ Core Features

Feature Description
Reversible Transfers Cancel any transfer during lock period
Time-Lock Options 1 hour to 30 days - you choose
Triple Recovery 2 backup addresses + original sender
Auto-Refund Unclaimed transfers return automatically
Multi-Token ETH + any ERC-20 token
Multi-Chain ETH, BSC, Base, Arbitrum, Polygon, Optimism, Avalanche β€” all live

πŸ’° Progressive Fee Structure

Tier Amount Fee Example
🏠 Retail < $1,000 0.3% $100 β†’ $0.30 fee
πŸ’Ό Standard $1K - $100K 0.5% $10,000 β†’ $50 fee
πŸ‹ Whale > $100,000 0.7% $1M β†’ $7,000 fee

πŸ›‘οΈ Premium Insurance (+0.2%)

Pay 0.2% extra β†’ Insurance coverage (subject to pool balance)

Even if scammer claims your funds:
β”œβ”€β”€ You contact us with proof
β”œβ”€β”€ We verify the scam
└── You get refunded from Insurance Pool πŸ’°

Fully tested: payInsuranceClaim(), withdrawExcessInsurance(),
    reject on non-insured transfer, reject on empty pool.

Example: 10 ETH with insurance
β”œβ”€β”€ Base fee: 0.05 ETH (0.5%)
β”œβ”€β”€ Insurance: 0.02 ETH (0.2%)
β”œβ”€β”€ Total cost: 0.07 ETH (0.7%)
└── Protection: coverage subject to policy/pool βœ“

🏒 Enterprise Payroll & Stipends (API)

  • Pay salaries, stipends and reimbursements with a lock window β€” cancel before the recipient claims if something goes wrong.
  • HMAC/nonce/timestamp API auth: keys stay server-side, no bearer tokens in frontend.
  • Recovery addresses and auto-refund: if the recipient doesn't claim, funds return automatically.
  • Optional insurance (+0.2%) to cover fraud or erroneous claims.
  • Rate limiting and audit-first rollout: mainnet gated until external audit is completed.

🌐 Supported Chains

Chain Status Chain ID
Ethereum βœ… Deployed & Verified 1
BSC βœ… Deployed 56
Base βœ… Deployed 8453
Arbitrum βœ… Deployed 42161
Polygon βœ… Deployed 137
Optimism βœ… Deployed 10
Avalanche βœ… Deployed 43114

πŸš€ Quick Start

Installation

# Clone the repository
git clone https://github.com/Faraone-Dev/REVERSO.git
cd REVERSO

# Install dependencies
npm install

# Compile contracts
npx hardhat compile

# Run tests
npx hardhat run scripts/test-functions.ts --network hardhat

# Deploy locally
npx hardhat run scripts/deploy.ts --network hardhat

# Deploy to testnet
npx hardhat run scripts/deploy.ts --network sepolia

# Deploy multichain (uses hardhat config)
npx hardhat run scripts/deploy-multichain.ts

πŸš€ Ethereum Mainnet β€” Live Deployment

Full protocol stack deployed and verified on Ethereum Mainnet. All contracts are source-code verified on Etherscan, ownership has been transferred to the EmergencyGuardian multi-sig, and the monitoring layer is active.

πŸ“ Production Contracts

Contract Address Etherscan Role
πŸ” ReversoVault 0x31ec8EeeCb341c7cefAefA6BC0Dd84BE9Bd11085 βœ… Verified Source Core vault β€” reversible transfers, fees, insurance
πŸ›‘οΈ EmergencyGuardian 0x7F1CB513B7A582A11f3057F104D561E9A9126A7d βœ… Verified Source Multi-sig owner of Vault β€” timelock + emergency pause
πŸ‘οΈ ReversoMonitor 0x152935935E86ab06ce75b6871c500f6Eb57f5332 βœ… Verified Source Anomaly detection β€” auto-pause on critical alerts
πŸ’° Treasury 0x211a8C2d4f5924d4378162b48bC759a3E3e57dD8 View Receives protocol fees

🌐 Multi-Chain Deployments

Deployed February 24, 2026. Same 3-contract stack on every chain.

BSC (BNB Smart Chain)

Contract Address
πŸ” ReversoVault 0x6Ec438bEfE7f956d115c4Aa2B9eB80996df4d322
πŸ›‘οΈ EmergencyGuardian 0x7C962938cce85737eB25147667279117f40dE23a
πŸ‘οΈ ReversoMonitor 0x1610DA56f09555a388AB8a095F180A2069FDA4F1

Base

Contract Address
πŸ” ReversoVault 0x1610DA56f09555a388AB8a095F180A2069FDA4F1
πŸ›‘οΈ EmergencyGuardian 0x038516Fd2EbF5AC7c6E4A85858CDaF908F4650C9
πŸ‘οΈ ReversoMonitor 0xA8854b60A3c150BA0b4FB7418eD7b15d577a129b

Arbitrum

Contract Address
πŸ” ReversoVault 0x6Ec438bEfE7f956d115c4Aa2B9eB80996df4d322
πŸ›‘οΈ EmergencyGuardian 0x7C962938cce85737eB25147667279117f40dE23a
πŸ‘οΈ ReversoMonitor 0x1610DA56f09555a388AB8a095F180A2069FDA4F1

Polygon

Contract Address
πŸ” ReversoVault 0x6Ec438bEfE7f956d115c4Aa2B9eB80996df4d322
πŸ›‘οΈ EmergencyGuardian 0x7C962938cce85737eB25147667279117f40dE23a
πŸ‘οΈ ReversoMonitor 0x1610DA56f09555a388AB8a095F180A2069FDA4F1

Optimism

Contract Address
πŸ” ReversoVault 0x6Ec438bEfE7f956d115c4Aa2B9eB80996df4d322
πŸ›‘οΈ EmergencyGuardian 0x7C962938cce85737eB25147667279117f40dE23a
πŸ‘οΈ ReversoMonitor 0x1610DA56f09555a388AB8a095F180A2069FDA4F1

Avalanche (C-Chain)

Contract Address
πŸ” ReversoVault 0x6Ec438bEfE7f956d115c4Aa2B9eB80996df4d322
πŸ›‘οΈ EmergencyGuardian 0x7C962938cce85737eB25147667279117f40dE23a
πŸ‘οΈ ReversoMonitor 0x1610DA56f09555a388AB8a095F180A2069FDA4F1

πŸ”— Contract Wiring (On-Chain)

ReversoVault.owner()     β†’ EmergencyGuardian  βœ…
EmergencyGuardian.vault  β†’ ReversoVault        βœ…
ReversoMonitor.guardian  β†’ EmergencyGuardian  βœ…

Deploy Block: 24520800 Β· Compiler: Solidity 0.8.20 Β· Optimizer: 200 runs


🌐 Testnet Deployment & Live Tests (Sepolia)

πŸ“ Deployed Contracts

Contract Address Network Status
ReversoVault v1 0x2F5c8E09FBf360777153dd6F7F636077890e61DF Sepolia βœ… Verified
ReversoVault v2 0x3D1f9d1cEaf350885A91f7Fb05c99a78Bc544ED8 Sepolia βœ… Deployed
TestToken (TTK) 0x72E847D973f9b215C7F561CD059CBd7a1601Fe3C Sepolia βœ… Verified
Treasury 0x6a5729177bF2AE13351F43af0999767B59d9b059 Sepolia βœ… Receives fees

Deploy Date: December 29, 2025

βœ… Live Testnet Tests Passed

Test 1: sendETH() - Reversible Transfer Creation

TX Hash 0x3176b0d6...
Amount Sent 0.001 ETH
Amount After Fee 0.000997 ETH (0.3% fee)
Recipient 0x...dEaD (burn address for test)
Delay 1 hour
Memo "Test REVERSO"
Gas Used 383,452
Status βœ… SUCCESS - Transfer created with status Pending

Test 2: cancel() - Reversal & Refund

TX Hash 0x3c4fcf76...
Transfer ID 1
Action Cancel pending transfer
Gas Used 64,138
Result βœ… SUCCESS - Funds returned to sender, status changed to Cancelled

Test 3: sendETH() - Additional Transfer Test

TX Hash 0x325757b3...
Transfer ID 3
Gas Used 332,176
Status βœ… SUCCESS - Then cancelled to recover funds

Test 4: sendETHPremium() - Transfer with Insurance (+0.2%)

TX Hash 0x824265692f...
Transfer ID 4
Amount After Fees 0.000995 ETH (0.5% fee + 0.2% insurance)
Has Insurance βœ… true
Insurance Pool Increased by +0.000002 ETH
Gas Used 358,128
Status βœ… SUCCESS - Premium transfer with insurance flag, then cancelled

Test 5: cancel() - Multiple Cancel Tests

Tested Cancel on transfers #3 and #4
Gas Used ~64,000
Result βœ… SUCCESS - All cancelled transfers refunded correctly

Test 6: sendToken() - ERC20 Reversible Transfer

Token TestToken (TTK) - 0x72E847D9...
Vault 0x3D1f9d1c...
Approve TX 0xac3168a9...
sendToken TX 0x3ecacf50...
Amount 100 TTK
Gas Used 433,095
Cancel TX 0x91d099ab... (67,951 gas)
Status βœ… SUCCESS - ERC20 transfer created, cancelled, tokens refunded

πŸ“Š Test Summary

═══════════════════════════════════════════════════════════════
              🌐 SEPOLIA TESTNET - LIVE TESTS
═══════════════════════════════════════════════════════════════

βœ… Test 1: sendETH()        β†’ PASSED (383,452 gas)
   └── 0.001 ETH sent with 1h delay, 0.3% fee collected

βœ… Test 2: cancel()         β†’ PASSED (64,138 gas)  
   └── Funds returned to sender, status = Cancelled

βœ… Test 3: sendETH()        β†’ PASSED (332,176 gas)
   └── Additional transfer test, cancelled to recover

βœ… Test 4: sendETHPremium() β†’ PASSED (358,128 gas)
   └── Insurance flag set, pool increased +0.000002 ETH

βœ… Test 5: cancel()         β†’ PASSED (multiple)
   └── All pending transfers successfully cancelled

βœ… Test 6: sendToken()      β†’ PASSED (433,095 gas)
   └── ERC20 (TestToken) transfer + cancel working

βœ… Test 7: claim()          β†’ PASSED (190,303 gas)
   └── Recipient claimed after 1h unlock period!

═══════════════════════════════════════════════════════════════
                    7/7 TESTS PASSED βœ…
═══════════════════════════════════════════════════════════════

Test 7: claim() - Recipient Claims After Unlock

TX Hash 0x3e866e52...
Vault 0x3D1f9d1c...
Transfer ID 2
Claimer 0xb9279e38f6eab17f986E7133C60a46DE527628e3 (receiver wallet)
Amount Claimed 0.001994 ETH
Wait Time 1 hour (unlock period)
Gas Used 190,303
Status βœ… SUCCESS - Transfer status changed to Claimed, funds transferred to recipient

πŸ”œ Pending Tests (Time-Dependent)

Test Function Description Status
8 refundExpired() Auto-refund after expiry βœ… Verified in Hardhat (ETH + ERC20)
9 freezeTransfer() Guardian blocks suspicious transfer βœ… Verified in Hardhat (ETH + ERC20)
10 rescueAbandoned() Rescue funds after 90+ days βœ… Verified in Hardhat (TVL consistent)

Note: Tests 8-10 are fully verified in local Hardhat tests (131 passing) including ERC20 lifecycle. On testnet they require real wait times.

πŸ”‘ Test Wallets

Wallet Address Purpose
Sender 0x6a5729177bF2AE13351F43af0999767B59d9b059 Deploys contracts, sends transfers
Receiver 0xb9279e38f6eab17f986E7133C60a46DE527628e3 Claims transfers (for claim() test)
Treasury 0x6a5729177bF2AE13351F43af0999767B59d9b059 Receives protocol fees

⚠️ Test Notes

  • claim(): Cannot send to self (_recipient != msg.sender check). Using 2nd wallet as recipient.
  • Time-dependent tests: Testnet doesn't allow time manipulation. Must wait real time.
  • rescueAbandoned(): Requires 90+ days - verified in local Hardhat tests only.

βœ… Test Results (Verified)

Local Hardhat suite (ETH + ERC20 + insurance + rescue):

═══════════════════════════════════════════════════════════════
                 πŸ§ͺ REVERSO - TEST RESULTS
═══════════════════════════════════════════════════════════════

TEST 1: CREATE TRANSFER (sendETH)
πŸ’Έ Sending: 1 ETH
πŸ‘€ To: 0x70997970C51812dc3A010C7d01b50e0d17dc79C8
⏱️  Delay: 1 hour
βœ… Transfer created!
πŸ“‹ Transfer ID: 1
πŸ’° Amount after fee: 0.995 ETH (0.5% fee applied)

═══════════════════════════════════════════════════════════════
TEST 2: CANCEL TRANSFER
πŸ’° Sender balance before: 9998.99 ETH
βœ… Transfer CANCELLED!
πŸ’° Sender balance after: 9999.99 ETH
πŸ”™ Refunded: ~0.995 ETH βœ“

═══════════════════════════════════════════════════════════════
TEST 3: CLAIM TRANSFER
πŸ’° Recipient balance before: 10000.0 ETH
βœ… Transfer CLAIMED!
πŸ’° Recipient balance after: 10000.497 ETH
πŸ“Š Status: Claimed βœ“

═══════════════════════════════════════════════════════════════
TEST 4: FEE COLLECTION
πŸ“Š Total Transfers: 2
🏦 Treasury received fees βœ“

TEST 5: ERC20 TRANSFER
πŸ” sendToken with fee tier
🏦 Treasury gets token fee
πŸ“ˆ TVL tracks token amount after fee

TEST 6: INSURANCE CLAIM
πŸ›‘οΈ sendETHPremium β†’ claim β†’ payInsuranceClaim
🏦 Insurance pool debits payout
πŸ‘€ Victim receives compensation

TEST 7: RESCUE (TVL)
🧹 rescueAbandoned reduces TVL after late recovery

═══════════════════════════════════════════════════════════════
                    βœ… ALL TESTS PASSED!
═══════════════════════════════════════════════════════════════

Verified Functions

Function Status Description
sendETH() βœ… Passed Create reversible transfer with delay
sendETHSimple() βœ… Passed Quick transfer with 24h default
sendETHPremium() βœ… Passed Transfer with insurance (+0.2%)
sendToken() βœ… Passed ERC20 transfer with fee-on-transfer support
cancel() βœ… Passed Cancel and receive full refund (ETH + ERC20)
claim() βœ… Passed Recipient claims after delay (ETH + ERC20)
refundExpired() βœ… Passed Auto-refund after expiry (ETH + ERC20)
batchRefundExpired() βœ… Passed Batch refund with DoS protection
freezeTransfer() βœ… Passed Guardian freeze + refund (ETH + ERC20)
manualRefund() βœ… Passed Owner manual refund for edge cases
rescueAbandoned() βœ… Passed TVL-consistent late recovery
payInsuranceClaim() βœ… Passed Insurance payout from pool
withdrawExcessInsurance() βœ… Passed Excess pool withdrawal to treasury
calculateFee() βœ… Passed Progressive fee tiers (retail/standard/whale)
setCircuitBreakerLimits() βœ… Passed Circuit breaker configuration
setAlertThreshold() βœ… Passed Alert threshold with bounds check
Fee Collection βœ… Passed Treasury receives fees automatically

Basic Usage

// SIMPLE: Send with default 24h delay
reversoVault.sendETHSimple{value: 1 ether}(
    recipient,      // address to receive
    "Payment #123"  // optional memo
);

// ADVANCED: Custom delay, expiry, and DOUBLE recovery addresses
reversoVault.sendETH{value: 1 ether}(
    recipient,      // address to receive
    6 hours,        // delay before claim (min 1h, max 30d)
    30 days,        // expiry - time to claim (min 7d)
    ledgerAddr,     // recovery address 1 (your hardware wallet)
    coinbaseAddr,   // recovery address 2 (your exchange)
    "Payment #123"  // optional memo
);

// 🌟 PREMIUM: Full insurance coverage (recommended for large transfers)
reversoVault.sendETHPremium{value: 10 ether}(
    recipient,      // address to receive
    7 days,         // delay
    30 days,        // expiry
    ledgerAddr,     // recovery 1
    coinbaseAddr,   // recovery 2
    "Large payment" // memo
);
// Pays: 0.5% base + 0.2% insurance = 0.7% total
// Gets: Scam/theft coverage from insurance pool

// Cancel before delay expires (FREE!)
reversoVault.cancel(transferId);

// Claim after delay (recipient calls)
reversoVault.claim(transferId);

// Refund expired transfer (anyone can call after expiry)
reversoVault.refundExpired(transferId);

// Rescue abandoned funds (anyone can call after 90 days post-expiry)
reversoVault.rescueAbandoned(transferId);

Delay Options

Delay Best For
1 hour Urgent but want minimal protection
6 hours Daily transactions
24 hours Standard protection (DEFAULT)
7 days Large amounts
30 days Escrow, major purchases

πŸ”Œ Enterprise API

REST API for programmatic access to reversible transfers.

Base URL

Production: https://reverso-tu3o.onrender.com/api/v1
Development: http://localhost:3000/api/v1

Authentication

curl -H "Authorization: Bearer rsk_business_xxx..." \
  https://reverso-tu3o.onrender.com/api/v1/transfers

Quick Example

// 1. Register for API key
const register = await fetch('/api/v1/auth/register', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    email: 'dev@company.com',
    password: 'secure123',
    company: 'Acme Inc',
    plan: 'business'
  })
});
const { apiKey } = await register.json();
// ⚠️ Save apiKey.key - shown only once!

// 2. Create reversible transfer
const transfer = await fetch('/api/v1/transfers', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${apiKey.key}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    chainId: 1,           // Ethereum
    to: '0x...',          // Recipient
    amount: '1000000000000000000', // 1 ETH in wei
    withInsurance: true   // +0.2% for full protection
  })
});

const { transaction } = await transfer.json();
// Sign `transaction` with ethers.js and broadcast!

API Endpoints

Method Endpoint Description
POST /auth/register Create account & get API key
POST /auth/login Login existing user
POST /auth/quick-key Instant API key (email only)
GET /auth/plans List subscription plans
POST /auth/verify-email/send Send verification email (JWT)
GET /auth/verify-email?token= Verify email address
POST /auth/forgot-password Request password reset
POST /auth/reset-password Set new password with token
POST /transfers Create reversible transfer
GET /transfers/:id Get transfer status
GET /transfers List all transfers
POST /transfers/:id/cancel Generate cancel transaction
POST /transfers/:id/confirm Confirm after blockchain tx
POST /usecases/checkout E-commerce checkout flow (Enterprise)
POST /usecases/payroll Batch payroll (Enterprise)
POST /usecases/escrow Escrow transfer (Enterprise)
GET /webhooks List webhooks (Business+)
POST /webhooks Create webhook (Business+)
PATCH /webhooks/:id Update webhook (Business+)
DELETE /webhooks/:id Delete webhook (Business+)
POST /webhooks/:id/test Send test event (Business+)
GET /admin/usage View API usage (Business+)
GET /admin/stats Real-time analytics from SQLite (Enterprise)
GET /admin/denylist List blocked addresses (Enterprise)
POST /admin/denylist Block address (Enterprise)
DELETE /admin/denylist/:addr Unblock address (Enterprise)
PUT /admin/branding White-label config (Enterprise)
GET /admin/sla SLA status (Enterprise)
GET /admin/export Export transfer data (Business+)

Webhooks

Receive real-time notifications for transfer events:

{
  "type": "transfer.claimed",
  "data": {
    "id": "uuid",
    "txHash": "0x...",
    "from": "0x...",
    "to": "0x...",
    "amount": "1000000000000000000",
    "status": "claimed"
  },
  "createdAt": "2025-12-26T12:00:00Z"
}

Available Events:

  • transfer.created - New transfer created
  • transfer.claimed - Recipient claimed funds
  • transfer.cancelled - Sender cancelled transfer
  • transfer.refunded - Expired transfer refunded

Run API Locally

cd api
npm install
cp .env.example .env
npm run dev

# Server runs on http://localhost:3000

API Security (HMAC)

All protected endpoints require these headers:

  • Authorization: Bearer <apiKey>
  • x-reverso-timestamp: Epoch milliseconds (Β±5 minutes tolerance)
  • x-reverso-nonce: Unique UUID to prevent replay attacks
  • x-reverso-signature: HMAC-SHA256 of timestamp.nonce.METHOD.URL.sha256(body) signed with signingSecret

Rate Limiting: 300 req/min per API key + transaction limit per plan.

Multi-Chain Configuration

  • Config source: api/config/chains.json + .env variables for RPC and vault addresses
  • After deployment, update .env with actual contract addresses

Transaction Encoding

// ETH transfers
sendETH(recipient, delay, expiryPeriod, recovery1, recovery2, memo)

// ERC20 transfers  
sendToken(token, recipient, amount, delay, expiryPeriod, recovery1, recovery2, memo)

Note: Memo max 256 characters; recovery addresses cannot be zero address.


---

## πŸ” Security

### Security Architecture (3-Contract System)

REVERSO uses a **3-layer security architecture**:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ πŸ—οΈ REVERSO SECURITY STACK β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ πŸ‘οΈ ReversoMonitor β”‚ β”‚ β”‚ β”‚ β€’ Anomaly detection (volume spikes, suspicious tx) β”‚ β”‚ β”‚ β”‚ β€’ Auto-pause on CRITICAL alerts β”‚ β”‚ β”‚ β”‚ β€’ Watchlist management β”‚ β”‚ β”‚ β”‚ β€’ Chainlink Automation compatible β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ triggers β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ πŸ›‘οΈ EmergencyGuardian β”‚ β”‚ β”‚ β”‚ β€’ Multi-signature (2-of-2 for critical actions) β”‚ β”‚ β”‚ β”‚ β€’ 24-hour timelock on admin changes β”‚ β”‚ β”‚ β”‚ β€’ Instant emergency pause β”‚ β”‚ β”‚ β”‚ β€’ Recovery system with dual confirmation β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ owns β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ πŸ” ReversoVault β”‚ β”‚ β”‚ β”‚ β€’ Core reversible transfer logic β”‚ β”‚ β”‚ β”‚ β€’ 5-layer user protection β”‚ β”‚ β”‚ β”‚ β€’ Progressive fees + insurance β”‚ β”‚ β”‚ β”‚ β€’ Circuit breaker β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜


### Contract Details

| Contract | Lines | Purpose |
|----------|-------|---------|
| **ReversoVault.sol** | 1,119 | Core vault - reversible transfers, fees, insurance |
| **EmergencyGuardian.sol** | 401 | Multi-sig owner, timelock, emergency controls |
| **ReversoMonitor.sol** | 320 | Real-time monitoring, anomaly detection, auto-pause |

### EmergencyGuardian Features

```solidity
// 🚨 INSTANT - Any guardian can pause immediately
guardian.emergencyPause("Suspicious activity detected");

// ⏱️ TIMELOCK - Critical actions need 24h + dual confirmation
guardian.proposeAction(ActionType.CHANGE_TREASURY, newTreasury);
// ... 24 hours later, DIFFERENT guardian confirms ...
guardian.confirmAction(actionId);
guardian.executeAction(actionId);

// πŸ” MULTI-SIG - Two keys required for sensitive operations
// Primary key: Hot wallet (daily operations)
// Secondary key: Hardware wallet (backup, confirms critical actions)

ReversoMonitor Features

// πŸ“Š Automatic anomaly detection
monitor.recordTransaction(sender, amount);
// Triggers alerts on:
// - Single tx > 50 ETH (HIGH alert)
// - Hourly volume > 100 ETH (HIGH alert)  
// - Hourly volume > 200 ETH (CRITICAL β†’ auto-pause)
// - Watchlisted address activity (MEDIUM alert)

// πŸ€– Chainlink Automation compatible
(bool upkeepNeeded, bytes memory data) = monitor.checkUpkeep("");

Smart Contract Security

  • βœ… ReentrancyGuard on all external functions
  • βœ… Pausable for emergency stops
  • βœ… Circuit breaker (auto-pause on suspicious activity)
  • βœ… Timelock on admin changes (24 hours via Guardian)
  • βœ… Multi-signature for critical operations
  • βœ… Guardian system for freezing suspicious transfers
  • βœ… OpenZeppelin battle-tested contracts
  • βœ… Anomaly detection with auto-pause

Web & API Security

Protection Layer Description
Content Security Policy Website Strict CSP blocking unauthorized scripts, iframes, and connections
X-Content-Type-Options Website Prevents MIME-type sniffing attacks
Referrer Policy Website Controls information leakage to external sites
Frame-ancestors: none Website Anti-clickjacking β€” prevents iframe embedding
Upgrade-insecure-requests Website Forces HTTPS on all resources
XSS Sanitizer Website escapeHtml() on all user-interpolated data
CORS Lockdown API Restricted to reverso.one only (no wildcard)
Helmet.js API HSTS (1 year + preload), CSP, referrer policy
HMAC-SHA256 API Request signature verification with timestamp + nonce
Replay Protection API Nonce-based deduplication prevents replay attacks
Rate Limiting API Global: 1000 req/15min β€” Per-key: 300 req/min
Bcrypt (10 rounds) API Industry-standard hashing for API key credentials
JWT Auth API 30-day token expiry with strong secret
Error Masking API 500 errors masked in production, no path leakage
Input Validation API Email regex, address regex, amount checks

5-Layer User Protection System

Layer 1: CANCEL
β”œβ”€β”€ Sender can cancel anytime during lock period
└── 100% refund, zero questions asked

Layer 2: RECOVERY ADDRESS 1
β”œβ”€β”€ If sender loses access, funds go here
└── Recommended: Hardware wallet (Ledger, Trezor)

Layer 3: RECOVERY ADDRESS 2
β”œβ”€β”€ If recovery 1 fails, try recovery 2
└── Recommended: Exchange account (Coinbase, Binance)

Layer 4: AUTO-REFUND
β”œβ”€β”€ If recipient never claims, auto-refund after expiry
└── Anyone can trigger (gas incentive)

Layer 5: RESCUE
β”œβ”€β”€ After 90 days post-expiry, rescue abandoned funds
└── Tries all 3 addresses, then treasury for manual handling

Audit Status

πŸ”’ Security First Approach β€” Mainnet Live

  • Smart contract follows OpenZeppelin best practices
  • ReentrancyGuard, Pausable, SafeERC20 implemented

Current Status:

  • βœ… Ethereum Mainnet deployed (all 3 contracts verified on Etherscan)
  • βœ… 7 chains live β€” Ethereum, BSC, Base, Arbitrum, Polygon, Optimism, Avalanche
  • βœ… Testnet validation completed (Sepolia β€” 7/7 live tests passed)
  • βœ… 163 tests passing (131 Hardhat + 32 API Jest β€” HMAC, validation, denylist, plans)
  • βœ… 13,000+ Foundry fuzz runs (13 property-based tests Γ— 1,000 random inputs each)
  • βœ… Slither static analysis (143 items reviewed, 0 true-positive criticals)
  • βœ… Gas benchmarks β€” all operations within L2-friendly limits
  • βœ… Website live at reverso.one
  • βœ… Enterprise API live at reverso-tu3o.onrender.com
  • πŸ”œ External audit planned (not yet scheduled)

Bug Bounty

If you find a security vulnerability, please report it responsibly via GitHub Issues or email. Severity-based rewards will be evaluated on a case-by-case basis.

Insurance Policy

Transfers sent with hasInsurance = true are eligible for coverage from the insurance pool if funds are claimed by a confirmed scammer. Coverage is subject to pool balance and requires evidence submission within 30 days.


πŸ“ Project Structure

REVERSO/
β”œβ”€β”€ πŸ“ contracts/                    # Solidity smart contracts
β”‚   β”œβ”€β”€ ReversoVault.sol             # Core vault (1,119 lines)
β”‚   β”œβ”€β”€ EmergencyGuardian.sol        # Multi-sig guardian (401 lines)
β”‚   β”œβ”€β”€ ReversoMonitor.sol           # Anomaly detection (320 lines)
β”‚   └── interfaces/
β”‚       └── IReversoVault.sol        # Contract interface
β”œβ”€β”€ πŸ“ test/                         # Test suites (131 Hardhat tests)
β”‚   β”œβ”€β”€ ReversoVault.test.ts         # Vault tests (68 tests)
β”‚   β”œβ”€β”€ SecurityContracts.test.ts    # Guardian + Monitor tests (48 tests)
β”‚   └── GasBenchmarks.test.ts       # Gas benchmarks (15 tests)
β”œβ”€β”€ πŸ“ api/                          # Enterprise REST API
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ index.ts                 # Express server
β”‚   β”‚   β”œβ”€β”€ routes/                  # Transfer, auth, webhooks, admin, usecases, billing
β”‚   β”‚   β”œβ”€β”€ middleware/              # HMAC, rate limiting, API keys
β”‚   β”‚   └── utils/                   # Fraud denylist (file + env + runtime)
β”‚   β”œβ”€β”€ test/                        # API tests (32 Jest tests)
β”‚   β”œβ”€β”€ sdk/                         # TypeScript SDK with HMAC signing
β”‚   └── config/                      # Multi-chain configuration
β”œβ”€β”€ πŸ“ website/                      # Production website (Vite)
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ main.js                  # App logic
β”‚   β”‚   └── styles/                  # CSS
β”‚   └── index.html                   # Entry point
β”œβ”€β”€ πŸ“ keeper/                       # Keeper bot (WebSocket + Monitor)
β”‚   └── src/index.ts                 # Event listener, reconnection, stats
β”œβ”€β”€ πŸ“ scripts/                      # Deploy scripts
β”‚   β”œβ”€β”€ deploy.ts                    # Single chain deploy
β”‚   β”œβ”€β”€ deploy-stack.ts              # Full 3-contract deploy + wiring
β”‚   └── deploy-multichain.ts         # Multi-chain deploy
β”œβ”€β”€ πŸ“ security/                     # Security suite
β”‚   β”œβ”€β”€ foundry-fuzz/                # Foundry fuzz tests (13,000+ runs)
β”‚   β”œβ”€β”€ slither/                     # Static analysis reports
β”‚   └── gas-benchmarks/              # Gas profiling
β”œβ”€β”€ πŸ“„ .github/workflows/ci.yml     # CI pipeline (contracts + API + website)
β”œβ”€β”€ πŸ“„ hardhat.config.ts             # Multi-chain configuration (15+ chains)
└── πŸ“„ README.md                     # This file

️ Roadmap

Phase 1: Foundation (Q4 2025) βœ…

  • Core smart contracts
  • Progressive fee structure
  • Insurance system
  • Multi-chain configuration (15+ chains)
  • Enterprise API
  • Basic documentation

Phase 2: Launch (Q1 2026) βœ…

  • Ethereum Mainnet deployment (3 contracts verified)
  • Testnet validation (Sepolia β€” 7/7 live tests passed)
  • Multi-chain deployments (BSC, Base, Arbitrum, Polygon, Optimism, Avalanche)
  • TypeScript SDK with HMAC signing
  • Email verification + password reset
  • Webhook delivery with retry + exponential backoff
  • Fraud denylist (env + file + admin API)
  • CI/CD pipeline (GitHub Actions)
  • 163 total tests (131 Hardhat + 32 API)
  • External security audit

πŸ› οΈ Development

Prerequisites

  • Node.js 18+
  • npm or yarn
  • Git

Setup

# Clone repo
git clone https://github.com/Faraone-Dev/REVERSO.git
cd REVERSO

# Install dependencies
npm install

# Setup environment
cp .env.example .env
# Edit .env with your keys

# Compile
npx hardhat compile

# Test
npx hardhat test

# Coverage
npx hardhat coverage

# Deploy
npx hardhat run scripts/deploy.ts --network sepolia

Environment Variables

# Required
PRIVATE_KEY=your-deployer-private-key
ETHERSCAN_API_KEY=your-etherscan-key

# Optional (for multi-chain)
ARBISCAN_API_KEY=
BASESCAN_API_KEY=
OPTIMISM_API_KEY=
POLYGONSCAN_API_KEY=

⚠️ Current Status & Limitations

Transparency note: REVERSO is a production-grade MVP. The sections below describe what is fully shipped and what is still in development.

Component Status Notes
Smart Contracts βœ… Production Deployed on 7 chains, verified on Etherscan, immutable
Hardhat Tests βœ… 131 passing Full coverage of vault, guardian, monitor
API Tests βœ… 32 passing HMAC, error handlers, validation, denylist logic, plan features
Foundry Fuzz Tests βœ… 13,000+ runs Invariant + property-based
HMAC + Replay Protection βœ… Production SHA-256, nonce DB, 60s drift window
Webhook Delivery βœ… Real POST Exponential backoff retry (3 attempts, 1s/2s/4s), auto-disable after 10 failures
Fraud Denylist βœ… File + Env + API Hot-reloaded every 60s, admin CRUD endpoints, persisted to JSON
Admin Stats βœ… Real SQLite byStatus, byChain, successRate, insurance aggregation
Email Verification βœ… Production Token-based, 24h expiry, Resend integration
Password Reset βœ… Production SHA-256 hashed tokens, 1h expiry, anti-enumeration
Usecase Persistence βœ… SQLite Checkout/payroll/escrow persist to DB (not in-memory)
CI/CD βœ… GitHub Actions Contracts compile+test, API type-check+test, website build
Stripe Billing βœ… Production Checkout sessions, webhook signature verification, plan upgrades
SDK βœ… Production TypeScript SDK with HMAC signing, full CRUD
Keeper Bot βœ… Code complete WebSocket listener, Monitor integration, reconnection logic
Database 🟑 SQLite (WAL) Good for MVP; migration to PostgreSQL recommended at scale
White-Label 🟑 Placeholder Endpoints exist, config not persisted to DB
SLA Reporting 🟑 Placeholder Returns static values, no real uptime tracking yet
Email Delivery 🟑 Optional Requires RESEND_API_KEY; gracefully skipped when absent

πŸ“œ License

MIT License - see LICENSE


πŸ”— Links

Resource Link
🌐 Website reverso.one
πŸ”Œ API (Live) reverso-tu3o.onrender.com
πŸ“¦ Repository github.com/Faraone-Dev/REVERSO
πŸ“„ Documentation This README
πŸ”Œ API Docs Enterprise API Section

πŸš€ What's Included

REVERSO/
β”œβ”€β”€ πŸ“ contracts/           # 3 Solidity smart contracts (1,840 lines total)
β”‚   β”œβ”€β”€ ReversoVault.sol    # Core vault with 5-layer protection
β”‚   β”œβ”€β”€ EmergencyGuardian   # Multi-sig + timelock + emergency pause
β”‚   β”œβ”€β”€ ReversoMonitor      # Anomaly detection + auto-pause
β”‚   └── interfaces/         # Contract interfaces
β”œβ”€β”€ πŸ“ test/                # Hardhat test suite (131 tests)
β”œβ”€β”€ πŸ“ security/            # Security suite (Foundry fuzz 13,000+ runs + Slither)
β”œβ”€β”€ πŸ“ api/                 # Enterprise REST API (32 API tests)
β”‚   β”œβ”€β”€ src/routes/         # Transfer, auth, webhooks, admin, usecases, billing
β”‚   β”œβ”€β”€ src/middleware/     # HMAC, rate limiting, API keys
β”‚   β”œβ”€β”€ src/utils/          # Fraud denylist (file + env + runtime)
β”‚   └── sdk/                # TypeScript SDK with HMAC signing
β”œβ”€β”€ πŸ“ website/             # Production website (Vite + vanilla JS)
β”œβ”€β”€ πŸ“ scripts/             # Deploy scripts (single & multi-chain)
β”œβ”€β”€ πŸ“„ README.md            # This file
└── πŸ“„ hardhat.config.ts    # Multi-chain configuration (15+ chains)

πŸ”§ Deployment

One-Command Full Stack Deploy

# Deploy all 3 contracts + wire them together automatically
npx hardhat run scripts/deploy-stack.ts --network ethereum

This script performs all 6 steps automatically:

  1. Deploy ReversoVault (treasury address from .env)
  2. Deploy EmergencyGuardian (secondary guardian from .env)
  3. vault.transferOwnership(guardian) β€” guardian becomes vault owner
  4. guardian.linkVault(vault) β€” guardian knows which vault to protect
  5. Deploy ReversoMonitor (vault address as constructor arg)
  6. monitor.setGuardian(guardian) β€” monitor can trigger guardian alerts

Manual Step-by-Step

# 1. Deploy ReversoVault
npx hardhat run scripts/deploy.ts --network ethereum

# 2-6. The deploy-stack.ts script handles wiring automatically.
#      See scripts/deploy-stack.ts for the full deployment flow.

πŸ›‘οΈ Deployed on Ethereum Mainnet β€” All Contracts Verified on Etherscan

ReversoVault Β· EmergencyGuardian Β· ReversoMonitor

131 Hardhat + 32 API tests passing Β· 3-contract security stack Β· Enterprise REST API


Built with ❀️ for a safer crypto future

REVERSO Protocol β€” Because everyone deserves a second chance.

Β© 2024-2026 REVERSO Protocol

About

Reversible Transaction Protocol | Deployed on 7 EVM Chains (ETH, BSC, Base, Arbitrum, Polygon, Optimism, Avalanche) | 109 Tests | Hardhat + Foundry | Time-Lock Recovery | Multi-Chain DeFi Security

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors