Hierarchy

  • Explorer

Implemented by

Methods

  • Connect to the server.

    Returns Promise<void>

    Async

  • Close the connection.

    Returns Promise<void>

    Async

  • Get the balance of an address and find out whether the address ever received some coins.

    Parameters

    • address: string

      A Bitcoin address

    Returns Promise<{
        balance: number;
        txCount: number;
        unconfirmedBalance: number;
        unconfirmedTxCount: number;
    }>

    An object with 'balance' & confirmedTxCount properties.

    Async

  • Get the balance of a scriptHash and find out whether the scriptHash ever received some coins.

    Parameters

    • scriptHash: string

      A Bitcoin scriptHash

    Returns Promise<{
        balance: number;
        txCount: number;
        unconfirmedBalance: number;
        unconfirmedTxCount: number;
    }>

    An object with 'balance' & txCount properties.

    Async

  • Fetches the transaction history for a given address or script hash.

    Parameters

    • params: {
          address?: string;
          scriptHash?: string;
      }

      The parameters for the method.

      • Optional address?: string

        The address to fetch transaction history for.

      • Optional scriptHash?: string

        The script hash to fetch transaction history for.

    Returns Promise<{
        txId: string;
        blockHeight: number;
        irreversible: boolean;
    }[]>

    A promise that resolves to an array containing transaction history, each item is an object containing txId, blockHeight and irreversible. txId is the transaction ID, blockHeight is the height of the block that includes the transaction, and irreversible is a boolean indicating whether the transaction has reached the irreversible confirmation threshold (set to IRREV_CONF_THRESH confirmations). They are returned in blockchain order. However, esplora might not respect order when txs belong to the same block. See https://github.com/Blockstream/esplora/issues/165

    Throws

    If both address and scriptHash are provided or if neither are provided.

  • Parameters

    • txId: string

    Returns Promise<string>

  • Get an object where the key is the confirmation target (in number of blocks) and the value is the estimated feerate (in sat/vB).

    The available confirmation targets are 1-25, 144, 504 and 1008 blocks.

    Returns Promise<Record<string, number>>

    An object where the key is the confirmation target (in number of blocks).

    Async

  • Get's the BlockStatus: { blockHeight: number; blockHash: string; blockTime: number; }) of a certain blockHeight.

    Returns undefined if this block height has not been mined yet.

    Parameters

    • blockHeight: number

    Returns Promise<undefined | BlockStatus>

    BlockStatus | undefined;

    Async

  • Get's current block height (blockchain tip).

    Returns Promise<number>

    A number representing the current height.

    Async

  • Push a raw Bitcoin transaction to the network.

    Parameters

    • txHex: string

      A raw Bitcoin transaction in hexadecimal string format.

    Returns Promise<string>

    The transaction ID (txId) if the transaction was broadcasted successfully.

    Async

    Throws

    If the transaction is invalid or fails to be broadcasted.