A comprehensive testing and analysis tool for the Rubix blockchain network that simulates real blockchain transactions, measures performance metrics, and generates detailed reports.
start-all.batchmod +x start-all.sh
./start-all.shThis will automatically:
- Start the Go backend server on port 8080
- Start the Vite development server (React + TypeScript) on port 5173
- Open your browser to http://localhost:5173
To stop all services, press Ctrl+C in the terminal or close the command windows.
- Node.js (v18 or higher) - Download
- Go (v1.21 or higher) - Download
- Git - Download
- Build tools:
- Windows: MinGW or Visual Studio Build Tools
- Linux: gcc, make
- Mac: Xcode Command Line Tools
- OS: Windows 10/11, Ubuntu 20.04+, macOS 11+
- RAM: Minimum 8GB (16GB recommended for 20+ nodes)
- Storage: 5GB free space
- Ports: 8080, 5173, 20000-20030, 10500-10530 must be available
If you prefer to set up manually or the start-all script doesn't work:
git clone <your-repository-url>
cd rubix-simulatornpm installcd backend
go mod download
cd ..Terminal 1 - Backend:
# Option 1: Use helper script
./run-backend.sh # Linux/Mac
run-backend.bat # Windows
# Option 2: Manual start
cd backend
go run cmd/server/main.goTerminal 2 - Frontend:
# Option 1: Use helper script
./run-frontend.sh # Linux/Mac
run-frontend.bat # Windows
# Option 2: Manual start
npm run devThe simulator creates a Rubix blockchain network with two types of nodes:
- Quorum Nodes (7): Fixed consensus nodes that validate all transactions
- Transaction Nodes (2-20): Variable nodes that perform RBT token transfers
-
Open the Application
- Navigate to http://localhost:5173
- Verify "Backend Connected" badge is green
-
Configure Simulation Parameters
- Transaction Nodes: Enter 2-20 (these are added to the 7 quorum nodes)
- Number of Transactions: Enter 1-500
- Example: 3 transaction nodes = 10 total nodes (7 quorum + 3 transaction)
-
Start Simulation
- Click "Start Simulation" button
- First run takes 5-10 minutes (downloads and builds Rubix platform)
- Subsequent runs are faster (nodes remain running)
-
Monitor Progress
- Real-time progress bar shows completed transactions
- Live metrics update as transactions complete
- Transaction details display with status and timing
-
View Results
- Success/failure counts with percentage
- Transaction timing (min/avg/max)
- Total tokens transferred
- Per-node performance breakdown
-
Download Report
- Click "Download PDF Report" for comprehensive analysis
- Includes charts, graphs, and detailed transaction logs
Important: Nodes remain running between simulations for faster testing.
- Shutdown Nodes: Click "Shutdown All Nodes" button when finished testing
- Script Shutdown: Use
./shutdown-nodes.sh(Linux/Mac) orshutdown-nodes.bat(Windows) - Auto-cleanup: Nodes automatically shut down when backend stops (Ctrl+C)
- Fresh Start: Shutdown nodes โ Start new simulation
- Pairing: Nodes are paired (sender/receiver) to prevent conflicts
- Token Generation: Each sender creates 10 RBT tokens
- Transfer: Tokens sent via Rubix blockchain protocol
- Validation: Quorum nodes reach consensus
- Confirmation: Blockchain confirms transaction completion
- Fast: < 1 minute (small amounts, optimal conditions)
- Normal: 1-3 minutes (typical transactions)
- Slow: 3-6+ minutes (large amounts or network congestion)
- Executive summary with key metrics
- Transaction timeline visualization
- Success/failure distribution charts
- Token amount vs. time correlation
- Node performance comparison
- Complete transaction logs with IDs
Symptom: "Backend Offline" badge in UI
Solutions:
- Ensure backend is running (
go run cmd/server/main.go) - Check port 8080 is not in use:
netstat -an | findstr 8080 - Verify firewall settings allow localhost connections
Error: "Failed to start Rubix nodes"
Solutions:
- Check disk space (need ~500MB per node)
- Ensure required ports are free (20000-20030, 10500-10530)
- Delete
backend/rubix-datafolder and retry - Run with administrator/sudo privileges if needed
Symptom: High transaction failure rate
Solutions:
- Ensure minimum 2 transaction nodes configured
- Check backend logs for specific errors
- Shutdown and restart nodes if running for extended period
- Verify network connectivity
rubix-simulator/
โโโ backend/ # Go backend server
โ โโโ cmd/
โ โ โโโ server/ # Server entry point
โ โ โโโ test_rubix/ # Test utilities
โ โโโ config/ # Configuration files
โ โโโ internal/ # Core business logic
โ โ โโโ config/ # Config management
โ โ โโโ handlers/ # HTTP request handlers
โ โ โโโ middleware/ # HTTP middleware
โ โ โโโ models/ # Data structures
โ โ โโโ rubix/ # Rubix blockchain integration
โ โ โโโ services/ # Node, transaction, report services
โ โโโ reports/ # Generated PDF reports
โ โโโ rubix-data/ # Runtime node data (git-ignored)
โ โโโ go.mod # Go dependencies
โ โโโ README.md # Backend documentation
โโโ src/ # React frontend (Vite + TypeScript)
โ โโโ components/ # UI components
โ โ โโโ ui/ # Shadcn/ui components (Radix UI)
โ โโโ hooks/ # React hooks
โ โโโ lib/ # Utilities
โ โโโ pages/ # Application pages
โโโ public/ # Static assets
โโโ package.json # Frontend dependencies
โโโ vite.config.ts # Vite configuration
โโโ tailwind.config.ts # Tailwind CSS config
โโโ start-all.bat # Windows quick-start script
โโโ start-all.sh # Linux/Mac quick-start script
โโโ run-backend.* # Backend start scripts
โโโ run-frontend.* # Frontend start scripts
โโโ shutdown-nodes.* # Node shutdown scripts
โโโ README.md # This file
# Backend tests
cd backend
go test ./...
# Frontend linting
npm run lint# Backend formatting
cd backend
go fmt ./...
# Frontend linting and formatting
npm run lint- Backend changes: Modify services in
backend/internal/ - Frontend changes: Update components in
src/components/ - API changes: Update handlers in
backend/internal/handlers/
- Quick Test: 2 nodes, 10 transactions
- Standard Test: 5 nodes, 50 transactions
- Stress Test: 15-20 nodes, 200-500 transactions
- Each node: ~100-200MB RAM
- Backend server: ~50MB RAM
- Frontend dev server: ~100MB RAM
- Disk: ~50MB per node for blockchain data
POST /simulate- Start new simulationGET /report/{id}- Get simulation statusGET /reports/{id}/download- Download PDF reportPOST /nodes/stop- Shutdown all nodesGET /health- Backend health check
{
"nodes": 5, // Transaction nodes (2-20)
"transactions": 50 // Number of transactions (1-500)
}- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
This project is licensed under the MIT License - see LICENSE file for details.
For issues or questions:
- Check the troubleshooting section above
- Review backend logs in terminal
- Check node logs in
backend/rubix-data/node*/log.txt - Open an issue on GitHub with:
- Error messages
- Steps to reproduce
- System information
# Start everything
./start-all.sh # Linux/Mac
start-all.bat # Windows
# Manual start
cd backend && go run cmd/server/main.go # Terminal 1
npm run dev # Terminal 2
# Build for production
cd backend && go build -o rubix-simulator cmd/server/main.go
npm run build
# Alternative build scripts
./build.sh # Linux/Mac
build.bat # Windows