|
|
1 rok temu | |
|---|---|---|
| .. | ||
| src | 1 rok temu | |
| .gitignore | 1 rok temu | |
| Cargo.toml | 1 rok temu | |
| Makefile | 1 rok temu | |
| README.md | 1 rok temu | |
| explorerd_config.toml | 1 rok temu | |
The explorerd is a Rust-based daemon responsible for running a DarkFi Explorer node to synchronize blockchain data with DarkFi nodes across multiple networks. During startup, it syncs missing or outdated blocks and then listens for live updates to ensure the Explorer provides accurate and up-to-date information about blockchain activity, including blocks, transactions, and key metrics such as gas consumption.
The explorerd is designed to handle real-world blockchain events, such as reorganizations ("reorgs"), missing blocks, and divergences between networks. Its primary purpose is to ensure a consistent view of DarkFi blockchain data across different networks. For its storage layer, it leverages sled to take advantage of its performance, scalability, and reliability.
Before you begin, ensure you have the following installed and configured:
explorerd).The explorerd uses a TOML configuration file to manage different environment settings, located at Explorerd Config. If no configuration file is provided, a default configuration file is automatically generated at ~/.config/darkfi/explorerd_config.toml the first time the explorerd daemon is run. This pre-configured explorerd configuration is set up to connect to the DarkFi darkfid localnet, testnet, and mainnet networks.
Below is an example of a localnet configuration for explorerd (~/.config/darkfi/explorerd_config.toml):
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Localnet Configuration
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[network_config."localnet"]
# Path to daemon database
database = "~/.local/share/darkfi/explorerd/localnet"
# darkfid JSON-RPC endpoint
endpoint = "tcp://127.0.0.1:8240"
## Localnet JSON-RPC settings
[network_config."localnet".rpc]
# JSON-RPC listen URL
rpc_listen = "tcp://127.0.0.1:14567"
# Disabled RPC methods
#rpc_disabled_methods = []
Note: When updating the configuration, ensure the endpoint field matches the rpc_listen endpoint in the respective darkfid configuration, and that the database and rpc_listen paths are consistent with your environment.
The explorerd daemon is pre-configured to support the following DarkFi blockchain environments:
localnet: Ideal for development and testing in a local environment using darkfid's localnet configuration.testnet: Used for testing the explorer with darkfid's testnet network (pending availability).mainnet: The production environment for running the explorer on DarkFi's canonical chain (pending availability).These blockchain environments are defined in the darkfid configuration file, located at Darkfid Config. The pre-configured explorerd network settings are configured to connect to the darkfid nodes running these networks.
Note: Once the testnet and mainnet are fully available, the explorer will sync more than just the genesis blocks for these networks.
Navigate to the explorerd directory, build the binary using make, and install it:
cd bin/explorer/explorerd
make install
Use
makewithoutinstallto build theexplorerdbinary inbin/explorerdwithout installing it.
darkfid networks. No additional configuration is required when running explorerd without a configuration file.endpoint in the explorerd configuration matches the rpc_listen value in the corresponding darkfid_config.toml file, enabling proper connection to the corresponding DarkFi blockchain node.Example Alignment:
darkfid_config.toml:
[network_config."localnet".rpc]
rpc_listen = "tcp://127.0.0.1:8240"
explorerd_config.toml:
[network_config."localnet"]
endpoint = "tcp://127.0.0.1:8240"
For Contrib/Localnet Networks: If you're using a contrib/localnet network, update the endpoint in your explorerd_config.toml to match the rpc_listen endpoint in the respective darkfid configuration.
For information on configuring
darkfidandminerd, refer to their respective documentation.
darkfid's localnetStart the minerd and darkfid daemons using their default configurations.
# Start the mining daemon using default settings
minerd
# Start darkfid using default settings on localnet
darkfid --network localnet
contrib/localnet/darkfid-single-nodeRun the DarkFi single-node.
# Change directory and start contrib/localnet/singlenode
cd contrib/localnet/darkfid-single-node
./tmux_sessions.sh
explorerd Daemondarkfid's localnetRun the explorerd daemon to sync with darkfid's localnet blockchain data.
# Start the explorer daemon using pre-configured localnet configuration
explorerd --network localnet
Run the explorerd daemon using a custom configuration with updated darkfid endpoint:
# Run explorerd using a custom configuration
explorerd -c explorerd-config.toml --network localnet
Ensure the
endpointinexplorerd-config.tomlis updated to match the desireddarkfidendpoint.