Skip to content

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

RequirementDetails
OFF Tokens20,000 OFF minimum stake
ENS NameMust be owned by your wallet (verified on-chain)
ServerReliable uptime, accessible HTTPS endpoint
ETHFor gas costs on Ethereum Mainnet
RedisFor 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 AmountYour Fee (3.3%)Protocol Fee (0.3% OFF)
1 ETH0.033 ETH~15 OFF from your stake
10 ETH0.33 ETH~150 OFF from your stake
100 ETH3.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

bash
git clone https://github.com/offshore-ltd/relayer.git
cd relayer
cp .env.example .env

Edit .env with your configuration:

env
# 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=3001

4. Install Redis

bash
# 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 PONG

5. Install Dependencies and Run

Option A: Docker (recommended)

bash
docker-compose up -d

Option B: Direct

bash
npm install
npm run start

Option C: PM2 (production)

bash
npm install -g pm2
pm2 start npm --name offshore-relayer -- run start
pm2 save
pm2 startup

6. Verify Your Relayer is Running

bash
curl http://localhost:3001/status

Expected response:

json
{
  "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:

nginx
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:

  1. Connect your wallet
  2. Enter your ENS name (e.g., yourname.eth)
  3. Enter your relayer address
  4. Set your fee (recommended: 330 = 3.3%)
  5. Click Approve to approve 20,000 OFF
  6. 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
ComponentPurpose
Express APIReceives withdrawal requests from the frontend
Bull QueueRedis-backed job queue with retry and backpressure
WorkerProcesses jobs: verifies proof, submits transaction
Health CheckMonitors relayer status and balance

API Endpoints

EndpointMethodDescription
/statusGETRelayer status (ready, chain, address)
/relayPOSTSubmit withdrawal for relaying
/job/:idGETCheck job status

Withdrawal Flow

  1. User generates ZK proof in browser
  2. Frontend sends proof + parameters to relayer's /relay endpoint
  3. Relayer validates: proof format, nullifier unused, amount ≥ 0.1 ETH
  4. Job enters Bull queue
  5. Worker picks up job, submits withdraw() transaction to MainPool
  6. MainPool verifies ZK proof on-chain, transfers ETH to recipient
  7. 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:

bash
pm2 logs offshore-relayer    # View logs
pm2 monit                     # Real-time monitoring
pm2 status                    # Process status

Check your relayer's on-chain stats at app.offshore.ltd/relayers/register — shows current stake, total relays, fee, and status.

Troubleshooting

IssueSolution
ECONNREFUSED on RedisStart Redis: sudo systemctl start redis-server
Transaction revertsCheck relayer has enough ETH for gas
Not receiving jobsVerify your relayer URL is accessible via HTTPS
Registration failsEnsure ENS name is owned by your connected wallet
Stake slashedGovernance action — check governance proposals

Open source privacy technology