Skip to content

Latest commit

 

History

History
100 lines (72 loc) · 3.29 KB

File metadata and controls

100 lines (72 loc) · 3.29 KB

@blobkit/proxy-server

Express.js server that executes EIP-4844 blob transactions on behalf of browser clients after verifying escrow payments.

Installation

npm install @blobkit/proxy-server

Requirements

  • Node.js v18 or later
  • Redis 6.0 or later (for persistent job queue)

Usage

# Using CLI
npx blobkit-proxy --rpc-url $RPC_URL \
                  --private-key $PRIVATE_KEY \
                  --escrow-contract 0x1234567890123456789012345678901234567890

# Using environment variables
export RPC_URL=$MAINNET_RPC_URL
export PRIVATE_KEY=$PRIVATE_KEY
export ESCROW_CONTRACT=0x1234567890123456789012345678901234567890
npx blobkit-proxy

Configuration

Environment Variable Required Default Description
RPC_URL Yes - Ethereum RPC endpoint
ESCROW_CONTRACT Yes - Escrow contract address
REQUEST_SIGNING_SECRET Yes - HMAC secret (min 32 chars)
PRIVATE_KEY No* - Private key for dev (see below)
AWS_KMS_KEY_ID No* - AWS KMS key ARN for production
PORT No 3000 Server port
HOST No 0.0.0.0 Server host
CHAIN_ID No 1 Ethereum chain ID
PROXY_FEE_PERCENT No 0 Fee percentage (0-10)
LOG_LEVEL No info Log level: debug/info/warn/error
REDIS_URL No redis://localhost:6379 Redis connection URL

*One key management option required (PRIVATE_KEY for development, AWS_KMS_KEY_ID for production)

The trusted setup file should be in the standard Ethereum KZG ceremony format. Download from ceremony.ethereum.org.

Redis Persistence

The proxy server uses Redis for persistent job queue management. This ensures that pending job completions survive server restarts.

Redis Setup

# Using Docker
docker run -d -p 6379:6379 redis:7-alpine

# Using Homebrew (macOS)
brew install redis
brew services start redis

# Using apt (Ubuntu/Debian)
sudo apt update
sudo apt install redis-server
sudo systemctl start redis-server

Redis Configuration

The server connects to Redis using the REDIS_URL environment variable. Examples:

# Local Redis
REDIS_URL=redis://localhost:6379

# Redis with authentication
REDIS_URL=redis://username:password@hostname:6379

# Redis with TLS
REDIS_URL=rediss://hostname:6380

Testing and Development

npm test               # Run tests
npm run test:coverage  # Run tests with coverage
npm run build          # Build for production
npm run dev            # Start development server
npm run lint           # Lint code
npm run type-check     # TypeScript checking

Documentation

See /docs/proxy/ for deployment guides and API documentation.