Top Related Projects
A bitcoin blockchain explorer and API
Database-free, self-hosted Bitcoin explorer, via RPC to Bitcoin Core.
Accept Bitcoin payments. Free, open-source & self-hosted, Bitcoin payment processor.
Explore the full Bitcoin ecosystem with mempool.space, or self-host your own instance with one-click installation on popular Raspberry Pi fullnode distros including Umbrel, Raspiblitz, Start9, and more!
Quick Overview
Blockstream/esplora is an open-source blockchain explorer and API server for Bitcoin and other cryptocurrencies. It provides a user-friendly web interface and a powerful API for interacting with the blockchain, making it a valuable tool for developers, researchers, and cryptocurrency enthusiasts.
Pros
- Comprehensive Blockchain Exploration: Esplora offers a comprehensive set of features for exploring the blockchain, including transaction details, block information, and address balances.
- Customizable and Extensible: The project is designed to be highly customizable and extensible, allowing users to tailor the explorer to their specific needs.
- Efficient and Scalable: Esplora is built on top of the Electrum server, which provides a fast and efficient way to interact with the blockchain.
- Open-Source and Community-Driven: Esplora is an open-source project, which means that it benefits from the contributions and support of a large and active community of developers.
Cons
- Limited Cryptocurrency Support: While Esplora primarily focuses on Bitcoin, support for other cryptocurrencies may be limited or require additional configuration.
- Steep Learning Curve: Esplora's extensive feature set and customization options can make it challenging for new users to get started, especially those who are not familiar with blockchain technology.
- Potential Performance Issues: Depending on the size of the blockchain and the number of users, Esplora may experience performance issues, especially when handling large amounts of data.
- Maintenance and Updates: As an open-source project, the ongoing maintenance and updates of Esplora may depend on the availability and commitment of the community.
Code Examples
// Fetch transaction details
const txid = '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef';
const response = await fetch(`/api/tx/${txid}`);
const tx = await response.json();
console.log(tx);
// Fetch block information
const blockHeight = 123456;
const response = await fetch(`/api/block-height/${blockHeight}`);
const block = await response.json();
console.log(block);
// Fetch address balance
const address = '1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2';
const response = await fetch(`/api/address/${address}/balance`);
const balance = await response.json();
console.log(balance);
// Broadcast a transaction
const txHex = '0200000001a15d57094aa7a21a28cb20b59aab8fc7d1149a3bdbcddba9c622e4f5f6a99ebb0000000006b483045022100896c2a0c3dd7f1e96f4af5c800e6108f3c9c6d6e8c93be25c8b301c5fc1c1c5f02206d6c98c5d7c9f7afa9d0c3f5c67e7c0d4b1a3aa2c4f486c6b2d67d0c49a2c2e012103c96d495bfdd5ba4145e3e046fee45e84a8a48ad05bd8dbb395c011a32cf9f88ffffffff0200e1f505000000001976a914c42e7ef92fdb603af844d064faad95db97989f8e88ac0000000000000000166a14549fd4d0c369c5aa7a79fd7d37a6a4a4c2a9670200000000';
const response = await fetch('/api/tx', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ tx: txHex })
});
const result = await response.json();
console.log(result);
Getting Started
To get started with Esplora, you can follow these steps:
- Clone the Esplora repository from GitHub:
git clone
Competitor Comparisons
A bitcoin blockchain explorer and API
Pros of Insight
- More extensive API documentation and examples
- Supports multiple cryptocurrencies beyond Bitcoin
- Longer development history and larger community
Cons of Insight
- Less frequent updates and maintenance
- Higher resource requirements for running a full node
- More complex setup process
Code Comparison
Esplora (TypeScript):
export function estimateFee(blocks: number): Promise<number> {
return request(`/fee-estimates`)
.then(estimates => estimates[blocks.toString()]);
}
Insight (JavaScript):
InsightAPI.prototype.estimateFee = function(nbBlocks, callback) {
this._tryAllClients(function(client, cb) {
client.estimateFee(nbBlocks, cb);
}, callback);
};
Both projects provide blockchain explorers and APIs for Bitcoin and other cryptocurrencies. Esplora, developed by Blockstream, focuses on a modern, lightweight explorer with a clean UI. Insight, by BitPay, offers a more comprehensive set of features and supports multiple cryptocurrencies.
Esplora uses TypeScript and modern web technologies, resulting in a more maintainable codebase. Insight, written in JavaScript, has a longer history and more extensive documentation but may require more setup effort.
Choose Esplora for a sleek, efficient explorer focused on Bitcoin, or Insight for a feature-rich solution supporting multiple cryptocurrencies with extensive API capabilities.
Database-free, self-hosted Bitcoin explorer, via RPC to Bitcoin Core.
Pros of btc-rpc-explorer
- More lightweight and easier to set up, requiring only a Bitcoin Core node
- Offers a clean, user-friendly interface with customizable themes
- Provides detailed mempool statistics and visualizations
Cons of btc-rpc-explorer
- Less scalable for high-traffic scenarios compared to Esplora
- Lacks some advanced features like address tracking and API endpoints
Code Comparison
btc-rpc-explorer:
router.get("/block-height/:blockHeight", function(req, res, next) {
var blockHeight = parseInt(req.params.blockHeight);
res.locals.blockHeight = blockHeight;
coreApi.getBlockHashByHeight(blockHeight).then(function(blockHash) {
res.redirect("/block/" + blockHash);
});
});
Esplora:
pub fn block_by_height(
app: &App,
req: &mut Request,
) -> Result<Response, Error> {
let height: u32 = req.param("height")?.parse()?;
let blockhash = app.query.get_block_hash(height)?;
Ok(Response::redirect(format!("/block/{}", blockhash)))
}
Both examples show routing for block height queries, but Esplora uses Rust for better performance, while btc-rpc-explorer uses JavaScript for easier customization.
Accept Bitcoin payments. Free, open-source & self-hosted, Bitcoin payment processor.
Pros of BTCPayServer
- More comprehensive payment processing solution, including invoicing and e-commerce integration
- Supports multiple cryptocurrencies, not just Bitcoin
- Offers a user-friendly interface for merchants and customers
Cons of BTCPayServer
- More complex setup and maintenance due to its broader feature set
- Requires more server resources to run compared to Esplora
- May have a steeper learning curve for users new to cryptocurrency payments
Code Comparison
BTCPayServer (C#):
public async Task<IActionResult> CreateInvoice(InvoiceModel model)
{
var store = HttpContext.GetStoreData();
var entity = await CreateInvoiceCore(store, model, Request.GetAbsoluteRoot());
return RedirectToAction(nameof(Invoice), new { id = entity.Id });
}
Esplora (JavaScript):
app.get('/tx/:txid', (req, res) => {
const { txid } = req.params
rpc.getTx(txid)
.then(tx => res.json(tx))
.catch(err => res.status(400).send(err.message))
})
The code snippets show that BTCPayServer focuses on invoice creation and management, while Esplora provides simpler blockchain data retrieval functionality.
Explore the full Bitcoin ecosystem with mempool.space, or self-host your own instance with one-click installation on popular Raspberry Pi fullnode distros including Umbrel, Raspiblitz, Start9, and more!
Pros of mempool
- More comprehensive feature set, including mempool visualization and fee estimation
- Active development with frequent updates and community contributions
- Supports multiple cryptocurrencies beyond Bitcoin
Cons of mempool
- Higher system requirements due to more complex functionality
- Steeper learning curve for setup and configuration
- May be overkill for simple block explorer needs
Code comparison
mempool (TypeScript):
export interface MempoolInfo {
loaded: boolean;
size: number;
bytes: number;
usage: number;
maxmempool: number;
mempoolminfee: number;
minrelaytxfee: number;
}
Esplora (JavaScript):
app.get('/mempool', (req, res) => {
rpcClient.getMempoolInfo((err, info) => {
if (err) return res.status(500).send(err)
res.send(info)
})
})
Both projects provide mempool information, but mempool offers a more structured approach with TypeScript interfaces, while Esplora uses a simpler JavaScript implementation for API endpoints.
mempool's codebase is generally more extensive and modular, reflecting its broader feature set. Esplora's code is more focused on providing a lightweight block explorer with a simpler architecture.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Esplora Block Explorer
Block explorer web interface based on the esplora-electrs HTTP API.
Written as a single-page app in a reactive and functional style using rxjs and cycle.js.
See live at Blockstream.info.
API documentation is available here.
Join the translation efforts on Transifex.
Features
-
Explore blocks, transactions and addresses
-
Support for Segwit and Bech32 addresses
-
Shows previous output and spending transaction details
-
Quick-search for txid, address, block hash or height by navigating to
/<query>
-
Advanced view with script hex/assembly, witness data, outpoints and more
-
Mobile-ready responsive design
-
Translated to 17 languages
-
Light and dark themes
-
Noscript support
-
For Liquid and other Elements-based chains: support for CT, peg-in/out transactions and multi-asset
-
Mainnet, Testnet and Elements high performance electrum server
Developing
To start a development server with live babel/browserify transpilation, run:
$ git clone https://github.com/Blockstream/esplora && cd esplora
$ npm install
$ export API_URL=http://localhost:3000/ # or https://blockstream.info/api/ if you don't have a local API server
# (see more config options below)
$ npm run dev-server
The server will be available at http://localhost:5000/
To display debugging information for the Rx streams in the web developer console, set localStorage.debug = '*'
and refresh.
Building
To build the static assets directory for production deployment, set config options (see below)
and run $ npm run dist
. The files will be created under dist/
.
Because Esplora is a single-page app, the HTTP server needs to be configured to serve the index.html
file in reply to missing pages.
See contrib/nginx.conf.in
for example nginx configuration (TL;DR: try_files $uri /index.html
).
Pre-rendering server (noscript)
To start a pre-rendering server that generates static HTML replies suitable for noscript users, run:
# (clone, cd, "npm install" and configure as above)
$ export STATIC_ROOT=http://localhost:5000/ # for loading CSS, images and fonts
$ npm run prerender-server
The server will be available at http://localhost:5001/
Configuration options
All options are optional.
GUI options
NODE_ENV
- set toproduction
to enable js minification, or todevelopment
to disable (defaults toproduction
)BASE_HREF
- base href for user interface (defaults to/
, change if not served from the root directory)STATIC_ROOT
- root for static assets (defaults toBASE_HREF
, change to load static assets from a different server)API_URL
- URL for HTTP REST API (defaults to/api
, change if the API is available elsewhere)CANONICAL_URL
- absolute base url for user interface (optional, only required for opensearch and canonical link tags)NATIVE_ASSET_LABEL
- the name of the network native asset (defaults toBTC
)SITE_TITLE
- website title for<title>
(defaults toBlock Explorer
)SITE_DESC
- meta description (defaults toEsplora Block Explorer
)HOME_TITLE
- text for homepage title (defaults toSITE_TITLE
)SITE_FOOTER
- text for page footer (defaults toPowered by esplora
)HEAD_HTML
- custom html to inject at the end of<head>
FOOT_HTML
- custom html to inject at the end of<body>
CUSTOM_ASSETS
- space separated list of static assets to add to the buildCUSTOM_CSS
- space separated list of css files to append intostyle.css
NOSCRIPT_REDIR
- redirect noscript users to{request_path}?nojs
(should be captured server-side and redirected to the prerender server, also seeNOSCRIPT_REDIR_BASE
in dev server options)
Note that API_URL
should be set to the publicly-reachable URL where the user's browser can issue requests at.
(that is, not via localhost
, unless you're setting up a dev environment where the browser is running on the same machine as the API server.)
Elements-only configuration:
IS_ELEMENTS
- set to1
to indicate this is an Elements-based chain (enables asset issuance and peg features)NATIVE_ASSET_ID
- the ID of the native asset used to pay fees (defaults to6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d
, the asset id for BTC)BLIND_PREFIX
- the base58 address prefix byte used for confidential addresses (defaults to12
)PARENT_CHAIN_EXPLORER_TXOUT
- URL format for linking to transaction outputs on the parent chain, with{txid}
and{vout}
as placeholders. Example:https://blockstream.info/tx/{txid}#output:{vout}
PARENT_CHAIN_EXPLORER_ADDRESS
- URL format for linking to addresses on parent chain, with{addr}
replaced by the address. Example:https://blockstream.info/address/{addr}
ASSET_MAP_URL
- url to load json asset map (in the "minimal" format)
Menu configuration (useful for inter-linking multiple instances on different networks):
MENU_ITEMS
- json map of menu items, where the key is the label and the value is the urlMENU_ACTIVE
- the active menu item identified by its label
Development server options
All GUI options, plus:
PORT
- port to bind http development server (defaults to5000
)CORS_ALLOW
- value to set forAccess-Control-Allow-Origin
header (optional)NOSCRIPT_REDIR_BASE
- base url for prerender server, for redirecting?nojs
requests (should be set alongsideNOSCRIPT_REDIR
)
Pre-rendering server options
All GUI options, plus:
PORT
- port to bind pre-rendering server (defaults to5001
)
Note that unlike the regular JavaScript-based app that sends API requests from the client-side,
the pre-rendering server sends API requests from the server-side. This means that API_URL
should
be configured to the URL reachable by the server, typically http://localhost:3000/
.
How to build the Docker image
docker build -t esplora .
Alternatively, you may use the pre-built blockstream/esplora
image from Docker Hub.
How to run the explorer for Bitcoin mainnet
docker run -p 50001:50001 -p 8080:80 \
--volume $PWD/data_bitcoin_mainnet:/data \
--rm -i -t esplora \
bash -c "/srv/explorer/run.sh bitcoin-mainnet explorer"
How to run the explorer for Liquid mainnet
docker run -p 50001:50001 -p 8082:80 \
--volume $PWD/data_liquid_mainnet:/data \
--rm -i -t esplora \
bash -c "/srv/explorer/run.sh liquid-mainnet explorer"
How to run the explorer for Bitcoin testnet3
docker run -p 50001:50001 -p 8084:80 \
--volume $PWD/data_bitcoin_testnet:/data \
--rm -i -t esplora \
bash -c "/srv/explorer/run.sh bitcoin-testnet explorer"
How to run the explorer for Bitcoin signet
docker run -p 50001:50001 -p 8084:80 \
--volume $PWD/data_bitcoin_signet:/data \
--rm -i -t esplora \
bash -c "/srv/explorer/run.sh bitcoin-signet explorer"
How to run the explorer for Liquid testnet
docker run -p 50001:50001 -p 8096:80 \
--volume $PWD/data_liquid_testnet:/data \
--rm -i -t esplora \
bash -c "/srv/explorer/run.sh liquid-testnet explorer"
How to run the explorer for Liquid regtest
docker run -p 50001:50001 -p 8092:80 \
--volume $PWD/data_liquid_regtest:/data \
--rm -i -t esplora \
bash -c "/srv/explorer/run.sh liquid-regtest explorer"
How to run the explorer for Bitcoin regtest
docker run -p 50001:50001 -p 8094:80 \
--volume $PWD/data_bitcoin_regtest:/data \
--rm -i -t esplora \
bash -c "/srv/explorer/run.sh bitcoin-regtest explorer"
Regtest options
When run for Bitcoin regtest or Liquid regtest, the esplora container will
create a default wallet and mine 100 blocks internally. You can disable this behavior
by setting NO_REGTEST_MINING=1
.
Docker config options
Set -e DEBUG=verbose
to enable more verbose logging.
Set -e NO_PRECACHE=1
to disable pre-caching of statistics for "popular addresses",
which may take a long time and is not necessary for personal use.
Set -e NO_ADDRESS_SEARCH=1
to disable the by-prefix address search index.
Set -e ENABLE_LIGHTMODE=1
to enable esplora-electrs's light mode.
Set -e ONION_URL=http://xyz.onion
to enable the Onion-Location
header.
Build new esplora-base
docker build -t blockstream/esplora-base:latest -f Dockerfile.deps .
docker push blockstream/esplora-base:latest
docker inspect --format='{{index .RepoDigests 0}}' blockstream/esplora-base
Build new tor (or you can pull directly from Docker Hub - blockstream/tor:latest
)
docker build --squash -t blockstream/tor:latest -f Dockerfile.tor .
docker push blockstream/tor:latest
docker inspect --format='{{index .RepoDigests 0}}' blockstream/tor
Run: docker -d --name hidden_service blockstream/tor:latest tor -f /home/tor/torrc
(could add a -v /extra/torrc:/home/tor/torrc
, if you have a custom torrc)
Example torrc:
DataDirectory /home/tor/tor
PidFile /var/run/tor/tor.pid
ControlSocket /var/run/tor/control GroupWritable RelaxDirModeCheck
ControlSocketsGroupWritable 1
SocksPort unix:/var/run/tor/socks WorldWritable
SocksPort 9050
CookieAuthentication 1
CookieAuthFileGroupReadable 1
CookieAuthFile /var/run/tor/control.authcookie
Log [handshake]debug [*]notice stderr
HiddenServiceDir /home/tor/tor/hidden_service_v3/
HiddenServiceVersion 3
HiddenServicePort 80 127.0.0.1:80
License
MIT
Top Related Projects
A bitcoin blockchain explorer and API
Database-free, self-hosted Bitcoin explorer, via RPC to Bitcoin Core.
Accept Bitcoin payments. Free, open-source & self-hosted, Bitcoin payment processor.
Explore the full Bitcoin ecosystem with mempool.space, or self-host your own instance with one-click installation on popular Raspberry Pi fullnode distros including Umbrel, Raspiblitz, Start9, and more!
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot