-
- All Implemented Interfaces:
-
java.lang.AutoCloseable,org.bitcoindevkit.Disposable,org.bitcoindevkit.EsploraClientInterface
public class EsploraClient implements Disposable, AutoCloseable, EsploraClientInterface
Wrapper around an esplora_client::BlockingClient which includes an internal in-memory transaction cache to avoid re-fetching already downloaded transactions.
-
-
Constructor Summary
Constructors Constructor Description EsploraClient(String url, String proxy)Creates a new bdk client from an esplora_client::BlockingClient.
-
Method Summary
Modifier and Type Method Description Unitdestroy()Unitclose()Unitbroadcast(Transaction transaction)Broadcast a `Transaction` to Esplora. UpdatefullScan(FullScanRequest request, ULong stopGap, ULong parallelRequests)Scan keychain scripts for transactions against Esplora, returning an update that can be applied to the receiving structures. List<Tx>getAddressTxs(Address address, Txid lastSeen)Get transaction history for the specified address, sorted with newest first. BlockgetBlockByHash(BlockHash blockHash)Get a Block given a particular BlockHash. BlockHashgetBlockHash(UInt blockHeight)Get the `BlockHash` of a specific block height. Map<UShort, Double>getFeeEstimates()Get a map where the key is the confirmation target (in number of blocks) and the value is the estimated feerate (in sat/vB). HeadergetHeaderByHash(BlockHash blockHash)Get a Headergiven a particular block hash.UIntgetHeight()Get the height of the current blockchain tip. MerkleProofgetMerkleProof(Txid txid)Get a merkle inclusion proof for a `Transaction` with the given `Txid`. OutputStatusgetOutputStatus(Txid txid, ULong vout)Get the spending status of an output given a Txidand the output index.BlockHashgetTipHash()Get the BlockHashof the current blockchain tip.TransactiongetTx(Txid txid)Get a `Transaction` option given its `Txid`. TxgetTxInfo(Txid txid)Get transaction info given its `Txid`. TransactiongetTxNoOpt(Txid txid)Get a Transactiongiven itsTxid.TxStatusgetTxStatus(Txid txid)Get the status of a `Transaction` given its `Txid`. TxidgetTxidAtBlockIndex(BlockHash blockHash, ULong index)Get a Txidof a transaction given its index in a block with a given hash.Updatesync(SyncRequest request, ULong parallelRequests)Sync a set of scripts, txids, and/or outpoints against Esplora. -
-
Method Detail
-
broadcast
Unit broadcast(Transaction transaction)
Broadcast a `Transaction` to Esplora.
-
fullScan
Update fullScan(FullScanRequest request, ULong stopGap, ULong parallelRequests)
Scan keychain scripts for transactions against Esplora, returning an update that can be applied to the receiving structures.
requestprovides the data required to perform a script-pubkey-based full scan (see `FullScanRequest`). The full scan for each keychain (K) stops after a gap ofstop_gapscript pubkeys with no associated transactions.parallel_requestsspecifies the maximum number of HTTP requests to make in parallel.
-
getAddressTxs
List<Tx> getAddressTxs(Address address, Txid lastSeen)
Get transaction history for the specified address, sorted with newest first.
Returns up to 50 mempool transactions plus the first 25 confirmed transactions. More can be requested by specifying the last txid seen by the previous query.
-
getBlockByHash
Block getBlockByHash(BlockHash blockHash)
Get a Block given a particular BlockHash.
-
getBlockHash
BlockHash getBlockHash(UInt blockHeight)
Get the `BlockHash` of a specific block height.
-
getFeeEstimates
Map<UShort, Double> getFeeEstimates()
Get a map where the key is the confirmation target (in number of blocks) and the value is the estimated feerate (in sat/vB).
-
getHeaderByHash
Header getHeaderByHash(BlockHash blockHash)
Get a
Headergiven a particular block hash.
-
getMerkleProof
MerkleProof getMerkleProof(Txid txid)
Get a merkle inclusion proof for a `Transaction` with the given `Txid`.
-
getOutputStatus
OutputStatus getOutputStatus(Txid txid, ULong vout)
Get the spending status of an output given a
Txidand the output index.
-
getTipHash
BlockHash getTipHash()
Get the
BlockHashof the current blockchain tip.
-
getTx
Transaction getTx(Txid txid)
Get a `Transaction` option given its `Txid`.
-
getTxNoOpt
Transaction getTxNoOpt(Txid txid)
Get a
Transactiongiven itsTxid.
-
getTxStatus
TxStatus getTxStatus(Txid txid)
Get the status of a `Transaction` given its `Txid`.
-
getTxidAtBlockIndex
Txid getTxidAtBlockIndex(BlockHash blockHash, ULong index)
Get a
Txidof a transaction given its index in a block with a given hash.
-
sync
Update sync(SyncRequest request, ULong parallelRequests)
Sync a set of scripts, txids, and/or outpoints against Esplora.
requestprovides the data required to perform a script-pubkey-based sync (see `SyncRequest`).parallel_requestsspecifies the maximum number of HTTP requests to make in parallel.
-
-
-
-