-
Notifications
You must be signed in to change notification settings - Fork 0
Testing Environment Setup
This guide helps you set up a comprehensive testing environment for O Blockchain features:
- Invites - Measurement invitation system
- Measurements - Water price and exchange rate submissions
- Transactions - Regular blockchain transactions
- Stability Mining - Currency stability detection and rewards
# Start O Blockchain node in regtest mode
./build/bin/bitcoind -regtest -daemon
# Wait for node to be ready
./build/bin/bitcoin-cli -regtest getblockchaininfo# Use the setup helper
python3 test_o_setup_helper.py setup
# Or manually:
./build/bin/bitcoin-cli -regtest createwallet "test_wallet"
./build/bin/bitcoin-cli -regtest generatetoaddress 101 $(./build/bin/bitcoin-cli -regtest getnewaddress)# Run the complete integration test
./build/test/functional/test_runner.py test_o_integration_complete
# Or run directly
python3 test/functional/test_o_integration_complete.py# Quick test
python3 test_o_setup_helper.py test-invites
# Check active invites
./build/bin/bitcoin-cli -regtest getactiveinvites
# Check measurement statistics
./build/bin/bitcoin-cli -regtest getmeasurementstatistics
# Generate blocks to trigger automatic invites (every 10 blocks)
./build/bin/bitcoin-cli -regtest generatetoaddress 10 $(./build/bin/bitcoin-cli -regtest getnewaddress)# Quick test
python3 test_o_setup_helper.py test-measurements
# Check if you have active invites first
./build/bin/bitcoin-cli -regtest getactiveinvites
# Submit a water price measurement (requires invite_id)
./build/bin/bitcoin-cli -regtest submitwaterpricetx "USD" 150 "invite_id_hex" "url" "https://example.com/water"
# Submit an exchange rate measurement
./build/bin/bitcoin-cli -regtest submitexchangeratetx "USD" "EUR" 9200 "invite_id_hex" "url" "https://example.com/rate"
# Check measurement statistics
./build/bin/bitcoin-cli -regtest getmeasurementstatistics# Quick test
python3 test_o_setup_helper.py test-transactions
# Generate blocks for maturity
./build/bin/bitcoin-cli -regtest generatetoaddress 101 $(./build/bin/bitcoin-cli -regtest getnewaddress)
# Get balance
./build/bin/bitcoin-cli -regtest getbalance
# Send transaction
./build/bin/bitcoin-cli -regtest sendtoaddress "o1..." 10.0
# Generate block to confirm
./build/bin/bitcoin-cli -regtest generatetoaddress 1 $(./build/bin/bitcoin-cli -regtest getnewaddress)# Quick test
python3 test_o_setup_helper.py test-stability
# Check stabilization statistics
./build/bin/bitcoin-cli -regtest getstabilizationstats
# Check integration status
./build/bin/bitcoin-cli -regtest getstabilizationintegrationstatus
# Check consensus statistics
./build/bin/bitcoin-cli -regtest getstabilizationconsensusstats
# Check unstable currencies
./build/bin/bitcoin-cli -regtest getstabilizationcoinstats
# Generate blocks (stability mining checks happen during block processing)
./build/bin/bitcoin-cli -regtest generatetoaddress 20 $(./build/bin/bitcoin-cli -regtest getnewaddress)# 1. Start node
./build/bin/bitcoind -regtest -daemon
# 2. Create wallet
./build/bin/bitcoin-cli -regtest createwallet "test"
# 3. Generate blocks to maturity
python3 test_o_setup_helper.py setup# Check initial state
./build/bin/bitcoin-cli -regtest getactiveinvites
./build/bin/bitcoin-cli -regtest getmeasurementstatistics
# Generate blocks to trigger automatic invites (every 10 blocks)
current_height=$(./build/bin/bitcoin-cli -regtest getblockcount | jq -r '.blocks')
next_10=$(( (($current_height / 10) + 1) * 10 ))
blocks_needed=$(( $next_10 - $current_height ))
./build/bin/bitcoin-cli -regtest generatetoaddress $blocks_needed $(./build/bin/bitcoin-cli -regtest getnewaddress)
# Check for new invites
./build/bin/bitcoin-cli -regtest getactiveinvites# Get an active invite
invites=$(./build/bin/bitcoin-cli -regtest getactiveinvites)
invite_id=$(echo $invites | jq -r '.[0].invite_id' 2>/dev/null || echo "")
if [ -n "$invite_id" ] && [ "$invite_id" != "null" ]; then
# Submit water price measurement
./build/bin/bitcoin-cli -regtest submitwaterpricetx "USD" 150 "$invite_id" "url" "https://example.com/water"
# Submit exchange rate measurement
./build/bin/bitcoin-cli -regtest submitexchangeratetx "USD" "EUR" 9200 "$invite_id" "url" "https://example.com/rate"
# Mine blocks to include transactions
./build/bin/bitcoin-cli -regtest generatetoaddress 1 $(./build/bin/bitcoin-cli -regtest getnewaddress)
# Check statistics
./build/bin/bitcoin-cli -regtest getmeasurementstatistics
else
echo "No active invites available (may need verified users)"
fi# Check current stability status
./build/bin/bitcoin-cli -regtest getstabilizationstats
./build/bin/bitcoin-cli -regtest getstabilizationconsensusstats
# Generate blocks to trigger stability checks
./build/bin/bitcoin-cli -regtest generatetoaddress 20 $(./build/bin/bitcoin-cli -regtest getnewaddress)
# Check if stability mining created rewards
./build/bin/bitcoin-cli -regtest getstabilizationstats
./build/bin/bitcoin-cli -regtest getstabilizationcoinstatsThe test_o_setup_helper.py script provides easy testing:
# Setup environment
python3 test_o_setup_helper.py setup
# Test individual features
python3 test_o_setup_helper.py test-invites
python3 test_o_setup_helper.py test-measurements
python3 test_o_setup_helper.py test-transactions
python3 test_o_setup_helper.py test-stability
# Run all tests
python3 test_o_setup_helper.py test-allRun comprehensive functional tests:
# Run complete integration test
./build/test/functional/test_runner.py test_o_integration_complete
# Run specific test suites
./build/test/functional/test_runner.py test_o_databases
./build/test/functional/test_runner.py test_o_blockchain_sync
./build/test/functional/test_runner.py test_o_features_and_performance
# Run all O-specific tests
./build/test/functional/test_runner.py test_o_*-
Verified Users (for invites to work properly)
- Invites require verified users to be available
- May need to create user verification transactions first
-
Active Invites (for submitting measurements)
- Invites are created automatically every 10 blocks
- Or can be created manually via RPC
-
Sufficient Blocks (for stability mining)
- Stability checks happen during block processing
- Need blocks with measurement data for stability mining to trigger
No Active Invites:
- Solution: Generate more blocks (invites created every 10 blocks)
- May need verified users first
Cannot Submit Measurements:
- Solution: Get an active invite first via
getactiveinvites - Use the invite_id in measurement submission
Stability Mining Not Triggering:
- Solution: Need unstable currencies (requires measurement data)
- Generate more blocks after submitting measurements
Transactions Failing:
- Solution: Ensure you have mature coins (101+ blocks after generation)
- Check balance with
getbalance
# Tail debug log in real-time
tail -f ~/.bitcoin/regtest/debug.log
# Filter for O-specific logs
tail -f ~/.bitcoin/regtest/debug.log | grep -i "O "
# Filter for specific features
tail -f ~/.bitcoin/regtest/debug.log | grep -i "measurement"
tail -f ~/.bitcoin/regtest/debug.log | grep -i "stabilization"
tail -f ~/.bitcoin/regtest/debug.log | grep -i "invite"# Check database directories
ls -la ~/.bitcoin/regtest/brightid_users/
ls -la ~/.bitcoin/regtest/measurements/
ls -la ~/.bitcoin/regtest/business_miners/
# Check database sizes
du -sh ~/.bitcoin/regtest/brightid_users/
du -sh ~/.bitcoin/regtest/measurements/
du -sh ~/.bitcoin/regtest/business_miners/Use this checklist to verify all features are working:
- Node starts and connects
- Databases are initialized (3 LevelDB databases)
- Wallets can be created
- Blocks can be generated
- Invites appear after block generation (every 10 blocks)
- Measurements can be submitted (with valid invite)
- Measurements appear in statistics
- Regular transactions work
- Stability mining statistics are available
- Multi-node sync works (if testing with multiple nodes)
After basic testing works:
- Test with multiple nodes - Set up network of 2+ nodes
- Test measurement validation - Submit measurements and validate them
- Test stability edge cases - Create scenarios with unstable currencies
- Performance testing - Test with many measurements and transactions
- Stress testing - Test system under load
- Check if already running:
ps aux | grep bitcoind - Check port availability:
lsof -i :18444 - Check data directory permissions
- Ensure node is running:
getblockchaininfo - Check wallet is loaded:
listwallets - Check debug logs for errors
- Some features may be under development
- Check if RPC commands are registered:
help <command> - Review debug logs for more details
Quick Reference: Run python3 test_o_setup_helper.py test-all for a complete test overview.
Β© 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