-
Notifications
You must be signed in to change notification settings - Fork 0
Multi Node Testing
This guide explains how to test O Blockchain features across multiple nodes to verify network synchronization, transaction propagation, and distributed consensus.
Multi-node testing is essential to verify that:
- O Blockchain transactions propagate correctly across the network
- All nodes maintain consistent blockchain state
- Measurement data is synchronized across nodes
- User verification data is shared across the network
- Invites and measurements are queryable on all nodes
The Python test uses the Bitcoin test framework for comprehensive automated testing:
# Run the multi-node test
python3 test/functional/test_o_multi_node.py
# Or via test runner (if registered)
./test/functional/test_runner.py test_o_multi_nodeWhat it tests:
- β User verification transaction propagation
- β Measurement invite creation and propagation
- β Block propagation and synchronization
- β Measurement system status across nodes
- β Currency system consistency
- β Chain consistency (same best block hash)
- β Network connectivity
For quick manual testing and debugging:
# Run the bash test script
./test_multi_node_deployment.shWhat it does:
- Sets up 3 nodes with separate data directories
- Connects them in a network topology
- Tests basic O Blockchain features
- Keeps nodes running for interactive testing
Node Configuration:
- Node 1: RPC port 18443, Network port 18444
- Node 2: RPC port 18444, Network port 18445
- Node 3: RPC port 18445, Network port 18446
Interacting with nodes:
# Node 1
./build/bin/bitcoin-cli -regtest -conf=/tmp/o_blockchain_test/node1/bitcoin.conf \
-rpcuser=node1 -rpcpassword=node1pass -rpcwallet=wallet1 <command>
# Node 2
./build/bin/bitcoin-cli -regtest -conf=/tmp/o_blockchain_test/node2/bitcoin.conf \
-rpcuser=node2 -rpcpassword=node2pass -rpcwallet=wallet2 <command>
# Node 3
./build/bin/bitcoin-cli -regtest -conf=/tmp/o_blockchain_test/node3/bitcoin.conf \
-rpcuser=node3 -rpcpassword=node3pass -rpcwallet=wallet3 <command>If you want to set up nodes manually:
mkdir -p /tmp/o_test/node1 /tmp/o_test/node2 /tmp/o_test/node3Node 1 (/tmp/o_test/node1/bitcoin.conf):
regtest=1
server=1
listen=1
port=18444
rpcport=18443
rpcuser=node1
rpcpassword=node1pass
rpcallowip=127.0.0.1
datadir=/tmp/o_test/node1Node 2 (/tmp/o_test/node2/bitcoin.conf):
regtest=1
server=1
listen=1
port=18445
rpcport=18444
rpcuser=node2
rpcpassword=node2pass
rpcallowip=127.0.0.1
datadir=/tmp/o_test/node2
addnode=127.0.0.1:18444Node 3 (/tmp/o_test/node3/bitcoin.conf):
regtest=1
server=1
listen=1
port=18446
rpcport=18445
rpcuser=node3
rpcpassword=node3pass
rpcallowip=127.0.0.1
datadir=/tmp/o_test/node3
addnode=127.0.0.1:18444# Terminal 1 - Node 1
./build/bin/bitcoind -conf=/tmp/o_test/node1/bitcoin.conf
# Terminal 2 - Node 2
./build/bin/bitcoind -conf=/tmp/o_test/node2/bitcoin.conf
# Terminal 3 - Node 3
./build/bin/bitcoind -conf=/tmp/o_test/node3/bitcoin.conf# On each node
./build/bin/bitcoin-cli -regtest -conf=/tmp/o_test/node1/bitcoin.conf -rpcuser=node1 -rpcpassword=node1pass createwallet wallet1
./build/bin/bitcoin-cli -regtest -conf=/tmp/o_test/node2/bitcoin.conf -rpcuser=node2 -rpcpassword=node2pass createwallet wallet2
./build/bin/bitcoin-cli -regtest -conf=/tmp/o_test/node3/bitcoin.conf -rpcuser=node3 -rpcpassword=node3pass createwallet wallet3# Generate blocks on node 1
./build/bin/bitcoin-cli -regtest -conf=/tmp/o_test/node1/bitcoin.conf -rpcuser=node1 -rpcpassword=node1pass -rpcwallet=wallet1 -generate 101# Check block heights on all nodes
./build/bin/bitcoin-cli -regtest -conf=/tmp/o_test/node1/bitcoin.conf -rpcuser=node1 -rpcpassword=node1pass getblockcount
./build/bin/bitcoin-cli -regtest -conf=/tmp/o_test/node2/bitcoin.conf -rpcuser=node2 -rpcpassword=node2pass getblockcount
./build/bin/bitcoin-cli -regtest -conf=/tmp/o_test/node3/bitcoin.conf -rpcuser=node3 -rpcpassword=node3pass getblockcount
# Should all show the same heightCreate a user verification on one node and verify it's queryable on others:
# On Node 1
./build/bin/bitcoin-cli -regtest -conf=/tmp/o_test/node1/bitcoin.conf \
-rpcuser=node1 -rpcpassword=node1pass -rpcwallet=wallet1 \
submituserverificationtx "user123" "brightid" "USA" "OUSD" '{"score":95}' "0102030405060708090a0b0c0d0e0f" 0
# Generate block to include transaction
./build/bin/bitcoin-cli -regtest -conf=/tmp/o_test/node1/bitcoin.conf \
-rpcuser=node1 -rpcpassword=node1pass -rpcwallet=wallet1 -generate 1
# Wait for sync, then verify on Node 2
# (User verification queries would be available here)# Create invite on Node 1
./build/bin/bitcoin-cli -regtest -conf=/tmp/o_test/node1/bitcoin.conf \
-rpcuser=node1 -rpcpassword=node1pass -rpcwallet=wallet1 \
submitinvitetx "invite_id" "<pubkey>" "water_price" "USD" 1734900000
# Generate block
./build/bin/bitcoin-cli -regtest -conf=/tmp/o_test/node1/bitcoin.conf \
-rpcuser=node1 -rpcpassword=node1pass -rpcwallet=wallet1 -generate 1
# Verify invite is queryable on Node 2
./build/bin/bitcoin-cli -regtest -conf=/tmp/o_test/node2/bitcoin.conf \
-rpcuser=node2 -rpcpassword=node2pass -rpcwallet=wallet2 \
getactiveinvites# Generate blocks on different nodes
./build/bin/bitcoin-cli -regtest -conf=/tmp/o_test/node1/bitcoin.conf \
-rpcuser=node1 -rpcpassword=node1pass -rpcwallet=wallet1 -generate 5
# Wait a few seconds, then verify all nodes have same height
./build/bin/bitcoin-cli -regtest -conf=/tmp/o_test/node1/bitcoin.conf -rpcuser=node1 -rpcpassword=node1pass getblockcount
./build/bin/bitcoin-cli -regtest -conf=/tmp/o_test/node2/bitcoin.conf -rpcuser=node2 -rpcpassword=node2pass getblockcount
./build/bin/bitcoin-cli -regtest -conf=/tmp/o_test/node3/bitcoin.conf -rpcuser=node3 -rpcpassword=node3pass getblockcount# Check measurement readiness on all nodes
for i in 1 2 3; do
echo "Node $i:"
./build/bin/bitcoin-cli -regtest -conf=/tmp/o_test/node$i/bitcoin.conf \
-rpcuser=node$i -rpcpassword=node${i}pass -rpcwallet=wallet$i \
getmeasurementreadinessstatistics
done# List currencies on all nodes (should be identical)
for i in 1 2 3; do
echo "Node $i currencies:"
./build/bin/bitcoin-cli -regtest -conf=/tmp/o_test/node$i/bitcoin.conf \
-rpcuser=node$i -rpcpassword=node${i}pass -rpcwallet=wallet$i \
listcurrencies | head -20
doneAfter running tests, verify:
- All nodes have the same block height
- All nodes have the same best block hash
- Transactions created on one node appear in mempool/blocks of other nodes
- O Blockchain transactions (user verification, invites, measurements) propagate correctly
- Measurement data is queryable on all nodes
- Currency listings are consistent across nodes
- Network connectivity is maintained (each node has >= 1 peer)
- Check firewall settings
- Verify ports are not in use:
lsof -i :18444 - Check node logs for connection errors
- Manually add peers:
addnode 127.0.0.1:18444 add
- Check
getconnectioncounton each node - Verify network connectivity:
getpeerinfo - Force sync:
syncwithvalidationinterfacequeue(if available)
- Ensure wallets are loaded:
loadwallet wallet1 - Check wallet balance:
getbalance - Verify RPC commands are registered:
help submituserverificationtx - Check logs for errors related to O Blockchain features
To clean up test directories:
# Stop all nodes
pkill -f "bitcoind.*regtest"
# Remove test directories
rm -rf /tmp/o_blockchain_test
rm -rf /tmp/o_test- Run the Python functional test for comprehensive automated testing
- Use the bash script for quick manual verification
- Test with more nodes (4, 5, 10+) to stress test network propagation
- Test with network partitions and reconnections
- Verify measurement averaging works correctly across nodes
- Test stability mining rewards distribution
Β© O International
A Nonprofit Association Focused on the Creation of a Water Price-Based Stable Coin
Association de Loi 1901 β France NumΓ©ro de Siret (French SIREN): 924 014 467 00014