rosetta_config_bitcoin/
lib.rs

1use anyhow::Result;
2use rosetta_core::crypto::address::AddressFormat;
3use rosetta_core::crypto::Algorithm;
4use rosetta_core::BlockchainConfig;
5use std::sync::Arc;
6
7pub fn config(network: &str) -> Result<BlockchainConfig> {
8    anyhow::ensure!(network == "regtest");
9    Ok(BlockchainConfig {
10        blockchain: "bitcoin",
11        network: "regtest",
12        algorithm: Algorithm::EcdsaSecp256k1,
13        address_format: AddressFormat::Bech32("bcrt"),
14        coin: 1,
15        bip44: true,
16        utxo: true,
17        currency_unit: "satoshi",
18        currency_symbol: "tBTC",
19        currency_decimals: 8,
20        node_port: 18443,
21        node_image: "ruimarinho/bitcoin-core:23",
22        node_command: Arc::new(|_network, port| {
23            vec![
24                "-regtest=1".into(),
25                "-rpcbind=0.0.0.0".into(),
26                format!("-rpcport={port}"),
27                "-rpcallowip=0.0.0.0/0".into(),
28                "-rpcuser=rosetta".into(),
29                "-rpcpassword=rosetta".into(),
30            ]
31        }),
32        node_additional_ports: &[],
33        connector_port: 8080,
34        testnet: network == "regtest",
35    })
36}