The Ultra High-Performance BSV Node
*Note: Galaxy is NOT concensus ready. For testing purposes only until release v1.0
Galaxy is an ultra high-performance Bitcoin SV (BSV) node built in Rust, designed to unboundedly scale to asynchronously parallel process over 100,000,000 transactions per second (TPS) per shard. It leverages a microservices architecture with a novel asyncTCP implementation written from the ground-up for ultra-fast, asynchronous communication. Featuring a bespoke Tiger Beetle DB for scalable UTXO storage, and Rust SV for BSV-specific libraries to power OP_RETURN data, private blockchain overlays, and Simplified Payment Verification (SPV) proofs.
- High Throughput: Targets over 100,000,000 TPS with async TCP, batching, and sharding.
- BSV-Specific:
- Supports unbounded block creation.
- Handles OP_RETURN data for enterprise applications.
- Manages private blockchain overlays with persistent storage (sled).
- Provides SPV proofs with caching and streaming.
- Supports mining with dynamic difficulty and transaction selection.
- Decentralized data distribution via torrent-like protocol with sybil resistance.
- Security:
- Token-based authentication with JWTs.
- Role-based access control (RBAC) for miners and clients.
- Rate limiting to prevent abuse (1000 req/s per service).
- Sybil resistance for decentralized data sharing.
- Microservices Architecture:
network_service: P2P networking with peer pool management.transaction_service: Transaction validation, queuing, and indexing.block_service: Block validation, assembly, and indexing with merkle root computation.storage_service: UTXO management with Tiger Beetle integration.consensus_service: Enforces BSV consensus rules.overlay_service: Manages private blockchains with streaming, storage, and indexing.validation_service: Generates/verifies SPV proofs with caching and streaming.mining_service: Supports block mining with streaming and transaction selection.auth_service: Handles authentication and authorization.alert_service: Monitors network health and sends notifications.index_service: Indexes transactions and blocks for efficient querying.api_service: Public-facing API gateway for transaction submission and block queries.torrent_service: Decentralized data distribution for aged blocks and SPV proofs, with sybil resistance and dynamic chunk sizing.merchant_service: Merchant API for transaction submission, broadcasting, status tracking, and callbacks with REST endpoints.
- Performance Optimizations:
- Asynchronous TCP communication with
bincodeserialization. - Batching for transactions, blocks, and UTXOs.
- Lean message structures with 4GB buffer hints for large blocks.
- Transaction queuing and SPV proof caching.
- Scalable UTXO storage with Tiger Beetle DB.
- Dynamic chunk sizing for efficient data transfer in torrent-like protocol.
- Prometheus metrics for performance monitoring.
- Structured logging with tracing for observability.
- Sharding for distributed processing.
- Asynchronous TCP communication with
- Monitoring:
- Alert notifications for critical events (e.g., consensus violations, performance issues).
- Transaction and block indexing for efficient querying.
- Prometheus metrics for TPS, latency, and errors across all services.
- Rust 1.88+ (stable)
- Cargo
- Tiger Beetle server (for
storage_service, see Tiger Beetle) sledfor overlay and index storageprometheus,governor,jsonwebtoken, andtracingfor metrics, rate limiting, auth, and logging
git clone https://github.com/murphsicles/Galaxy.git
cd Galaxy
cargo buildStart each service in a separate terminal:
cd network_service
cargo runcd transaction_service
cargo runcd block_service
cargo runcd storage_service
cargo runcd consensus_service
cargo runcd overlay_service
cargo runcd validation_service
cargo runcd mining_service
cargo runcd auth_service
cargo runcd alert_service
cargo runcd index_service
cargo runcd api_service
cargo runcd torrent_service
cargo runcd merchant_service
cargo runFor storage_service, start a Tiger Beetle server:
tigerbeetle start --cluster=0 --replica=0Configure a secure JWT secret key in tests/config.toml under [auth]. Generate tokens with roles (client, miner) for testing.
Test services using a TCP client or custom scripts with bincode serialization, including JWT tokens for authentication. Ensure all services are running on their respective ports:
api_service:localhost:50050network_service:localhost:50051transaction_service:localhost:50052storage_service:localhost:50053block_service:localhost:50054consensus_service:localhost:50055overlay_service:localhost:50056validation_service:localhost:50057mining_service:localhost:50058index_service:localhost:50059auth_service:localhost:50060alert_service:localhost:50061torrent_service:localhost:50062merchant_service:localhost:50063
Galaxy is configured to connect to BSV testnet nodes. See tests/config.toml for settings:
- Testnet nodes for
network_service. - Tiger Beetle server address for
storage_service. - Sharding parameters and node mappings.
- Authentication settings.
- Alert and indexing configurations.
- Overlay consensus rules (e.g.,
restrict_op_return). - Torrent service configurations for sybil resistance and chunk sizing.
- Test cases for all services, including
torrent_servicewith mocked dependencies.
Run the full pipeline test:
cd tests
chmod +x run_tests.sh
./run_tests.shMonitor performance using the GetMetrics endpoint on each service (e.g., localhost:50057 for validation_service, dynamic port for torrent_service in tests):
# Example TCP client or custom script needed for bincode+tokio communication
# Use a tool like netcat or a custom Rust client to send GetMetrics requestsMetrics include:
*_requests_total: Total requests per service (e.g.,block_requests_total,torrent_requests_total).*_latency_ms: Average request latency (ms).*_alert_count: Total alerts sent.*_index_throughput: Indexed items per second (where applicable).*_cache_hits: Cache hits (e.g.,validation_cache_hits).errors_total: Total errors (placeholder, currently 0).
Subscribe to alerts using the alert_service with a TCP client:
# Use a custom Rust client or TCP tool to send AlertRequest with bincode serializationView logs with the tracing crate at the INFO level (configurable in tests/config.toml under [metrics][log_level]).
See individual service READMEs for detailed test commands, including torrent_service/README.md for torrent-specific tests.
Galaxy uses GitHub Actions for continuous integration and deployment:
- Build: Compiles the project in release mode.
- Formatting: Ensures code adheres to
rustfmtstandards. - Linting: Runs
clippyfor code quality. - Dependency Checks: Validates dependencies with
cargo outdated. - Tests: Runs unit and integration tests, starting dependent services, including
torrent_servicewith mocked block, overlay, validation, transaction, auth, alert, storage, and proof services.
Check the CI workflow for details.
Galaxy is optimized for ultra-high performance:
- Asynchronous TCP: Non-blocking calls with
bincodeserialization. - Batching: Reduces network overhead for transactions, blocks, and UTXOs.
- Tiger Beetle DB: Scalable UTXO storage for BSVβs future dataset.
- Transaction Queuing: Handles high transaction volumes efficiently.
- SPV Proof Caching: Optimizes proof generation with LRU cache.
- Streaming: Supports continuous transaction, proof, and mining work processing.
- Decentralized Data Distribution:
torrent_serviceenables efficient sharing of aged blocks and SPV proofs with dynamic chunk sizing. - Sybil Resistance:
torrent_serviceimplements reputation-based access control to prevent sybil attacks. - Metrics: Monitors TPS, latency, and errors with Prometheus.
- Logging: Structured logging with
tracingfor observability. - Sharding: Distributed processing with shard-aware logic.
- Security: JWT authentication and RBAC for secure access.
- Rate Limiting: Prevents endpoint abuse with 1000 req/s limit.
- Alerting: Real-time notifications for network health.
- Indexing: Efficient querying for transactions and blocks.
- Merchant API: RESTful endpoints for high-volume tx processing with async delegation to other services.
| Directory | Description |
|---|---|
network_service/ |
P2P networking for BSV nodes |
transaction_service/ |
Transaction validation, queuing, indexing |
block_service/ |
Block validation, assembly, indexing |
storage_service/ |
UTXO storage with Tiger Beetle |
consensus_service/ |
BSV consensus rule enforcement |
overlay_service/ |
Private blockchain overlays |
validation_service/ |
SPV proof generation and verification |
mining_service/ |
Block mining support |
auth_service/ |
Authentication and authorization |
alert_service/ |
Network health monitoring and notifications |
index_service/ |
Transaction and block indexing |
api_service/ |
Public-facing API gateway for transaction submission and block queries |
torrent_service/ |
Decentralized data distribution for aged blocks and SPV proofs with sybil resistance |
merchant_service/ |
Merchant API for tx submission, status, and proofs |
shared/ |
Shared utilities (ShardManager) |
tests/ |
Test configuration and scripts |
Cargo.toml |
Workspace configuration |
Contributions are welcome! Please open an issue or pull request on GitHub.
Licensed under the Open BSV License. See LICENSE for details.
For questions, reach out to murphsicles via GitHub issues.
π Galaxy: Powering the future of BSV with unmatched performance!