1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//! Sovereign Bitcoin Node Identity
//!
//! Provides the explicit cryptographic identity for a Bitcoin node
//! workload, ensuring that the running binary and configuration match
//! the expected trust anchor.
use crate::digest::TypedDigest;
use alloc::string::String;
/// Supported Bitcoin networks for node identity.
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum BitcoinNetwork {
Mainnet,
Testnet,
Signet,
Regtest,
}
/// The definitive cryptographic identity of a running Bitcoin node.
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct BitcoinNodeIdentity {
/// Unique identifier for this specific node deployment.
pub node_id: String,
/// The network this node is configured to join.
pub network: BitcoinNetwork,
/// The expected version string of Bitcoin Core (e.g., "26.0.0").
pub bitcoin_core_version: String,
/// The expected cryptographic digest of the `bitcoind` executable.
pub expected_binary_hash: TypedDigest,
/// The expected cryptographic digest of `bitcoin.conf`.
pub expected_config_hash: TypedDigest,
}
impl BitcoinNodeIdentity {
/// Creates a new `BitcoinNodeIdentity`.
#[must_use]
pub fn new(
node_id: String,
network: BitcoinNetwork,
bitcoin_core_version: String,
expected_binary_hash: TypedDigest,
expected_config_hash: TypedDigest,
) -> Self {
Self {
node_id,
network,
bitcoin_core_version,
expected_binary_hash,
expected_config_hash,
}
}
}