[BREAKGLASS] An efficient re-implementation of Electrum Server in Rust
Go to file
2019-02-06 01:52:09 +01:00
.hooks Add simple pre-commit hook for running 'cargo fmt' 2018-11-21 09:43:58 +02:00
contrib Add systemd service file example 2018-10-01 21:13:07 +03:00
doc Update the source code for Rust 2018 2018-12-08 15:25:25 +02:00
scripts Use stable Rust from ./scripts/run.sh 2018-08-02 15:51:21 +03:00
src Refactor REST Transaction to TransactionValue conversion 2019-02-05 05:59:15 +02:00
tools Support testnet mempool visualization 2018-08-14 10:08:11 +03:00
.gitignore Add Cargo.lock to git 2018-09-27 19:55:01 +03:00
.travis.yml build feature liquid in travis 2019-02-06 01:52:09 +01:00
Cargo.lock Add a simple DB test 2019-01-21 10:46:25 +02:00
Cargo.toml Add a simple DB test 2019-01-21 10:46:25 +02:00
Dockerfile Specify user, workdir, ports and signal at Dockerfile 2018-08-20 19:27:23 +03:00
LICENSE Add MIT license and small README 2018-04-08 23:54:29 +03:00
README.md README: document --cors 2019-01-31 11:23:08 +02:00
RELEASE-NOTES.md Bump version 2018-10-14 14:40:55 +03:00
TODO.md Remove TLS-related TODO 2018-08-15 15:05:40 +03:00

Esplora - Electrs backend API

A block chain index engine and HTTP API written in Rust based on romanz/electrs.

Used as the backend for the Esplora block explorer powering blockstream.info.

API documentation is available here.

Installing & indexing

Install Rust, Bitcoin Core and the clang and cmake packages, then:

$ git clone https://github.com/blockstream/electrs && cd electrs
$ git checkout bitcoin_e # or liquid_e
$ cargo run --release -- -vvvv --daemon-dir ~/.bitcoin

See electrs's original documentation for more detailed instructions. Note that our indexes are incompatible with electrs's and has to be created separately.

The indexes require 250GB-300GB of storage after running compaction, but you'll need to have at least 500GB of free space available for the initial (non-compacted) indexing process. Creating the indexes should take a few hours on a beefy machine with SSD.

For personal low-volume use, the storage requirements can be reduced with --light (see below under CLI options).

To deploy with Docker, follow the instructions here.

Notable changes from Electrs:

  • HTTP REST API instead of the Electrum JSON-RPC protocol, with extended transaction information (previous outputs, spending transactions, script asm and more).

  • Extended indexes and database storage for improved performance under high load:

    • A full transaction store mapping txids to raw transactions is kept in the database under the prefix t. This takes up ~200GB of extra storage.
    • A map of blockhash to txids is kept in the database under the prefix X.
    • Block stats metadata (number of transactions, size and weight) is kept in the database under the prefix M.
    • The index with T prefix mapping txids to block heights now also includes the block hash. This allows for quick reorg-aware transaction confirmation status lookups, by verifying the current block at the recorded height still matches the recorded block hash.

    With these new indexes, bitcoind is no longer queried to serve user requests and is only polled periodically for new blocks and for syncing the mempool.

  • Support for Liquid and other Elements-based networks, including CT, peg-in/out and multi-asset. (under the liquid_e branch)

CLI options

In addition to electrs's original configuration options, a few new options are also available:

  • --http-addr <addr:port> - HTTP server address/port to listen on (default: 127.0.0.1:3000).
  • --light - enable light resource mode, which disables the X, M and t indexes and queries this information from bitcoind instead. This significantly reduces storage requirements (at the time of writing, by about 250GB), at the cost of more expensive lookups and more reliance on bitcoind.
  • --disable-prevout - disable attaching previous output information to inputs. This significantly reduces the amount of transaction lookups (and IO/CPU/memory usage), at the cost of not knowing inputs amounts, their previous script/address, and the transaction fee. Consider setting this if you're using --light.
  • --parent-network <network> - the parent network this chain is pegged to (Elements/Liquid only).
  • --cors <origins> - origins allowed to make cross-site request (optional, defaults to none).

See $ cargo run --release -- --help for the full list of options.

License

MIT