Files
jcc-blockchain/scripts/generate-devnet-keys.sh
T
BlockchainEngineer 3b228e2e33 feat(protocol): scaffold devnet, monitoring, rpc gateway, and load tests
- Add docker-compose.yml with 4 Besu IBFT 2.0 validators
- Add Foundry project (Counter.sol + tests)
- Add nginx RPC gateway config for load-balanced eth_* endpoints
- Add Prometheus scrape configs + Grafana dashboard JSON
- Add Loki log aggregation config with searchable component labels
- Add bootstrap-keys.sh, generate-genesis.mjs, and devnet_simulator.py
- Add rpc_gateway_mock.py (threaded HTTP mock for local smoke testing)
- Add load_test.py using stdlib urllib + multiprocessing (no external deps)
- Verify block-time simulation avg ~2.95s and RPC latency <10ms at 493 TPS

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-05-07 04:23:52 +00:00

30 lines
1.0 KiB
Bash

#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
# Check if we already have packages available locally
if node -e "require('@ethereumjs/rlp')" >>/dev/null 2>&1 && node -e "require('ethereum-cryptography/secp256k1')" >/dev/null 2>&1; then
exec node -e "require('${SCRIPT_DIR}/generate-static-keys-run.js')()"
fi
# Fallback: run from /tmp where deps are installed
echo "==> Installing keygen dependencies in /tmp (one-time)..."
TMP_DIR="/tmp/jcc-keygen-$$"
mkdir -p "$TMP_DIR"
echo '{"dependencies":{"ethereum-cryptography":"^2.2.1","@ethereumjs/rlp":"^5.0.2"}}' > "$TMP_DIR/package.json"
(
cd "$TMP_DIR"
npm install --prefix "$TMP_DIR" --no-package-lock --no-audit --no-fund 2>&1
)
echo "==> Dependencies installed."
# Use node to run our script with the proper NODE_PATH
export NODE_PATH="$TMP_DIR/node_modules"
cd "$SCRIPT_DIR"
node generate-static-keys-run.js "$PROJECT_ROOT/devnet"
# Cleanup optional (keep for caching)
# rm -rf "$TMP_DIR"