mirror of
https://github.com/Such-Software/smirk-backend-core.git
synced 2026-10-17 07:21:32 +02:00
refactor: BTC/LTC are Electrum/Fulcrum-only (drop Core-RPC client + dep)
Electrum/Fulcrum already covers everything the backend needs for Bitcoin and Litecoin — balance, UTXOs, history, tip, verbose tx, fee estimation, and broadcast (blockchain.transaction.broadcast). A self-hosted Fulcrum relays broadcasts to its own backing node, so a separate Bitcoin Core RPC path buys nothing in the self-host model while adding the bitcoincore-rpc + bitcoin + secp256k1 + jsonrpc dependency tree and a duplicate broadcast surface. - Remove the `bitcoincore-rpc` dependency (and its transitive tree). - Slim `UtxoConfig` to pure Electrum config: drop use_local_node / rpc_url / rpc_user / rpc_pass; keep network + electrum_primary + electrum_fallbacks. A future LTC-MWEB or direct-node provider is a distinct capability (MWEB uses a scan-key model, not canonical scriptPubKeys) and would slot in at the provider seam rather than extending this client — so nothing is foreclosed by keeping the surface minimal now.
This commit is contained in:
Generated
+1
-116
@@ -270,12 +270,6 @@ dependencies = [
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "base64"
|
||||
version = "0.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
|
||||
|
||||
[[package]]
|
||||
name = "base64"
|
||||
version = "0.21.7"
|
||||
@@ -294,76 +288,12 @@ version = "1.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06"
|
||||
|
||||
[[package]]
|
||||
name = "bech32"
|
||||
version = "0.10.0-beta"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "98f7eed2b2781a6f0b5c903471d48e15f56fb4e1165df8a9a2337fd1a59d45ea"
|
||||
|
||||
[[package]]
|
||||
name = "bech32"
|
||||
version = "0.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "efbd3e1070bbdf4cd88a75264e18e8a26f7cb5c6949eadf0ceb85fb159cf08f8"
|
||||
|
||||
[[package]]
|
||||
name = "bitcoin"
|
||||
version = "0.31.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "69197dee21fe23b45f5239bf88086efaa0cb8679f3e704906eb818e8ea169c14"
|
||||
dependencies = [
|
||||
"bech32 0.10.0-beta",
|
||||
"bitcoin-internals",
|
||||
"bitcoin_hashes",
|
||||
"hex-conservative",
|
||||
"hex_lit",
|
||||
"secp256k1",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitcoin-internals"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "994dc6fcc13751c85370b7de118e672b193b9b65167bf09e258f124c97fb9685"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitcoin_hashes"
|
||||
version = "0.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "446819536d8121575eeb7e89efdbadb3f055e87e4bb66c6679a6d5cc2f4b64fd"
|
||||
dependencies = [
|
||||
"hex-conservative",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitcoincore-rpc"
|
||||
version = "0.18.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8eb70725a621848c83b3809913d5314c0d20ca84877d99dd909504b564edab00"
|
||||
dependencies = [
|
||||
"bitcoincore-rpc-json",
|
||||
"jsonrpc",
|
||||
"log",
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitcoincore-rpc-json"
|
||||
version = "0.18.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "856ffbee2e492c23bca715d72ea34aae80d58400f2bda26a82015d6bc2ec3662"
|
||||
dependencies = [
|
||||
"bitcoin",
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.3.2"
|
||||
@@ -1183,24 +1113,12 @@ version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
||||
|
||||
[[package]]
|
||||
name = "hex-conservative"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "212ab92002354b4819390025006c897e8140934349e8635c9b077f47b4dcbd20"
|
||||
|
||||
[[package]]
|
||||
name = "hex-literal"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46"
|
||||
|
||||
[[package]]
|
||||
name = "hex_lit"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3011d1213f159867b13cfd6ac92d2cd5f1345762c63be3554e84092d85a50bbd"
|
||||
|
||||
[[package]]
|
||||
name = "hkdf"
|
||||
version = "0.12.4"
|
||||
@@ -1577,17 +1495,6 @@ dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jsonrpc"
|
||||
version = "0.14.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8128f36b47411cd3f044be8c1f5cc0c9e24d1d1bfdc45f0a57897b32513053f2"
|
||||
dependencies = [
|
||||
"base64 0.13.1",
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jsonwebtoken"
|
||||
version = "9.3.1"
|
||||
@@ -2592,27 +2499,6 @@ dependencies = [
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "secp256k1"
|
||||
version = "0.28.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d24b59d129cdadea20aea4fb2352fa053712e5d713eee47d700cd4b2bc002f10"
|
||||
dependencies = [
|
||||
"bitcoin_hashes",
|
||||
"rand",
|
||||
"secp256k1-sys",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "secp256k1-sys"
|
||||
version = "0.9.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e5d1746aae42c19d583c3c1a8c646bfad910498e2051c551a7f2e3c0c9fbb7eb"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "security-framework"
|
||||
version = "3.7.0"
|
||||
@@ -2805,8 +2691,7 @@ dependencies = [
|
||||
"axum",
|
||||
"axum-extra",
|
||||
"base64 0.22.1",
|
||||
"bech32 0.12.0",
|
||||
"bitcoincore-rpc",
|
||||
"bech32",
|
||||
"bs58",
|
||||
"chrono",
|
||||
"dotenvy",
|
||||
|
||||
+2
-4
@@ -65,10 +65,8 @@ k256 = { version = "0.13", features = ["ecdh", "ecdsa", "schnorr"] }
|
||||
# Ed25519 for website auth signature verification.
|
||||
ed25519-dalek = "2.1"
|
||||
|
||||
# Bitcoin/Litecoin RPC
|
||||
bitcoincore-rpc = "0.18"
|
||||
|
||||
# Electrum protocol (balance/UTXO/history via public or self-hosted servers)
|
||||
# Bitcoin/Litecoin chain access — Electrum/Fulcrum only (reads, fee, broadcast).
|
||||
# No Core-RPC client: a self-hosted Fulcrum relays broadcasts to its own node.
|
||||
tokio-rustls = "0.25"
|
||||
rustls = "0.22"
|
||||
rustls-pki-types = "1.0"
|
||||
|
||||
+5
-17
@@ -180,14 +180,14 @@ pub struct ChainConfig {
|
||||
pub grin: GrinConfig,
|
||||
}
|
||||
|
||||
/// Bitcoin/Litecoin node + Electrum configuration.
|
||||
/// Bitcoin/Litecoin chain access via Electrum/Fulcrum. The backend runs no
|
||||
/// BTC/LTC node — reads, fee estimation, and broadcast all go through Electrum.
|
||||
/// (A self-hosted Fulcrum relays broadcasts to its own backing node, so no
|
||||
/// separate Core-RPC path is needed; a future MWEB/node provider would slot in
|
||||
/// at the provider seam rather than extending this config.)
|
||||
#[derive(Clone)]
|
||||
pub struct UtxoConfig {
|
||||
pub network: String,
|
||||
pub use_local_node: bool,
|
||||
pub rpc_url: String,
|
||||
pub rpc_user: String,
|
||||
pub rpc_pass: String,
|
||||
pub electrum_primary: Option<String>,
|
||||
pub electrum_fallbacks: Vec<String>,
|
||||
}
|
||||
@@ -310,19 +310,11 @@ impl Config {
|
||||
chains: ChainConfig {
|
||||
btc: UtxoConfig {
|
||||
network: env_or("BTC_NETWORK", "mainnet"),
|
||||
use_local_node: env_bool("BTC_USE_LOCAL_NODE", false),
|
||||
rpc_url: env_or("BTC_RPC_URL", "http://127.0.0.1:8332"),
|
||||
rpc_user: env_or("BTC_RPC_USER", "bitcoinrpc"),
|
||||
rpc_pass: env_or("BTC_RPC_PASS", ""),
|
||||
electrum_primary: env_opt("BTC_ELECTRUM_URL"),
|
||||
electrum_fallbacks: env_list("BTC_ELECTRUM_FALLBACKS"),
|
||||
},
|
||||
ltc: UtxoConfig {
|
||||
network: env_or("LTC_NETWORK", "mainnet"),
|
||||
use_local_node: env_bool("LTC_USE_LOCAL_NODE", false),
|
||||
rpc_url: env_or("LTC_RPC_URL", "http://127.0.0.1:9332"),
|
||||
rpc_user: env_or("LTC_RPC_USER", "litecoinrpc"),
|
||||
rpc_pass: env_or("LTC_RPC_PASS", ""),
|
||||
electrum_primary: env_opt("LTC_ELECTRUM_URL"),
|
||||
electrum_fallbacks: env_list("LTC_ELECTRUM_FALLBACKS"),
|
||||
},
|
||||
@@ -508,10 +500,6 @@ mod tests {
|
||||
fn valid() -> Config {
|
||||
let utxo = || UtxoConfig {
|
||||
network: "mainnet".into(),
|
||||
use_local_node: false,
|
||||
rpc_url: String::new(),
|
||||
rpc_user: String::new(),
|
||||
rpc_pass: String::new(),
|
||||
electrum_primary: None,
|
||||
electrum_fallbacks: vec![],
|
||||
};
|
||||
|
||||
@@ -773,10 +773,6 @@ mod tests {
|
||||
fn cfg() -> UtxoConfig {
|
||||
UtxoConfig {
|
||||
network: "mainnet".into(),
|
||||
use_local_node: false,
|
||||
rpc_url: String::new(),
|
||||
rpc_user: String::new(),
|
||||
rpc_pass: String::new(),
|
||||
electrum_primary: None,
|
||||
electrum_fallbacks: vec![],
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user