Open antiyro opened 1 year ago
Can I take this one @antiyro ?
params required are those from bitcoin-da config: host: String, user: String, pass: String,
There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a 👍 Because this issue is marked as stale, it will be closed and locked in 7 days if no further activity occurs. Thank you for your contributions!
Description:
Develop a configuration structure for Bitcoin in a manner analogous to Ethereum's configuration in
config.rs
. This structure will facilitate the connection and interaction with a Bitcoin node.Tasks:
Define Default Constants:
Bitcoin Node RPC Endpoint:
DEFAULT_ETHEREUM_NODE
for Bitcoin. This will be the default RPC endpoint for a Bitcoin node.DEFAULT_BITCOIN_NODE: &str = "127.0.0.1:8332";
(This is a common default for Bitcoin Core's RPC server)Bitcoin Network Type:
DEFAULT_BITCOIN_NETWORK: &str = "testnet";
Other Constants:
Create
BitcoinConfig
Struct:Fields:
rpc_provider
: RPC endpoint for the Bitcoin node.network_type
: Specifies which Bitcoin network to connect to (mainnet, testnet, regtest).Deserialization:
serde
crate to enable easy deserialization from configuration files, as done in the Ethereum configuration.Example Structure:
Implement Default Methods for Configuration:
Default RPC Endpoint:
DEFAULT_BITCOIN_NODE
constant.Default Network Type:
DEFAULT_BITCOIN_NETWORK
constant.Loading Configuration from File:
try_from_file
method fromEthereumConfig
to work forBitcoinConfig
. This will allow loading of configurations from a specified file.Complete Default Implementation:
Default
trait forBitcoinConfig
to provide default values for each field.Example Methods:
fn default_network_type() -> String { DEFAULT_BITCOIN_NETWORK.to_string() }