From 911ed786b5c78bcbc75658ae94fc2aed2a1f4e67 Mon Sep 17 00:00:00 2001 From: junderw Date: Sat, 14 Oct 2023 16:14:59 -0700 Subject: [PATCH] Update README and rename lib to mempool-electrs --- Cargo.lock | 86 ++++++++++++++++----------------- Cargo.toml | 11 +++-- README.md | 20 ++++---- scripts/checks.sh | 2 +- src/bin/electrs.rs | 12 ++--- src/bin/popular-scripts.rs | 4 +- src/bin/tx-fingerprint-stats.rs | 4 +- src/config.rs | 2 +- 8 files changed, 72 insertions(+), 69 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 23b2bb57..db6d368a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -397,49 +397,6 @@ version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" -[[package]] -name = "electrs" -version = "3.0.0-dev" -dependencies = [ - "arrayref", - "base64 0.13.0", - "bincode", - "bitcoin 0.28.0", - "bounded-vec-deque", - "clap", - "crossbeam-channel", - "dirs", - "electrum-client", - "elements", - "error-chain", - "glob", - "hex", - "hyper", - "hyperlocal", - "itertools", - "lazy_static", - "libc", - "log", - "num_cpus", - "page_size", - "prometheus", - "rayon", - "rocksdb", - "serde", - "serde_derive", - "serde_json", - "sha2", - "signal-hook", - "socket2", - "stderrlog", - "sysconf", - "tempfile", - "time 0.3.9", - "tiny_http", - "tokio", - "url", -] - [[package]] name = "electrum-client" version = "0.8.0" @@ -863,6 +820,49 @@ dependencies = [ "autocfg 1.1.0", ] +[[package]] +name = "mempool-electrs" +version = "3.0.0-dev" +dependencies = [ + "arrayref", + "base64 0.13.0", + "bincode", + "bitcoin 0.28.0", + "bounded-vec-deque", + "clap", + "crossbeam-channel", + "dirs", + "electrum-client", + "elements", + "error-chain", + "glob", + "hex", + "hyper", + "hyperlocal", + "itertools", + "lazy_static", + "libc", + "log", + "num_cpus", + "page_size", + "prometheus", + "rayon", + "rocksdb", + "serde", + "serde_derive", + "serde_json", + "sha2", + "signal-hook", + "socket2", + "stderrlog", + "sysconf", + "tempfile", + "time 0.3.9", + "tiny_http", + "tokio", + "url", +] + [[package]] name = "minimal-lexical" version = "0.2.1" diff --git a/Cargo.toml b/Cargo.toml index 5872d6ba..26b126e1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,13 +1,18 @@ [package] -name = "electrs" +name = "mempool-electrs" version = "3.0.0-dev" -authors = ["Roman Zeyde "] +authors = [ + "Roman Zeyde ", + "Nadav Ivgi ", + "wiz ", + "junderw " +] description = "An efficient re-implementation of Electrum Server in Rust" license = "MIT" homepage = "https://github.com/mempool/electrs" repository = "https://github.com/mempool/electrs" +publish = false keywords = ["bitcoin", "electrum", "server", "index", "database"] -documentation = "https://docs.rs/electrs/" readme = "README.md" edition = "2018" diff --git a/README.md b/README.md index 5cf685ff..d684dc48 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -# Esplora - Electrs backend API +# Mempool - Electrs backend API -A block chain index engine and HTTP API written in Rust based on [romanz/electrs](https://github.com/romanz/electrs). +A block chain index engine and HTTP API written in Rust based on [romanz/electrs](https://github.com/romanz/electrs) and [Blockstream/electrs](https://github.com/Blockstream/electrs). -Used as the backend for the [Esplora block explorer](https://github.com/Blockstream/esplora) powering [blockstream.info](https://blockstream.info/). +Used as the backend for the [mempool block explorer](https://github.com/mempool/mempool) powering [mempool.space](https://mempool.space/). -API documentation [is available here](https://github.com/blockstream/esplora/blob/master/API.md). +API documentation [is available here](https://mempool.space/docs/api/rest). Documentation for the database schema and indexing process [is available here](doc/schema.md). @@ -13,8 +13,8 @@ Documentation for the database schema and indexing process [is available here](d Install Rust, Bitcoin Core (no `txindex` needed) and the `clang` and `cmake` packages, then: ```bash -$ git clone https://github.com/blockstream/electrs && cd electrs -$ git checkout new-index +$ git clone https://github.com/mempool/electrs && cd electrs +$ git checkout mempool $ cargo run --release --bin electrs -- -vvvv --daemon-dir ~/.bitcoin # Or for liquid: @@ -24,11 +24,9 @@ $ cargo run --features liquid --release --bin electrs -- -vvvv --network liquid See [electrs's original documentation](https://github.com/romanz/electrs/blob/master/doc/usage.md) for more detailed instructions. Note that our indexes are incompatible with electrs's and has to be created separately. -The indexes require 610GB of storage after running compaction (as of June 2020), but you'll need to have +The indexes require 1.3TB of storage after running compaction (as of October 2023), but you'll need to have free space of about double that available during the index compaction process. -Creating the indexes should take a few hours on a beefy machine with SSD. - -To deploy with Docker, follow the [instructions here](https://github.com/Blockstream/esplora#how-to-build-the-docker-image). +Creating the indexes should take a few hours on a beefy machine with high speed NVMe SSD(s). ### Light mode @@ -78,7 +76,7 @@ Additional options with the `electrum-discovery` feature: - `--electrum-hosts ` - a json map of the public hosts where the electrum server is reachable, in the [`server.features` format](https://electrumx.readthedocs.io/en/latest/protocol-methods.html#server.features). - `--electrum-announce` - announce the electrum server on the electrum p2p server discovery network. -See `$ cargo run --release --bin electrs -- --help` for the full list of options. +See `$ cargo run --bin electrs -- --help` for the full list of options. ## License diff --git a/scripts/checks.sh b/scripts/checks.sh index aeda1261..a80db52e 100755 --- a/scripts/checks.sh +++ b/scripts/checks.sh @@ -59,4 +59,4 @@ cargo clippy $@ -q -F electrum-discovery,liquid TESTNAME="Running cargo test with all features" echo "$TESTNAME" -cargo test $@ -q --package electrs --lib --all-features +cargo test $@ -q --lib --all-features diff --git a/src/bin/electrs.rs b/src/bin/electrs.rs index 68fa47ff..5289edba 100644 --- a/src/bin/electrs.rs +++ b/src/bin/electrs.rs @@ -2,14 +2,14 @@ extern crate error_chain; #[macro_use] extern crate log; -extern crate electrs; +extern crate mempool_electrs; use error_chain::ChainedError; use std::process; use std::sync::{Arc, RwLock}; use std::time::Duration; -use electrs::{ +use mempool_electrs::{ config::Config, daemon::Daemon, electrum::RPC as ElectrumRPC, @@ -21,7 +21,7 @@ use electrs::{ }; #[cfg(feature = "liquid")] -use electrs::elements::AssetRegistry; +use mempool_electrs::elements::AssetRegistry; fn fetch_from(config: &Config, store: &Store) -> FetchFrom { let mut jsonrpc_import = config.jsonrpc_import; @@ -110,12 +110,12 @@ fn run_server(config: Arc) -> Result<()> { if let Err(err) = signal.wait(Duration::from_millis(500), true) { info!("stopping server: {}", err); - electrs::util::spawn_thread("shutdown-thread-checker", || { + mempool_electrs::util::spawn_thread("shutdown-thread-checker", || { let mut counter = 40; let interval_ms = 500; while counter > 0 { - electrs::util::with_spawned_threads(|threads| { + mempool_electrs::util::with_spawned_threads(|threads| { debug!("Threads during shutdown: {:?}", threads); }); std::thread::sleep(std::time::Duration::from_millis(interval_ms)); @@ -151,7 +151,7 @@ fn main() { error!("server failed: {}", e.display_chain()); process::exit(1); } - electrs::util::with_spawned_threads(|threads| { + mempool_electrs::util::with_spawned_threads(|threads| { debug!("Threads before closing: {:?}", threads); }); } diff --git a/src/bin/popular-scripts.rs b/src/bin/popular-scripts.rs index 9005f5b8..cc17e55c 100644 --- a/src/bin/popular-scripts.rs +++ b/src/bin/popular-scripts.rs @@ -1,9 +1,9 @@ -extern crate electrs; +extern crate mempool_electrs; use std::{convert::TryInto, thread::ThreadId, time::Instant}; -use electrs::{config::Config, new_index::db::open_raw_db}; use lazy_static::lazy_static; +use mempool_electrs::{config::Config, new_index::db::open_raw_db}; /* // How to run: diff --git a/src/bin/tx-fingerprint-stats.rs b/src/bin/tx-fingerprint-stats.rs index 55cb6797..14f1581a 100644 --- a/src/bin/tx-fingerprint-stats.rs +++ b/src/bin/tx-fingerprint-stats.rs @@ -1,4 +1,4 @@ -extern crate electrs; +extern crate mempool_electrs; #[cfg(not(feature = "liquid"))] #[macro_use] @@ -11,7 +11,7 @@ fn main() { use bitcoin::blockdata::script::Script; use bitcoin::consensus::encode::deserialize; - use electrs::{ + use mempool_electrs::{ chain::Transaction, config::Config, daemon::Daemon, diff --git a/src/config.rs b/src/config.rs index ff81d4ad..9c8cfc26 100644 --- a/src/config.rs +++ b/src/config.rs @@ -85,7 +85,7 @@ impl Config { pub fn from_args() -> Config { let network_help = format!("Select network type ({})", Network::names().join(", ")); - let args = App::new("Electrum Rust Server") + let args = App::new("Mempool Electrum Rust Server") .version(crate_version!()) .arg( Arg::with_name("version")