Become a Relayer
Relayers are the backbone of Offshore Cash privacy. They submit withdrawal transactions on behalf of users, breaking the on-chain link between deposits and withdrawals. In return, relayers earn 100% of the ETH withdrawal fee.
Requirements
| Requirement | Details |
|---|---|
| OFF Tokens | 20,000 OFF minimum stake |
| ENS Name | Must be owned by your wallet (verified on-chain) |
| Server | Reliable uptime, accessible HTTPS endpoint |
| ETH | For gas costs on Ethereum Mainnet |
| Redis | For job queue management |
Economics
- Revenue: You keep 100% of the ETH fee charged on each withdrawal
- Typical fee: 3.3% (330 basis points) — configurable at registration
- Protocol fee: 0.3% in OFF is deducted from your stake per withdrawal and sent to stakers
- Stake: Higher stake = higher priority in weighted random relayer selection
Example Revenue
| Withdrawal Amount | Your Fee (3.3%) | Protocol Fee (0.3% OFF) |
|---|---|---|
| 1 ETH | 0.033 ETH | ~15 OFF from your stake |
| 10 ETH | 0.33 ETH | ~150 OFF from your stake |
| 100 ETH | 3.3 ETH | ~1,500 OFF from your stake |
Step-by-Step Setup
1. Get an ENS Name
Purchase an ENS name at app.ens.domains. The name must resolve to your wallet address. The RelayerRegistry verifies ownership on-chain via the ENS Registry contract.
2. Get OFF Tokens
You need at least 20,000 OFF to register. OFF is available on Uniswap V4 (ETH/OFF pair, 1% fee tier).
3. Clone and Configure
git clone https://github.com/offshore-ltd/relayer.git
cd relayer
cp .env.example .envEdit .env with your configuration:
# Your relayer's private key (DO NOT share)
PRIVATE_KEY=0x...
# Ethereum RPC (Alchemy, Infura, or your own node)
RPC_URL=https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY
# Chain configuration
CHAIN_ID=1
# Contract addresses (Ethereum Mainnet)
MAIN_POOL_ADDRESS=0x7dc44f4d7d13853a14b26169c8479bec3939649d
DEPOSIT_FACTORY_ADDRESS=0x2d664e02b8ae9745254f32fbb74e3cb97e262920
RELAYER_REGISTRY_ADDRESS=0x8d5ba08b1db746803da28dcda69e0065eb52d45a
# Your relayer's public address
RELAYER_ADDRESS=0xYourRelayerAddress
# Redis connection
REDIS_URL=redis://localhost:6379
# Server
PORT=30014. Install Redis
# Ubuntu/Debian
sudo apt update && sudo apt install redis-server -y
sudo systemctl enable redis-server
sudo systemctl start redis-server
# Verify
redis-cli ping # Should return PONG5. Install Dependencies and Run
Option A: Docker (recommended)
docker-compose up -dOption B: Direct
npm install
npm run startOption C: PM2 (production)
npm install -g pm2
pm2 start npm --name offshore-relayer -- run start
pm2 save
pm2 startup6. Verify Your Relayer is Running
curl http://localhost:3001/statusExpected response:
{
"ready": true,
"chainId": 1,
"relayerAddress": "0x...",
"version": "1.0.0"
}7. Set Up HTTPS
Your relayer must be accessible via HTTPS. Use nginx as a reverse proxy:
server {
listen 443 ssl;
server_name your-relayer-domain.com;
ssl_certificate /path/to/cert.pem;
ssl_certificate_key /path/to/key.pem;
location /relayer {
proxy_pass http://localhost:3001;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}8. Register On-Chain
Go to app.offshore.ltd/relayers/register:
- Connect your wallet
- Enter your ENS name (e.g.,
yourname.eth) - Enter your relayer address
- Set your fee (recommended: 330 = 3.3%)
- Click Approve to approve 20,000 OFF
- Click Register as Relayer
Your relayer will appear in the app's relayer list and start receiving withdrawal requests.
Architecture
User → App → Relayer API → Bull Queue → Worker → Ethereum
↓
Redis| Component | Purpose |
|---|---|
| Express API | Receives withdrawal requests from the frontend |
| Bull Queue | Redis-backed job queue with retry and backpressure |
| Worker | Processes jobs: verifies proof, submits transaction |
| Health Check | Monitors relayer status and balance |
API Endpoints
| Endpoint | Method | Description |
|---|---|---|
/status | GET | Relayer status (ready, chain, address) |
/relay | POST | Submit withdrawal for relaying |
/job/:id | GET | Check job status |
Withdrawal Flow
- User generates ZK proof in browser
- Frontend sends proof + parameters to relayer's
/relayendpoint - Relayer validates: proof format, nullifier unused, amount ≥ 0.1 ETH
- Job enters Bull queue
- Worker picks up job, submits
withdraw()transaction to MainPool - MainPool verifies ZK proof on-chain, transfers ETH to recipient
- Relayer receives fee, protocol deducts 0.3% OFF from relayer stake
Managing Your Stake
After registration, you can manage your stake at app.offshore.ltd/relayers/register:
- Add Stake — increase your collateral (higher priority in selection)
- Request Unstake — initiate withdrawal (7-day cooldown)
- Execute Unstake — claim OFF after cooldown
- Cancel Unstake — cancel pending withdrawal
WARNING
If your stake drops below 20,000 OFF, your relayer is automatically deactivated and will not receive new withdrawal requests.
Monitoring
Monitor your relayer with PM2:
pm2 logs offshore-relayer # View logs
pm2 monit # Real-time monitoring
pm2 status # Process statusCheck your relayer's on-chain stats at app.offshore.ltd/relayers/register — shows current stake, total relays, fee, and status.
Troubleshooting
| Issue | Solution |
|---|---|
ECONNREFUSED on Redis | Start Redis: sudo systemctl start redis-server |
| Transaction reverts | Check relayer has enough ETH for gas |
| Not receiving jobs | Verify your relayer URL is accessible via HTTPS |
| Registration fails | Ensure ENS name is owned by your connected wallet |
| Stake slashed | Governance action — check governance proposals |