Skip to content

Esplora/ElectrumX inconsistency #467

Description

@tcharding

Hi,

I don't know if I am using bdk incorrectly, if this is a bug in bdk or if this is a bug in Esplora.

As far as I understand the software running the Esplora infrastructure is a fork of electrs with a new JSON RPC API bolted on top, it still serves the Electrum REST API.

I have a Xpriv hardcoded and am using esplora-reqwest backend and also electrum backend.

The issue I'm facing is that the Wallet<EsploraBlockchain, AnyDatabase> does not see transactions but Wallet<ElectrumBlockchain, AnyDatabase> does. (There is a single receive transaction).

So, as stated above, am I doing something wrong? Is there a bug in bdk? Or should I be reporting this on at https://github.com/Blockstream/electrs?

I have pushed the code showing this issue to https://github.com/tcharding/btc-wallet-rs/tree/esplora-no-find-tx. To verify I'm not mad, clone the repo and run RUST_LOG=info,bdk=debug,bdk::blockchain::esplora::reqwest=info cargo run -- debug.

Here is how I'm creating the wallets in case the error is obvious.

const NETWORK: Network = Network::Testnet;

/// Create a wallet that connects to bitcoind by way of esplora.
pub fn esplora_wallet(db_path: PathBuf) -> Result<Wallet<EsploraBlockchain, AnyDatabase>> {
    info!("Creating {} wallet using esplora as the indexer", NETWORK);
    debug!("Using database at: {}", db_path.display());
    let db = sled::open(db_path)?;
    let tree = db.open_tree(b"esplora wallet")?;

    let blockchain = EsploraBlockchain::new(ESPLORA_URL, 20);

    let wallet = Wallet::new(
        DESC,
        Some(CHANGE_DESC),
        NETWORK,
        AnyDatabase::from(tree),
        blockchain,
    )?;

    Ok(wallet)
}

/// Create a wallet that connects to bitcoind by way of the ElectrumX REST API.
pub fn electrs_wallet(db_path: PathBuf) -> Result<Wallet<ElectrumBlockchain, AnyDatabase>> {
    info!("Creating {} wallet using electrs as the indexer", NETWORK);
    debug!("Using database at: {}", db_path.display());
    let db = sled::open(db_path)?;
    let tree = db.open_tree(b"electrumx wallet")?;

    let client = Client::new(ELECTRS_URL)?;
    let blockchain = ElectrumBlockchain::from(client);

    let wallet = Wallet::new(
        DESC,
        Some(CHANGE_DESC),
        NETWORK,
        AnyDatabase::from(tree),
        blockchain,
    )?;

    Ok(wallet)
}

If this is the wrong place to bring this up please say and I'll move it. Thanks for your time reading this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions