Blockchaininfo is your gateway to understanding the heartbeat of the Bitcoin network. Built in Rust for speed and reliability, this application connects seamlessly to your Bitcoin node via RPC, offering real-time, detailed insights into the blockchain, mempool, and overall network health.
In a world where decentralization and security are paramount, Blockchaininfo is designed to monitor and showcase the state of Bitcoin's decentralization, providing actionable insights to ensure the network remains robust and resistant to centralized control. It serves as a vital tool for tracking the health and integrity of the blockchain, offering a comprehensive view of node version distribution, network security metrics, and mempool activity.
- Real-Time Data: Stay up-to-date with live blockchain and mempool metrics, ensuring you always have the latest pulse of the network.
- Decentralization Monitoring: Analyze node version distribution to assess the diversity and resilience of the network.
- User-Friendly Dashboard: A live terminal interface delivers formatted, color-coded output, making complex data intuitive and actionable.
- Rust-Powered Efficiency: Leverage Rustβs performance and reliability for seamless and responsive interaction with your Bitcoin node.
Whether you're a developer, node operator, or Bitcoin enthusiast, Blockchaininfo empowers you with the tools to monitor, analyze, and protect the decentralized future of Bitcoin. π
.
βββ benches/
β βββ benchmark.rs # For bench testing.
βββ cargo.toml # Package information and dependencies
βββ miners.json # Miners and known coinbase wallet(s) for hash distribution and best block Miner.
βββ src/
βββ config.rs # Configuration loading and validation.
βββ display/
β βββ display_blockchain_info.rs # Displays blockchain data.
β βββ display_mempool_info.rs # Displays mempool data.
β βββ display_network_info.rs # Displays network data.
β βββ display_consensus_security_info.rs # Displays consensus security data.
βββ display.rs # Aggregates display modules.
βββ lib.rs # For testing.
βββ main.rs # Application entry point.
βββ models/ # Data and error handling modules.
β βββ block_info.rs # Block data structures.
β βββ blockchain_info.rs # Blockchain data structures and implementations.
β βββ mempool_info.rs # Mempool data structures and implementations.
β βββ network_info.rs # Network data structures.
β βββ network_totals.rs # Network data structures (bytes reveived & sent).
β βββ peer_info.rs # Peers data structures and implementations.
β βββ consensus_security.rs # Consensus security data structures.
β βββ flashing_text.rs # Data structure and implementation to flash a metric.
β βββ transaction_info.rs # Raw transaction data structures and implementations.
β βββ errors.rs # Error handling sata structures and implementations.
βββ models.rs # Aggregates Data and Error modules.
βββ rpc/ # RPC modules for interacting with the Bitcoin node.
β βββ block.rs # Block data fetching.
β βββ blockchain.rs # Blockchain data fetching.
β βββ mempool.rs # Mempool data fetching.
β βββ network.rs # Network data fetching.
β βββ network_peers.rs # Peers data model.
β βββ network_totals.rs # Network data fetching (bytes reveived & sent).
β βββ mempool_distro.rs # Fetches the sampled tx IDs for distribution metrics.
β βββ transaction.rs # Fetches Transaction for lookup.
β βββ chain_tips.rs # Fetches chain tips for consensus monitoring.
βββ rpc.rs # Aggregates RPC modules.
βββ runapp.rs # Handles TUI terminal setup and main application flow.
βββ utils.rs # Utility functions (e.g., data formatting).
Hereβs the updated README.md section with the new configuration logic (CLI flag & environment variable support). π₯
The application requires Bitcoin Core RPC credentials to function properly. These credentials can be provided in one of the following ways:
If no configuration is found, the application will prompt the user to enter their Bitcoin Core RPC credentials interactively and will automatically generate a config.toml
file. This ensures that first-time users can get started immediately without manual setup.
-
The generated
config.toml
will be saved at:./target/release/config.toml
-
After initial setup, the application will load credentials from this file on future runs.
You can still override this behavior using a custom config path (see below).
If config.toml
exists, the application will load credentials from it automatically.
By default, blockchaininfo
looks for this file in:
./target/release/config.toml
(default location)
You can specify a custom location using:
- CLI flag:
--config /path/to/config.toml
- Environment variable:
BLOCKCHAININFO_CONFIG=/path/to/config.toml
[bitcoin_rpc]
username = "your_username"
password = "your_password"
address = "http://127.0.0.1:8332"
Replace the values with your actual Bitcoin Core RPC credentials.
If config.toml
is not found, and the user does not enter credentials manually, the application will look for the following environment variables:
Variable | Description |
---|---|
RPC_USER |
Your Bitcoin Core RPC username |
RPC_PASSWORD |
Your Bitcoin Core RPC password |
RPC_ADDRESS |
The Bitcoin Core RPC server address (e.g., http://127.0.0.1:8332 , https://your-node.local ) |
Set them in your terminal before running:
export RPC_USER="your_username"
export RPC_PASSWORD="your_password"
export RPC_ADDRESS="http://127.0.0.1:8332"
On macOS, you can securely store the RPC password in the system Keychain. This is the most secure and recommended method. To set it up:
-
Add the password to your Keychain:
security add-generic-password -a bitcoin -s rpc-password -w "your_password"
-
The program will automatically retrieve the password using the Keychain during runtime.
EnsureRPC_USER
andRPC_ADDRESS
are set in either:config.toml
- Environment variables (
RPC_USER
,RPC_ADDRESS
)
The application loads configuration in the following order:
1οΈβ£ CLI Flag (--config /path/to/config.toml
) β Highest priority
2οΈβ£ Environment Variable (BLOCKCHAININFO_CONFIG
) β If no CLI flag is set
3οΈβ£ Default File Path (./target/release/config.toml
) β If no custom path is provided
4οΈβ£ Environment Variables (RPC_USER
, RPC_PASSWORD
, RPC_ADDRESS
) β If no config file is found
5οΈβ£ macOS Keychain β If running on macOS & RPC_PASSWORD
is missing
π This ensures maximum flexibility while keeping a secure & seamless setup!
- Install Rust via rustup.rs.
-
Clone the repository:
git clone https://github.com/TH3BAT/Blockchaininfo.git cd Blockchaininfo
-
Build the project:
cargo build --release
-
Ensure your Bitcoin node is running with RPC enabled.
-
Run the application:
./target/release/blockchaininfo
The program includes robust error handling:
- Configuration Errors: Ensures
config.toml
or environment variables contains valid credentials and address. - RPC Communication Errors: Handles failures in connecting to the Bitcoin node.
- Data Parsing Errors: Identifies and reports issues with parsing the JSON response.
We welcome contributions! To get involved:
- Fork the repository.
- Create a feature branch.
- Open a pull request with a clear description.
This project is licensed under the MIT License. See the LICENSE file for details.