Files
smom-dbis-138/scripts/deployment/bootstrap-z-chain-local.sh
zaragoza444 e35ad9047c
Some checks failed
CI/CD Pipeline / Solidity Contracts (push) Failing after 1m13s
CI/CD Pipeline / Security Scanning (push) Successful in 2m30s
CI/CD Pipeline / Lint and Format (push) Failing after 45s
CI/CD Pipeline / Terraform Validation (push) Failing after 26s
CI/CD Pipeline / Kubernetes Validation (push) Successful in 28s
Deploy ChainID 138 / Deploy ChainID 138 (push) Failing after 39s
HYBX OMNL TypeScript & anchor / token-aggregation build + reconcile artifact (push) Failing after 21s
Validation / validate-genesis (push) Successful in 30s
Validation / validate-terraform (push) Failing after 25s
Validation / validate-kubernetes (push) Failing after 13s
Validation / validate-smart-contracts (push) Failing after 16s
Validation / validate-security (push) Failing after 1m28s
Validation / validate-documentation (push) Failing after 19s
Verify Deployment / Verify Deployment (push) Failing after 53s
feat: add Z Chain 900002 ecosystem with wallet, Z Bot, and deploy scripts
Ship Z Chain slot, International Z Wallet routes, in-app Z Bot APIs, Besu bootstrap, and local/production deployment tooling for digital.omdnl.org.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-06 05:25:10 -07:00

71 lines
2.1 KiB
Bash

#!/usr/bin/env bash
# Bootstrap local Z Chain (chainId 900002) with Hyperledger Besu via Docker.
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
NETWORK_DIR="${Z_CHAIN_NETWORK_DIR:-$ROOT/logs/z-chain-network}"
GENESIS_CONFIG="$ROOT/config/z-chain-network-config.json"
RPC_PORT="${Z_CHAIN_RPC_PORT:-8546}"
CONTAINER_NAME="${Z_CHAIN_BESU_CONTAINER:-z-chain-besu}"
cd "$ROOT"
if ! command -v docker &>/dev/null; then
echo "ERROR: docker is required. Install Docker and retry."
exit 1
fi
if [[ ! -f "$GENESIS_CONFIG" ]]; then
echo "ERROR: missing $GENESIS_CONFIG"
exit 1
fi
mkdir -p "$NETWORK_DIR"
if [[ ! -f "$NETWORK_DIR/genesis.json" ]]; then
echo "Generating IBFT2 network files in $NETWORK_DIR ..."
docker run --rm \
-v "$ROOT/config:/config:ro" \
-v "$NETWORK_DIR:/network" \
hyperledger/besu:latest \
operator generate-blockchain-config \
--config-file=/config/z-chain-network-config.json \
--to=/network
fi
if docker ps -a --format '{{.Names}}' | grep -qx "$CONTAINER_NAME"; then
echo "Removing existing container $CONTAINER_NAME ..."
docker rm -f "$CONTAINER_NAME" >/dev/null
fi
NODE_KEY="$NETWORK_DIR/keys/node1/key"
GENESIS="$NETWORK_DIR/genesis.json"
if [[ ! -f "$NODE_KEY" || ! -f "$GENESIS" ]]; then
echo "ERROR: generated network files missing under $NETWORK_DIR"
exit 1
fi
echo "Starting Z Chain Besu on http://127.0.0.1:$RPC_PORT (chainId 900002) ..."
docker run -d \
--name "$CONTAINER_NAME" \
-p "${RPC_PORT}:8545" \
-v "$NETWORK_DIR:/network:ro" \
hyperledger/besu:latest \
--data-path=/tmp/besu \
--genesis-file=/network/genesis.json \
--node-private-key-file=/network/keys/node1/key \
--rpc-http-enabled \
--rpc-http-api=ETH,NET,WEB3,IBFT,ADMIN,DEBUG \
--rpc-http-host=0.0.0.0 \
--rpc-http-port=8545 \
--rpc-http-cors-origins="*" \
--host-allowlist="*" \
--min-gas-price=0
echo ""
echo "Z Chain local RPC: http://127.0.0.1:$RPC_PORT"
echo "Export: CHAIN_900002_RPC_URL=http://127.0.0.1:$RPC_PORT"
echo "Export: VITE_RPC_URL_900002=http://127.0.0.1:$RPC_PORT"
echo "Verify: cast chain-id --rpc-url http://127.0.0.1:$RPC_PORT"