Skip to main content

Crate esplora_rs

Crate esplora_rs 

Source
Expand description

An async Rust client for the Blockstream Esplora HTTP API, plus the Waterfalls / QuickSync descriptor-scan endpoint.

The crate is deliberately bitcoin-dependency-free: every value in and out is a String/integer DTO (see models), so downstream crates on any bitcoin/bdk version can consume it without a version conflict.

§Constructing a client

A Client is created with the base URL of the Esplora instance (the part ending in /api); endpoint paths are joined onto it.

  • Client::new_public — unauthenticated public instances (e.g. https://blockstream.info/testnet/api).
  • Client::new — enterprise instances that require an OAuth Bearer token (e.g. https://enterprise.blockstream.info/testnet/api).

§Environment variables (read by this crate)

⚠️ The base URL is a parameter, but the enterprise credentials are read implicitly from the process environment by Client::new:

VariableRead byPurpose
ESPLORA_CLIENT_IDClient::newOAuth client_id
ESPLORA_CLIENT_SECRETClient::newOAuth client_secret
ESPLORA_TEST_LIVEtest suite onlygate for the crate’s live tests

Any APP_* variables (APP_ESPLORA_URL, APP_CHAIN_BACKEND, …) belong to the implementing program, not this crate — that program reads them and passes the resulting URL in as base_url. (An explicit with_credentials(url, id, secret) constructor that removes the env read is tracked in docs/TODO.md as E4.)

§Waterfalls / QuickSync

Client::get_waterfalls / Client::get_waterfalls_all hit <base>/waterfalls/v2/waterfalls — one descriptor query returns a wallet’s full per-index history, replacing an address-by-address gap scan. Enterprise tier only (no signet). See the Waterfalls / QuickSync docs.

Re-exports§

pub use auth::Auth;
pub use error::Error;
pub use models::AddressInfo;
pub use models::AssetInfo;
pub use models::Block;
pub use models::BlockStatus;
pub use models::FeeEstimates;
pub use models::Mempool;
pub use models::Outspend;
pub use models::RecentTx;
pub use models::Transaction;
pub use models::TxSeen;
pub use models::TxStatus;
pub use models::Utxo;
pub use models::WaterfallResponse;

Modules§

auth
error
models

Structs§

Client
An asynchronous client for the Blockstream Esplora API.