refactor: extract script snippets to reusable scripts
All checks were successful
Documentation Validation / validate-docs (push) Successful in 9s
All checks were successful
Documentation Validation / validate-docs (push) Successful in 9s
- Create modular scripts for multi-node blockchain setup - Extract 6 core setup scripts from workflow documentation - Add master orchestrator script for complete setup - Replace inline code with script references in workflow - Create comprehensive README for script documentation - Copy scripts to aitbc for cross-node execution - Improve maintainability and reusability of setup process Scripts created: - 01_preflight_setup.sh - System preparation - 02_genesis_authority_setup.sh - Genesis node setup - 03_follower_node_setup.sh - Follower node setup - 04_create_wallet.sh - Wallet creation - 05_send_transaction.sh - Transaction sending - 06_final_verification.sh - System verification - setup_multinode_blockchain.sh - Master orchestrator This makes the workflow cleaner and scripts reusable while maintaining all functionality.
This commit is contained in:
48
scripts/workflow/05_send_transaction.sh
Executable file
48
scripts/workflow/05_send_transaction.sh
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
# Transaction Sending Script for AITBC
|
||||
# This script sends 1000 AIT from genesis to aitbc wallet
|
||||
|
||||
set -e # Exit on any error
|
||||
|
||||
echo "=== AITBC Transaction Sending ==="
|
||||
|
||||
# Get wallet address (source from wallet creation script)
|
||||
if [ -z "$WALLET_ADDR" ]; then
|
||||
echo "Error: WALLET_ADDR not set. Please run wallet creation script first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "1. Sending 1000 AIT from genesis to aitbc wallet..."
|
||||
python /opt/aitbc/cli/simple_wallet.py send \
|
||||
--from aitbc1genesis \
|
||||
--to $WALLET_ADDR \
|
||||
--amount 1000 \
|
||||
--fee 10 \
|
||||
--password-file /var/lib/aitbc/keystore/.password \
|
||||
--rpc-url http://localhost:8006
|
||||
|
||||
# Get transaction hash for verification (simplified - using RPC to check latest transaction)
|
||||
TX_HASH=$(curl -s http://localhost:8006/rpc/transactions --limit 1 | jq -r '.transactions[0].hash' 2>/dev/null || echo "Transaction hash retrieval failed")
|
||||
echo "Transaction hash: $TX_HASH"
|
||||
|
||||
# Wait for transaction to be mined
|
||||
echo "2. Waiting for transaction to be mined..."
|
||||
for i in {1..10}; do
|
||||
sleep 2
|
||||
BALANCE=$(ssh aitbc "curl -s \"http://localhost:8006/rpc/getBalance/$WALLET_ADDR\" | jq .balance")
|
||||
if [ "$BALANCE" -gt "0" ]; then
|
||||
echo "Transaction mined! Balance: $BALANCE AIT"
|
||||
break
|
||||
fi
|
||||
echo "Check $i/10: Balance = $BALANCE AIT"
|
||||
done
|
||||
|
||||
# Final balance verification
|
||||
echo "3. Final balance verification..."
|
||||
ssh aitbc "curl -s \"http://localhost:8006/rpc/getBalance/$WALLET_ADDR\" | jq ."
|
||||
|
||||
echo "✅ Transaction sent successfully!"
|
||||
echo "From: aitbc1genesis"
|
||||
echo "To: $WALLET_ADDR"
|
||||
echo "Amount: 1000 AIT"
|
||||
echo "Transaction hash: $TX_HASH"
|
||||
Reference in New Issue
Block a user