Add default_peer_rpc_url to blockchain node configuration and refactor env setup scripts
Some checks failed
Blockchain Synchronization Verification / sync-verification (push) Failing after 2s
Cross-Node Transaction Testing / transaction-test (push) Successful in 9s
Deploy to Testnet / deploy-testnet (push) Successful in 1m12s
Integration Tests / test-service-integration (push) Successful in 2m38s
Multi-Node Blockchain Health Monitoring / health-check (push) Successful in 4s
Multi-Node Stress Testing / stress-test (push) Successful in 2s
Node Failover Simulation / failover-test (push) Successful in 2s
P2P Network Verification / p2p-verification (push) Successful in 2s
Security Scanning / security-scan (push) Successful in 31s
Some checks failed
Blockchain Synchronization Verification / sync-verification (push) Failing after 2s
Cross-Node Transaction Testing / transaction-test (push) Successful in 9s
Deploy to Testnet / deploy-testnet (push) Successful in 1m12s
Integration Tests / test-service-integration (push) Successful in 2m38s
Multi-Node Blockchain Health Monitoring / health-check (push) Successful in 4s
Multi-Node Stress Testing / stress-test (push) Successful in 2s
Node Failover Simulation / failover-test (push) Successful in 2s
P2P Network Verification / p2p-verification (push) Successful in 2s
Security Scanning / security-scan (push) Successful in 31s
- Add default_peer_rpc_url=http://127.0.0.1:8006 to blockchain-node .env.example and examples/env.example - Extract set_env() helper function in setup.sh to handle env key-value updates (add if missing, update if exists) - Ensure gossip_backend, gossip_broadcast_url, and default_peer_rpc_url are set in setup.sh node identity initialization - Replace all sed -i commands with set_env() calls in workflow scripts
This commit is contained in:
@@ -17,6 +17,7 @@ proposer_id=aitbc1-proposer
|
||||
# Gossip backend: use broadcast with Redis for cross-node communication
|
||||
gossip_backend=broadcast
|
||||
gossip_broadcast_url=redis://localhost:6379
|
||||
default_peer_rpc_url=http://127.0.0.1:8006
|
||||
|
||||
# Data
|
||||
db_path=./data/chain.db
|
||||
|
||||
@@ -92,6 +92,7 @@ CHAIN_ID=ait-testnet
|
||||
CONSENSUS=proof_of_authority
|
||||
gossip_backend=broadcast
|
||||
gossip_broadcast_url=redis://localhost:6379
|
||||
default_peer_rpc_url=http://127.0.0.1:8006
|
||||
|
||||
# =========================
|
||||
# NAT Traversal (STUN/TURN)
|
||||
|
||||
@@ -224,6 +224,17 @@ generate_uuid() {
|
||||
setup_node_identities() {
|
||||
log "Setting up unique node identities..."
|
||||
|
||||
set_env() {
|
||||
local key="$1"
|
||||
local value="$2"
|
||||
|
||||
if grep -q "^${key}=" /etc/aitbc/.env; then
|
||||
sed -i "s|^${key}=.*|${key}=${value}|g" /etc/aitbc/.env
|
||||
else
|
||||
echo "${key}=${value}" >> /etc/aitbc/.env
|
||||
fi
|
||||
}
|
||||
|
||||
# Generate unique proposer_id if not already set in /etc/aitbc/.env
|
||||
if [ ! -f "/etc/aitbc/.env" ]; then
|
||||
log "/etc/aitbc/.env does not exist, creating with unique IDs..."
|
||||
@@ -234,19 +245,27 @@ setup_node_identities() {
|
||||
# Auto-generated unique node identities
|
||||
proposer_id=$PROPOSER_ID
|
||||
p2p_node_id=$P2P_NODE_ID
|
||||
gossip_backend=broadcast
|
||||
gossip_broadcast_url=redis://localhost:6379
|
||||
default_peer_rpc_url=http://127.0.0.1:8006
|
||||
EOF
|
||||
log "Created /etc/aitbc/.env with unique IDs"
|
||||
else
|
||||
# Check if proposer_id exists, if not add it
|
||||
if ! grep -q "^proposer_id=" /etc/aitbc/.env; then
|
||||
PROPOSER_ID="ait1$(generate_uuid | tr -d '-')"
|
||||
echo "proposer_id=$PROPOSER_ID" >> /etc/aitbc/.env
|
||||
set_env proposer_id "$PROPOSER_ID"
|
||||
log "Added unique proposer_id to /etc/aitbc/.env"
|
||||
else
|
||||
log "proposer_id already exists in /etc/aitbc/.env"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Ensure blockchain gossip defaults exist even if the file was created from a minimal template
|
||||
set_env gossip_backend broadcast
|
||||
set_env gossip_broadcast_url redis://localhost:6379
|
||||
set_env default_peer_rpc_url http://127.0.0.1:8006
|
||||
|
||||
# Create /etc/aitbc/node.env with unique p2p_node_id if not exists
|
||||
if [ ! -f "/etc/aitbc/node.env" ]; then
|
||||
P2P_NODE_ID="node-$(generate_uuid | tr -d '-')"
|
||||
|
||||
@@ -44,12 +44,25 @@ openclaw execute --agent GenesisAgent --task update_genesis_config || {
|
||||
# Update .env for aitbc genesis authority configuration
|
||||
# Note: Don't overwrite auto-generated proposer_id - it will be updated with actual genesis address after wallet generation
|
||||
# Note: Don't overwrite auto-generated p2p_node_id - it must remain unique for P2P networking
|
||||
sed -i 's|keystore_path=/opt/aitbc/apps/blockchain-node/keystore|keystore_path=/var/lib/aitbc/keystore|g' /etc/aitbc/.env
|
||||
sed -i 's|keystore_password_file=/opt/aitbc/apps/blockchain-node/keystore/.password|keystore_password_file=/var/lib/aitbc/keystore/.password|g' /etc/aitbc/.env
|
||||
sed -i 's|db_path=./data/ait-mainnet/chain.db|db_path=/var/lib/aitbc/data/ait-mainnet/chain.db|g' /etc/aitbc/.env
|
||||
sed -i 's|enable_block_production=true|enable_block_production=true|g' /etc/aitbc/.env
|
||||
sed -i 's|gossip_broadcast_url=redis://127.0.0.1:6379|gossip_broadcast_url=redis://localhost:6379|g' /etc/aitbc/.env
|
||||
sed -i 's|p2p_bind_port=8005|p2p_bind_port=7070|g' /etc/aitbc/.env
|
||||
set_env() {
|
||||
local key="$1"
|
||||
local value="$2"
|
||||
|
||||
if grep -q "^${key}=" /etc/aitbc/.env; then
|
||||
sed -i "s|^${key}=.*|${key}=${value}|g" /etc/aitbc/.env
|
||||
else
|
||||
echo "${key}=${value}" >> /etc/aitbc/.env
|
||||
fi
|
||||
}
|
||||
|
||||
set_env keystore_path /var/lib/aitbc/keystore
|
||||
set_env keystore_password_file /var/lib/aitbc/keystore/.password
|
||||
set_env db_path /var/lib/aitbc/data/ait-mainnet/chain.db
|
||||
set_env enable_block_production true
|
||||
set_env gossip_backend broadcast
|
||||
set_env gossip_broadcast_url redis://localhost:6379
|
||||
set_env default_peer_rpc_url http://aitbc:8006
|
||||
set_env p2p_bind_port 7070
|
||||
|
||||
# Ensure p2p_node_id exists in node.env (preserve if already set)
|
||||
if ! grep -q "^p2p_node_id=" /etc/aitbc/node.env; then
|
||||
|
||||
@@ -53,12 +53,25 @@ openclaw execute --agent FollowerAgent --task update_follower_config --node aitb
|
||||
|
||||
# Update .env for aitbc1 follower configuration
|
||||
# Note: Don't overwrite auto-generated proposer_id or p2p_node_id - they must remain unique for P2P networking
|
||||
ssh aitbc1 'sed -i "s|keystore_path=/opt/aitbc/apps/blockchain-node/keystore|keystore_path=/var/lib/aitbc/keystore|g" /etc/aitbc/.env'
|
||||
ssh aitbc1 'sed -i "s|keystore_password_file=/opt/aitbc/apps/blockchain-node/keystore/.password|keystore_password_file=/var/lib/aitbc/keystore/.password|g" /etc/aitbc/.env'
|
||||
ssh aitbc1 'sed -i "s|db_path=./data/ait-mainnet/chain.db|db_path=/var/lib/aitbc/data/ait-mainnet/chain.db|g" /etc/aitbc/.env'
|
||||
ssh aitbc1 'sed -i "s|enable_block_production=true|enable_block_production=false|g" /etc/aitbc/.env'
|
||||
ssh aitbc1 'sed -i "s|gossip_broadcast_url=redis://127.0.0.1:6379|gossip_broadcast_url=redis://localhost:6379|g" /etc/aitbc/.env'
|
||||
ssh aitbc1 'sed -i "s|p2p_bind_port=8005|p2p_bind_port=7071|g" /etc/aitbc/.env'
|
||||
ssh aitbc1 'set_env() {
|
||||
local key="$1"
|
||||
local value="$2"
|
||||
|
||||
if grep -q "^${key}=" /etc/aitbc/.env; then
|
||||
sed -i "s|^${key}=.*|${key}=${value}|g" /etc/aitbc/.env
|
||||
else
|
||||
echo "${key}=${value}" >> /etc/aitbc/.env
|
||||
fi
|
||||
}
|
||||
|
||||
set_env keystore_path /var/lib/aitbc/keystore
|
||||
set_env keystore_password_file /var/lib/aitbc/keystore/.password
|
||||
set_env db_path /var/lib/aitbc/data/ait-mainnet/chain.db
|
||||
set_env enable_block_production false
|
||||
set_env gossip_backend broadcast
|
||||
set_env gossip_broadcast_url redis://10.1.223.40:6379
|
||||
set_env default_peer_rpc_url http://aitbc:8006
|
||||
set_env p2p_bind_port 7071'
|
||||
|
||||
# Ensure p2p_node_id exists in node.env (preserve if already set)
|
||||
ssh aitbc1 'if ! grep -q "^p2p_node_id=" /etc/aitbc/node.env; then echo "p2p_node_id=node-$(cat /proc/sys/kernel/random/uuid | tr -d '-')" >> /etc/aitbc/node.env; fi'
|
||||
|
||||
@@ -32,12 +32,25 @@ cp /etc/aitbc/blockchain.env /etc/aitbc/blockchain.env.aitbc1.backup 2>/dev/null
|
||||
echo "4. Updating environment configuration..."
|
||||
# Note: Don't overwrite auto-generated proposer_id - it will be updated with actual genesis address after wallet generation
|
||||
# Note: Don't overwrite auto-generated p2p_node_id - it must remain unique for P2P networking
|
||||
sed -i 's|keystore_path=/opt/aitbc/apps/blockchain-node/keystore|keystore_path=/var/lib/aitbc/keystore|g' /etc/aitbc/.env
|
||||
sed -i 's|keystore_password_file=/opt/aitbc/apps/blockchain-node/keystore/.password|keystore_password_file=/var/lib/aitbc/keystore/.password|g' /etc/aitbc/.env
|
||||
sed -i 's|db_path=./data/ait-mainnet/chain.db|db_path=/var/lib/aitbc/data/ait-mainnet/chain.db|g' /etc/aitbc/.env
|
||||
sed -i 's|enable_block_production=true|enable_block_production=true|g' /etc/aitbc/.env
|
||||
sed -i 's|gossip_broadcast_url=redis://127.0.0.1:6379|gossip_broadcast_url=redis://localhost:6379|g' /etc/aitbc/.env
|
||||
sed -i 's|p2p_bind_port=8005|p2p_bind_port=7070|g' /etc/aitbc/.env
|
||||
set_env() {
|
||||
local key="$1"
|
||||
local value="$2"
|
||||
|
||||
if grep -q "^${key}=" /etc/aitbc/.env; then
|
||||
sed -i "s|^${key}=.*|${key}=${value}|g" /etc/aitbc/.env
|
||||
else
|
||||
echo "${key}=${value}" >> /etc/aitbc/.env
|
||||
fi
|
||||
}
|
||||
|
||||
set_env keystore_path /var/lib/aitbc/keystore
|
||||
set_env keystore_password_file /var/lib/aitbc/keystore/.password
|
||||
set_env db_path /var/lib/aitbc/data/ait-mainnet/chain.db
|
||||
set_env enable_block_production true
|
||||
set_env gossip_backend broadcast
|
||||
set_env gossip_broadcast_url redis://localhost:6379
|
||||
set_env default_peer_rpc_url http://aitbc:8006
|
||||
set_env p2p_bind_port 7070
|
||||
|
||||
# Ensure p2p_node_id exists in node.env (preserve if already set)
|
||||
if ! grep -q "^p2p_node_id=" /etc/aitbc/node.env; then
|
||||
|
||||
@@ -28,13 +28,26 @@ cp /etc/aitbc/.env /etc/aitbc/.env.aitbc.backup 2>/dev/null || true
|
||||
# Update .env for aitbc follower node configuration
|
||||
echo "4. Updating environment configuration..."
|
||||
# Note: Don't overwrite auto-generated proposer_id or p2p_node_id - they must remain unique for P2P networking
|
||||
sed -i 's|keystore_path=/opt/aitbc/apps/blockchain-node/keystore|keystore_path=/var/lib/aitbc/keystore|g' /etc/aitbc/.env
|
||||
sed -i 's|keystore_password_file=/opt/aitbc/apps/blockchain-node/keystore/.password|keystore_password_file=/var/lib/aitbc/keystore/.password|g' /etc/aitbc/.env
|
||||
sed -i 's|db_path=./data/ait-mainnet/chain.db|db_path=/var/lib/aitbc/data/ait-mainnet/chain.db|g' /etc/aitbc/.env
|
||||
sed -i 's|enable_block_production=true|enable_block_production=false|g' /etc/aitbc/.env
|
||||
sed -i 's|gossip_broadcast_url=redis://127.0.0.1:6379|gossip_broadcast_url=redis://10.1.223.40:6379|g' /etc/aitbc/.env
|
||||
sed -i 's|p2p_bind_port=8005|p2p_bind_port=7070|g' /etc/aitbc/.env
|
||||
sed -i 's|trusted_proposers=.*|trusted_proposers=ait1apmaugx6csz50q07m99z8k44llry0zpl0yurl23hygarcey8z85qy4zr96|g' /etc/aitbc/.env
|
||||
set_env() {
|
||||
local key="$1"
|
||||
local value="$2"
|
||||
|
||||
if grep -q "^${key}=" /etc/aitbc/.env; then
|
||||
sed -i "s|^${key}=.*|${key}=${value}|g" /etc/aitbc/.env
|
||||
else
|
||||
echo "${key}=${value}" >> /etc/aitbc/.env
|
||||
fi
|
||||
}
|
||||
|
||||
set_env keystore_path /var/lib/aitbc/keystore
|
||||
set_env keystore_password_file /var/lib/aitbc/keystore/.password
|
||||
set_env db_path /var/lib/aitbc/data/ait-mainnet/chain.db
|
||||
set_env enable_block_production false
|
||||
set_env gossip_backend broadcast
|
||||
set_env gossip_broadcast_url redis://10.1.223.40:6379
|
||||
set_env default_peer_rpc_url http://aitbc1:8006
|
||||
set_env p2p_bind_port 7070
|
||||
set_env trusted_proposers ait1apmaugx6csz50q07m99z8k44llry0zpl0yurl23hygarcey8z85qy4zr96
|
||||
|
||||
# Ensure p2p_node_id exists in node.env (preserve if already set)
|
||||
if ! grep -q "^p2p_node_id=" /etc/aitbc/node.env; then
|
||||
|
||||
Reference in New Issue
Block a user