open-standards/openpay/docs/deploy/launch.sh
Transaction Science 70ecd6caa0 Initial import — three open standards under one shelf
Transaction Science open standards monorepo. Each subdirectory is a
self-contained reference protocol with its own README and licence.

- openpay/    Apache-2.0  payment-acceptance stack (Rust, 26 crates)
- smart-byte/ CC-BY-4.0   content-addressed value carrier (spec)
- eoc/        CC-BY-4.0   energy-optimised compute (spec)

The wire format and the right to fork are public. The optional hosted
services are the offer; the protocols are not.
2026-05-23 07:58:09 -04:00

55 lines
2.7 KiB
Shell
Executable file

#!/usr/bin/env bash
#
# OpenPay launch script — single-command go-live on Base mainnet.
#
# Prereqs:
# 1. Rust 1.95+ installed (`rustup default stable`).
# 2. A hot wallet private key with ETH on Base mainnet for gas
# (~$5 of ETH covers thousands of USDC transfers).
# 3. The wallet pre-funded with whatever USDC float you'll be
# sending out (refunds, payouts). For receive-only pilots you
# need only ETH for gas on the eventual sweeper.
# 4. A domain pointed at this server, with Caddy/nginx terminating
# TLS in front (see docs/deploy/Caddyfile.sample).
#
# This script bootstraps a single-instance deployment with the
# embedded Minigraf .graph file on disk. Multi-instance / HA
# requires a graph daemon in front (out of scope for this script).
#
set -euo pipefail
# ─── Configuration ────────────────────────────────────────────────
# Edit these or pass via environment.
: "${OPENPAY_HOME:=/var/lib/openpay}"
: "${OPENPAY_BIND:=127.0.0.1:8080}"
: "${OPENPAY_RPC:=https://mainnet.base.org}"
# Set these in /etc/openpay/openpay.env (NOT this script) before
# running. They are referenced here as required env vars.
: "${OP_USDC_BASE_PRIVATE_KEY:?OP_USDC_BASE_PRIVATE_KEY must be set — see docs/deploy/README.md §6}"
: "${OP_API_KEYS:?OP_API_KEYS must be set — generate with: openssl rand -hex 32}"
# ─── Build ────────────────────────────────────────────────────────
echo ">>> Building op-server + op-cli with live features..."
cargo build --release \
-p op-server -p op-cli \
--features "op-rails-crypto/evm,op-webhook/reqwest-transport"
# ─── State directory ──────────────────────────────────────────────
echo ">>> Ensuring state directory at ${OPENPAY_HOME}..."
mkdir -p "${OPENPAY_HOME}"
# ─── Launch ───────────────────────────────────────────────────────
echo ">>> Starting op-server on ${OPENPAY_BIND}"
echo ">>> RPC: ${OPENPAY_RPC}"
echo ">>> State: ${OPENPAY_HOME}/data.graph"
echo
export OP_BIND_ADDR="${OPENPAY_BIND}"
export OP_GRAPH_PATH="${OPENPAY_HOME}/data.graph"
export OP_BASE_RPC_URL="${OPENPAY_RPC}"
export OP_RATE_LIMIT_PER_MINUTE="${OP_RATE_LIMIT_PER_MINUTE:-600}"
export OP_LOG_FORMAT="${OP_LOG_FORMAT:-json}"
# OP_API_KEYS + OP_USDC_BASE_PRIVATE_KEY are already in the env.
exec target/release/op-server