esplora_* Methods

The esplora_* namespace provides access to Electrs/Esplora block explorer functionality. These methods mirror the Esplora REST API.

Address Methods

MethodDescription
esplora_addressGet address information including chain stats
esplora_address::utxoGet unspent transaction outputs for an address
esplora_address::txsGet transaction history for an address

Transaction Methods

MethodDescription
esplora_txGet full transaction details
esplora_tx::statusGet transaction confirmation status
esplora_tx::hexGet raw transaction hex
esplora_tx::outspendsGet spend status for all outputs

Block Methods

MethodDescription
esplora_blockGet block details by hash
esplora_block-heightGet block hash at a specific height
esplora_block::txidsGet all transaction IDs in a block

Mempool Methods

MethodDescription
esplora_mempoolGet mempool statistics
esplora_mempool::recentGet recent mempool transactions

Fee Estimation

MethodDescription
esplora_fee-estimatesGet fee estimates for different confirmation targets

esplora_address

Get address information including chain stats.

// Request
{
  "jsonrpc": "2.0",
  "method": "esplora_address",
  "params": ["bc1qm34lsc65zpw79lxes69zkqmk6ee3ewf0j77s3h"],
  "id": 1
}

// Response
{
  "jsonrpc": "2.0",
  "result": {
    "address": "bc1qm34lsc65zpw79lxes69zkqmk6ee3ewf0j77s3h",
    "chain_stats": {
      "funded_txo_count": 2265512,
      "funded_txo_sum": 5519171660624754,
      "spent_txo_count": 2264780,
      "spent_txo_sum": 5517676571260341,
      "tx_count": 2058518
    }
  },
  "id": 1
}

// Lua Example
local address = args[1]
local info = _RPC.esplora_address(address)
local stats = info.chain_stats
return {
  address = info.address,
  balance = stats.funded_txo_sum - stats.spent_txo_sum,
  tx_count = stats.tx_count
}

esplora_address::utxo

Get unspent transaction outputs for an address.

// Request
{
  "jsonrpc": "2.0",
  "method": "esplora_address::utxo",
  "params": ["bc1qm34lsc65zpw79lxes69zkqmk6ee3ewf0j77s3h"],
  "id": 1
}

// Response
{
  "jsonrpc": "2.0",
  "result": [
    {
      "txid": "b875d7c6d8de34b5ac2d1deb8aecc0856190e1310ea7d71e9b7fd866313e648c",
      "vout": 3,
      "value": 1833859462,
      "status": {
        "confirmed": true,
        "block_height": 925724
      }
    }
  ],
  "id": 1
}

// Lua Example
local address = args[1]
local utxos = _RPC.esplora_addressutxo(address)
local total = 0
for _, utxo in ipairs(utxos) do
  total = total + utxo.value
end
return { utxo_count = #utxos, total_sats = total }

esplora_tx

Get full transaction details.

// Request
{
  "jsonrpc": "2.0",
  "method": "esplora_tx",
  "params": ["0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098"],
  "id": 1
}

// Response
{
  "jsonrpc": "2.0",
  "result": {
    "txid": "0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098",
    "version": 1,
    "locktime": 0,
    "size": 134,
    "weight": 536,
    "fee": 0,
    "vin": [...],
    "vout": [...],
    "status": {
      "confirmed": true,
      "block_height": 1
    }
  },
  "id": 1
}

// Lua Example
local txid = args[1]
local tx = _RPC.esplora_tx(txid)
return {
  txid = tx.txid,
  fee = tx.fee,
  size = tx.size,
  confirmed = tx.status.confirmed
}

esplora_block

Get block details by hash.

// Request
{
  "jsonrpc": "2.0",
  "method": "esplora_block",
  "params": ["0000000000000000000320283a032748cef8227873ff4872689bf23f1cda83a5"],
  "id": 1
}

// Response
{
  "jsonrpc": "2.0",
  "result": {
    "id": "0000000000000000000320283a032748cef8227873ff4872689bf23f1cda83a5",
    "height": 840000,
    "tx_count": 3050,
    "size": 2325617,
    "weight": 3993281,
    "timestamp": 1713571767
  },
  "id": 1
}

// Lua Example
local hash = args[1]
local block = _RPC.esplora_block(hash)
return {
  height = block.height,
  tx_count = block.tx_count,
  size_kb = block.size / 1000
}

esplora_fee-estimates

Get fee estimates for different confirmation targets.

// Request
{
  "jsonrpc": "2.0",
  "method": "esplora_fee-estimates",
  "params": [],
  "id": 1
}

// Response
{
  "jsonrpc": "2.0",
  "result": {
    "1": 1.013,    // 1 block target
    "2": 1.013,    // 2 block target
    "6": 1.013,    // 6 block target
    "25": 1.013,   // 25 block target
    "144": 0.734,  // ~1 day
    "504": 0.734,  // ~3.5 days
    "1008": 0.734  // ~1 week
  },
  "id": 1
}

// Lua Example
local fees = _RPC.esplora_feeestimates()
return {
  next_block = fees["1"],
  within_hour = fees["6"],
  economy = fees["1008"]
}