--- description: Marketplace scenario testing, GPU provider testing, transaction tracking, and verification procedures title: Multi-Node Blockchain Setup - Marketplace Module version: 1.0 --- # Multi-Node Blockchain Setup - Marketplace Module This module covers marketplace scenario testing, GPU provider testing, transaction tracking, verification procedures, and performance testing for the AITBC blockchain marketplace. ## Prerequisites - Complete [Core Setup Module](multi-node-blockchain-setup-core.md) - Complete [Operations Module](multi-node-blockchain-operations.md) - Complete [Advanced Features Module](multi-node-blockchain-advanced.md) - Complete [Production Module](multi-node-blockchain-production.md) - Stable blockchain network with AI operations enabled - Marketplace services configured ## Marketplace Setup ### Initialize Marketplace Services ```bash cd /opt/aitbc && source venv/bin/activate # Create marketplace service provider wallet ./aitbc-cli create --name marketplace-provider --password 123 # Fund marketplace provider wallet ./aitbc-cli send --from genesis-ops --to $(./aitbc-cli list | grep "marketplace-provider:" | cut -d" " -f2) --amount 10000 --password 123 # Create AI service provider wallet ./aitbc-cli create --name ai-service-provider --password 123 # Fund AI service provider wallet ./aitbc-cli send --from genesis-ops --to $(./aitbc-cli list | grep "ai-service-provider:" | cut -d" " -f2) --amount 5000 --password 123 # Create GPU provider wallet ./aitbc-cli create --name gpu-provider --password 123 # Fund GPU provider wallet ./aitbc-cli send --from genesis-ops --to $(./aitbc-cli list | grep "gpu-provider:" | cut -d" " -f2) --amount 5000 --password 123 ``` ### Create Marketplace Services ```bash # Create AI inference service ./aitbc-cli marketplace --action create \ --name "AI Image Generation Service" \ --type ai-inference \ --price 100 \ --wallet marketplace-provider \ --description "High-quality image generation using advanced AI models" \ --parameters "resolution:512x512,style:photorealistic,quality:high" # Create AI training service ./aitbc-cli marketplace --action create \ --name "Custom Model Training Service" \ --type ai-training \ --price 500 \ --wallet ai-service-provider \ --description "Custom AI model training on your datasets" \ --parameters "model_type:custom,epochs:100,batch_size:32" # Create GPU rental service ./aitbc-cli marketplace --action create \ --name "GPU Cloud Computing" \ --type gpu-rental \ --price 50 \ --wallet gpu-provider \ --description "High-performance GPU rental for AI workloads" \ --parameters "gpu_type:rtx4090,memory:24gb,bandwidth:high" # Create data processing service ./aitbc-cli marketplace --action create \ --name "Data Analysis Pipeline" \ --type data-processing \ --price 25 \ --wallet marketplace-provider \ --description "Automated data analysis and processing" \ --parameters "data_format:csv,json,xml,output_format:reports" ``` ### Verify Marketplace Services ```bash # List all marketplace services ./aitbc-cli marketplace --action list # Check service details ./aitbc-cli marketplace --action search --query "AI" # Verify provider listings ./aitbc-cli marketplace --action my-listings --wallet marketplace-provider ./aitbc-cli marketplace --action my-listings --wallet ai-service-provider ./aitbc-cli marketplace --action my-listings --wallet gpu-provider ``` ## Scenario Testing ### Scenario 1: AI Image Generation Workflow ```bash # Customer creates wallet and funds it ./aitbc-cli create --name customer-1 --password 123 ./aitbc-cli send --from genesis-ops --to $(./aitbc-cli list | grep "customer-1:" | cut -d" " -f2) --amount 1000 --password 123 # Customer browses marketplace ./aitbc-cli marketplace --action search --query "image generation" # Customer bids on AI image generation service SERVICE_ID=$(./aitbc-cli marketplace --action search --query "AI Image Generation" | grep "service_id" | head -1 | cut -d" " -f2) ./aitbc-cli marketplace --action bid --service-id $SERVICE_ID --amount 120 --wallet customer-1 # Service provider accepts bid ./aitbc-cli marketplace --action accept-bid --service-id $SERVICE_ID --bid-id "bid_123" --wallet marketplace-provider # Customer submits AI job ./aitbc-cli ai-submit --wallet customer-1 --type inference \ --prompt "Generate a futuristic cityscape with flying cars" \ --payment 120 --service-id $SERVICE_ID # Monitor job completion ./aitbc-cli ai-status --job-id "ai_job_123" # Customer receives results ./aitbc-cli ai-results --job-id "ai_job_123" # Verify transaction completed ./aitbc-cli balance --name customer-1 ./aitbc-cli balance --name marketplace-provider ``` ### Scenario 2: GPU Rental + AI Training ```bash # Researcher creates wallet and funds it ./aitbc-cli create --name researcher-1 --password 123 ./aitbc-cli send --from genesis-ops --to $(./aitbc-cli list | grep "researcher-1:" | cut -d" " -f2) --amount 2000 --password 123 # Researcher rents GPU for training GPU_SERVICE_ID=$(./aitbc-cli marketplace --action search --query "GPU" | grep "service_id" | head -1 | cut -d" " -f2) ./aitbc-cli marketplace --action bid --service-id $GPU_SERVICE_ID --amount 60 --wallet researcher-1 # GPU provider accepts and allocates GPU ./aitbc-cli marketplace --action accept-bid --service-id $GPU_SERVICE_ID --bid-id "bid_456" --wallet gpu-provider # Researcher submits training job with allocated GPU ./aitbc-cli ai-submit --wallet researcher-1 --type training \ --model "custom-classifier" --dataset "/data/training_data.csv" \ --payment 500 --gpu-allocated 1 --memory 8192 # Monitor training progress ./aitbc-cli ai-status --job-id "ai_job_456" # Verify GPU utilization ./aitbc-cli resource status --agent-id "gpu-worker-1" # Training completes and researcher gets model ./aitbc-cli ai-results --job-id "ai_job_456" ``` ### Scenario 3: Multi-Service Pipeline ```bash # Enterprise creates wallet and funds it ./aitbc-cli create --name enterprise-1 --password 123 ./aitbc-cli send --from genesis-ops --to $(./aitbc-cli list | grep "enterprise-1:" | cut -d" " -f2) --amount 5000 --password 123 # Enterprise creates data processing pipeline DATA_SERVICE_ID=$(./aitbc-cli marketplace --action search --query "data processing" | grep "service_id" | head -1 | cut -d" " -f2) ./aitbc-cli marketplace --action bid --service-id $DATA_SERVICE_ID --amount 30 --wallet enterprise-1 # Data provider processes raw data ./aitbc-cli marketplace --action accept-bid --service-id $DATA_SERVICE_ID --bid-id "bid_789" --wallet marketplace-provider # Enterprise submits AI analysis on processed data ./aitbc-cli ai-submit --wallet enterprise-1 --type inference \ --prompt "Analyze processed data for trends and patterns" \ --payment 200 --input-data "/data/processed_data.csv" # Results are delivered and verified ./aitbc-cli ai-results --job-id "ai_job_789" # Enterprise pays for services ./aitbc-cli marketplace --action settle-payment --service-id $DATA_SERVICE_ID --amount 30 --wallet enterprise-1 ``` ## GPU Provider Testing ### GPU Resource Allocation Testing ```bash # Test GPU allocation and deallocation ./aitbc-cli resource allocate --agent-id "gpu-worker-1" --gpu 1 --memory 8192 --duration 3600 # Verify GPU allocation ./aitbc-cli resource status --agent-id "gpu-worker-1" # Test GPU utilization monitoring ./aitbc-cli resource utilization --type gpu --period "1h" # Test GPU deallocation ./aitbc-cli resource deallocate --agent-id "gpu-worker-1" # Test concurrent GPU allocations for i in {1..5}; do ./aitbc-cli resource allocate --agent-id "gpu-worker-$i" --gpu 1 --memory 8192 --duration 1800 & done wait # Monitor concurrent GPU usage ./aitbc-cli resource status ``` ### GPU Performance Testing ```bash # Test GPU performance with different workloads ./aitbc-cli ai-submit --wallet gpu-provider --type inference \ --prompt "Generate high-resolution image" --payment 100 \ --gpu-allocated 1 --resolution "1024x1024" ./aitbc-cli ai-submit --wallet gpu-provider --type training \ --model "large-model" --dataset "/data/large_dataset.csv" --payment 500 \ --gpu-allocated 1 --batch-size 64 # Monitor GPU performance metrics ./aitbc-cli ai-metrics --agent-id "gpu-worker-1" --period "1h" # Test GPU memory management ./aitbc-cli resource test --type gpu --memory-stress --duration 300 ``` ### GPU Provider Economics ```bash # Test GPU provider revenue tracking ./aitbc-cli marketplace --action revenue --wallet gpu-provider --period "24h" # Test GPU utilization optimization ./aitbc-cli marketplace --action optimize --wallet gpu-provider --metric "utilization" # Test GPU pricing strategy ./aitbc-cli marketplace --action pricing --service-id $GPU_SERVICE_ID --strategy "dynamic" ``` ## Transaction Tracking ### Transaction Monitoring ```bash # Monitor all marketplace transactions ./aitbc-cli marketplace --action transactions --period "1h" # Track specific service transactions ./aitbc-cli marketplace --action transactions --service-id $SERVICE_ID # Monitor customer transaction history ./aitbc-cli transactions --name customer-1 --limit 50 # Track provider revenue ./aitbc-cli marketplace --action revenue --wallet marketplace-provider --period "24h" ``` ### Transaction Verification ```bash # Verify transaction integrity ./aitbc-cli transaction verify --tx-id "tx_123" # Check transaction confirmation status ./aitbc-cli transaction status --tx-id "tx_123" # Verify marketplace settlement ./aitbc-cli marketplace --action verify-settlement --service-id $SERVICE_ID # Audit transaction trail ./aitbc-cli marketplace --action audit --period "24h" ``` ### Cross-Node Transaction Tracking ```bash # Monitor transactions across both nodes ./aitbc-cli transactions --cross-node --period "1h" # Verify transaction propagation ./aitbc-cli transaction verify-propagation --tx-id "tx_123" # Track cross-node marketplace activity ./aitbc-cli marketplace --action cross-node-stats --period "24h" ``` ## Verification Procedures ### Service Quality Verification ```bash # Verify service provider performance ./aitbc-cli marketplace --action verify-provider --wallet ai-service-provider # Check service quality metrics ./aitbc-cli marketplace --action quality-metrics --service-id $SERVICE_ID # Verify customer satisfaction ./aitbc-cli marketplace --action satisfaction --wallet customer-1 --period "7d" ``` ### Compliance Verification ```bash # Verify marketplace compliance ./aitbc-cli marketplace --action compliance-check --period "24h" # Check regulatory compliance ./aitbc-cli marketplace --action regulatory-audit --period "30d" # Verify data privacy compliance ./aitbc-cli marketplace --action privacy-audit --service-id $SERVICE_ID ``` ### Financial Verification ```bash # Verify financial transactions ./aitbc-cli marketplace --action financial-audit --period "24h" # Check payment processing ./aitbc-cli marketplace --action payment-verify --period "1h" # Reconcile marketplace accounts ./aitbc-cli marketplace --action reconcile --period "24h" ``` ## Performance Testing ### Load Testing ```bash # Simulate high transaction volume for i in {1..100}; do ./aitbc-cli marketplace --action bid --service-id $SERVICE_ID --amount 100 --wallet test-wallet-$i & done wait # Monitor system performance under load ./aitbc-cli marketplace --action performance-metrics --period "5m" # Test marketplace scalability ./aitbc-cli marketplace --action stress-test --transactions 1000 --concurrent 50 ``` ### Latency Testing ```bash # Test transaction processing latency time ./aitbc-cli marketplace --action bid --service-id $SERVICE_ID --amount 100 --wallet test-wallet # Test AI job submission latency time ./aitbc-cli ai-submit --wallet test-wallet --type inference --prompt "test" --payment 50 # Monitor overall system latency ./aitbc-cli marketplace --action latency-metrics --period "1h" ``` ### Throughput Testing ```bash # Test marketplace throughput ./aitbc-cli marketplace --action throughput-test --duration 300 --transactions-per-second 10 # Test AI job throughput ./aitbc-cli marketplace --action ai-throughput-test --duration 300 --jobs-per-minute 5 # Monitor system capacity ./aitbc-cli marketplace --action capacity-metrics --period "24h" ``` ## Troubleshooting Marketplace Issues ### Common Marketplace Problems | Problem | Symptoms | Diagnosis | Fix | |---|---|---|---| | Service not found | Search returns no results | Check service listing status | Verify service is active and listed | | Bid acceptance fails | Provider can't accept bids | Check provider wallet balance | Ensure provider has sufficient funds | | Payment settlement fails | Transaction stuck | Check blockchain status | Verify blockchain is healthy | | GPU allocation fails | Can't allocate GPU resources | Check GPU availability | Verify GPU resources are available | | AI job submission fails | Job not processing | Check AI service status | Verify AI service is operational | ### Advanced Troubleshooting ```bash # Diagnose marketplace connectivity ./aitbc-cli marketplace --action connectivity-test # Check marketplace service health ./aitbc-cli marketplace --action health-check # Verify marketplace data integrity ./aitbc-cli marketplace --action integrity-check # Debug marketplace transactions ./aitbc-cli marketplace --action debug --transaction-id "tx_123" ``` ## Automation Scripts ### Automated Marketplace Testing ```bash #!/bin/bash # automated_marketplace_test.sh echo "Starting automated marketplace testing..." # Create test wallets ./aitbc-cli create --name test-customer --password 123 ./aitbc-cli create --name test-provider --password 123 # Fund test wallets CUSTOMER_ADDR=$(./aitbc-cli list | grep "test-customer:" | cut -d" " -f2) PROVIDER_ADDR=$(./aitbc-cli list | grep "test-provider:" | cut -d" " -f2) ./aitbc-cli send --from genesis-ops --to $CUSTOMER_ADDR --amount 1000 --password 123 ./aitbc-cli send --from genesis-ops --to $PROVIDER_ADDR --amount 1000 --password 123 # Create test service ./aitbc-cli marketplace --action create \ --name "Test AI Service" \ --type ai-inference \ --price 50 \ --wallet test-provider \ --description "Automated test service" # Test complete workflow SERVICE_ID=$(./aitbc-cli marketplace --action list | grep "Test AI Service" | grep "service_id" | cut -d" " -f2) ./aitbc-cli marketplace --action bid --service-id $SERVICE_ID --amount 60 --wallet test-customer ./aitbc-cli marketplace --action accept-bid --service-id $SERVICE_ID --bid-id "test_bid" --wallet test-provider ./aitbc-cli ai-submit --wallet test-customer --type inference --prompt "test image" --payment 60 # Verify results echo "Test completed successfully!" ``` ### Performance Monitoring Script ```bash #!/bin/bash # marketplace_performance_monitor.sh while true; do TIMESTAMP=$(date +%Y-%m-%d_%H:%M:%S) # Collect metrics ACTIVE_SERVICES=$(./aitbc-cli marketplace --action list | grep -c "service_id") PENDING_BIDS=$(./aitbc-cli marketplace --action pending-bids | grep -c "bid_id") TOTAL_VOLUME=$(./aitbc-cli marketplace --action volume --period "1h") # Log metrics echo "$TIMESTAMP,services:$ACTIVE_SERVICES,bids:$PENDING_BIDS,volume:$TOTAL_VOLUME" >> /var/log/aitbc/marketplace_performance.log sleep 60 done ``` ## Dependencies This marketplace module depends on: - **[Core Setup Module](multi-node-blockchain-setup-core.md)** - Basic node setup - **[Operations Module](multi-node-blockchain-operations.md)** - Daily operations - **[Advanced Features Module](multi-node-blockchain-advanced.md)** - Advanced features - **[Production Module](multi-node-blockchain-production.md)** - Production deployment ## Next Steps After mastering marketplace operations, proceed to: - **[Reference Module](multi-node-blockchain-reference.md)** - Configuration and verification reference ## Best Practices - Always test marketplace operations with small amounts first - Monitor GPU resource utilization during AI jobs - Verify transaction confirmations before considering operations complete - Use proper wallet management for different roles (customers, providers) - Implement proper logging for marketplace transactions - Regularly audit marketplace compliance and financial integrity