Esplora - Electrs

The Esplora - Electrs backend API project is developed and maintained by Blockstream as a way to index and expose information about the Bitcoin blockchain. The same API powers the blockstream.info block explorer.

A block explorer allows you to search for transactions on the blockchain, view information about an address at any given point in time, or to get information about the transactions that are currently in the mempool.

You may need to install or use a block explorer style API if you are performing analysis of transaction history on the blockchain, are monitoring a specific set of addresses, or are building applications that need to observe the state of broadcast transactions.

Installing

The Electrs middleware is available for DEPLOY Owned Nodes and Shared Nodes running the BitcoinD client.

Shared Nodes

All shared node subscriptions include the Electrs middleware preinstalled.

Simply navigate to Your Node -> Middleware -> Electrs, click View and locate the endpoint for your shared node subscription.

Your Electrs middleware will use the same API key as your application would use to interact with your shared node subscription.

Owned Node

Your owned node subscription allows you to install various pieces of middleware on top of your owned node for added functionality.

To install the Electrs middle ware on a Bitcoin owned node. Navigate to Your Node -> Middleware -> Electrs, click View, review the documentation and click Install Electrs.

DEPLOY's middleware maintenance platform will create a new instance of the Electrs middleware within your owned node and will begin indexing the node's chain data. Wait until the Electrs middleware page shows that the middleware has finished installing.

Usage

Once you have Electrs installed on an owned or shared node subscription, you can begin to query the Electrs API endpoint to fetch information about the Bitcoin blockchain.

For example, the Electrs middleware page (My Node -> Middleware -> Electrs) includes curl command examples for fetching various useful Bitcoin blockchain data. One of which is the GET /fee-estimates which allows your application to get the latest estimates for fee rates for various confirmation times. A command for querying a shared bitcoin core mainnet node would look like:

curl https://shared-bitcoincore-mainnet.deploy-nodes-dev.radar.dev/electrs/rest/fee-estimates?apikey=<your API key>

The Electrs middleware on either a shared or owned node will always follow the convention https://<your node endpoint>/electrs/rest/<electrs path>?apikey=<your API key>. In the above example the segments are the following in order to query Electrs GET /fee-estimates endpoint.

Segment

Example Value

Description

<your node endpoint>

shared-bitcoincore-mainnet.deploy-nodes-dev.radar.dev

This is a shared node subscription on the mainnet Bitcoin network

<electrs path>

fee-estimates

Electrs' GET /fee-estimates endpoint

<your API key>

<your API key>

Your API key prevents unauthorized use of your DEPLOY resources

In order to query a specific transaction on the Bitcoin mainnet we could use the same API endpoint scheme and the Electrs API reference to build our GET /tx/:txid endpoint:

curl https://shared-bitcoincore-mainnet.deploy-nodes-dev.radar.dev/electrs/rest/tx/4410c8d14ff9f87ceeed1d65cb58e7c7b2422b2d7529afc675208ce2ce09ed7d?apikey=<your API key>

Segment

Example Value

Description

<your node endpoint>

shared-bitcoincore-mainnet.deploy-nodes-dev.radar.dev

This is a shared node subscription on the mainnet Bitcoin network

<electrs path>

tx/4410c...ed7d

Querying the transaction with the bitcoin txid of 4410c...ed7d using the GET /tx/:txid endpoint.

<your API key>

<your API key>

Your API key prevents unauthorized use of your DEPLOY resources

Uninstalling

Shared Node

You cannot uninstall the Electrs middleware from a shared node subscription since it is included at no extra charge and is a shared resource.

Owned Node

In order to uninstall the Electrs middleware, you must restore your owned node to default settings. To remove the middleware navigate to My Node -> Middleware -> Electrs and click Restore Node to Default Settings. Confirm you wish to restore the node to default settings by clicking Restore Node.

See Also