@shroud-fi/self-host-relayer
v0.1.3
Published
Self-hosted gasless sweep relayer service for ShroudFi — Fastify server that broadcasts EIP-7702 / ERC-2771 sweep transactions.
Maintainers
Readme
@shroud-fi/self-host-relayer
Self-hosted gasless sweep relayer service. Fastify server for EIP-7702 / ERC-2771 sweep broadcasts.
npm i @shroud-fi/self-host-relayerWhat it does
@shroud-fi/self-host-relayer is a small Fastify HTTP server that operators can run to broadcast gasless sweep transactions for ShroudFi stealth addresses. It accepts signed authorizations from agents, broadcasts the on-chain tx, and returns a receipt.
This is the server-side counterpart to @shroud-fi/relayer. The reference deployment runs at https://api.shroudfi.live; this package lets you stand up your own.
Routes
| Route | Method | Purpose |
|---|---|---|
| /health | GET | Liveness — returns { ok: true, chainId }. |
| /relay | POST | ERC-20 sweep via EIP-2612 permit + ERC-2771 metaTx. |
| /relay-eth | POST | ETH sweep via EIP-7702 delegated authorization. |
Quick start
import { startServer } from '@shroud-fi/self-host-relayer';
await startServer({
chainId: 8453,
port: 8789,
rpcUrl: process.env.BASE_RPC_URL!,
relayerContract: '0x44f35ED32516AE8247aF5ec4ED5d5BEb501631d1',
forwarderPrivateKey: process.env.FORWARDER_KEY! as `0x${string}`,
allowedOrigins: ['https://your-dapp.example'],
rateLimitPerMinute: 30,
});Or use the production entry that reads everything from env:
node node_modules/@shroud-fi/self-host-relayer/dist/esm/prod-entry.jsRequired env: SHROUDFI_RELAYER_CONTRACT, SHROUDFI_RELAYER_FORWARDER_KEY, SHROUDFI_RELAYER_RPC_URL, SHROUDFI_RELAYER_ORIGINS, SHROUDFI_RELAYER_CHAIN_ID, SHROUDFI_RELAYER_PORT. Optional: SHROUDFI_RELAYER_RATE_LIMIT, SHROUDFI_ETH_RELAYER_CONTRACT.
Deployment
A reference PM2 ecosystem config + droplet ops playbook ships with the source repo. The relayer is designed to run as a singleton fork — cluster mode would race on the forwarder EOA nonce.
Privacy invariants
- The relayer never sees transfer amounts in plaintext — sweep authorizations encode the destination + token, not the amount; the contract reads
balanceOfat execution. - No request logging by default. Set
DEBUG_DIAGNOSTICS=1only for local debugging. - Single-purpose forwarder EOA — should hold only the gas balance needed for sweep ops. Do not reuse with personal wallets.
License
MIT — see LICENSE.
Part of the ShroudFi privacy SDK for AI agents on Base.
