Unix sockets provide better security and performance, so it is natural for electrs to want to support them. Because of how similar they are to TCP sockets the required changes are theoretically small. However, there is no crate I know of that provided the abstract API, so I made one. I originally only wanted to support electrum RPC but it turns out not having to deal with two sets of `SocketAddr` is easier and it wasn't too difficult. Unix socket was already supported by `tiny_http` via their own abstraction and we have no other dependencies requiring TCP. Because this also required modifying the logic around publishing the electrum address I added an option to set it explicitly regardless of whether the user is dealing with Unix or TCP socket because having this is useful for TCP too - the user might want to publish a different port number if the port was mapped via NAT or a different address when tunnelled. In theory, this is still not perfect because the same server could be tunnelled multiple times but we don't bother with such edge case until someone requires it. Another side improvement is reporting if the accept thread ends because of incoming stream ending rather than error. This should never happen but is useful for debugging if it ever does. |
||
|---|---|---|
| .cargo | ||
| .github | ||
| contrib | ||
| doc | ||
| examples | ||
| internal | ||
| logo | ||
| src | ||
| tests | ||
| .dockerignore | ||
| .gitignore | ||
| build.rs | ||
| Cargo.lock | ||
| Cargo.toml | ||
| CONTRIBUTING.md | ||
| Dockerfile | ||
| Dockerfile.ci | ||
| LICENSE | ||
| README.md | ||
| RELEASE-NOTES.md | ||
| server.sh | ||
| TODO.md | ||
Electrum Server in Rust
An efficient re-implementation of Electrum Server, inspired by ElectrumX, Electrum Personal Server and bitcoincore-indexd.
The motivation behind this project is to enable a user to self host an Electrum server, with required hardware resources not much beyond those of a full node. The server indexes the entire Bitcoin blockchain, and the resulting index enables fast queries for any given user wallet, allowing the user to keep real-time track of balances and transaction history using the Electrum wallet. Since it runs on the user's own machine, there is no need for the wallet to communicate with external Electrum servers, thus preserving the privacy of the user's addresses and balances.
BTC Prague 2024 dev/hack/day slides are here: https://bit.ly/electrs
Usage
Please prefer to use OUR usage guide!
External guides can be out-of-date and have various problems. At least double-check that the guide you're using is actively maintained. If you can't use our guide, please ask about what you don't understand or consider using automated deployments.
Note that this implementation of Electrum server is optimized for personal/small-scale (family/friends) usage. It's a bad idea to run it publicly as it'd expose you to DoS and maybe also other attacks. If you want to run a public server you may be interested in the Blockstream fork of electrs which is better optimized for public usage at the cost of consuming significantly more resources.
- Installation from source
- Pre-built binaries (No official binaries available but a beta repository is available for installation)
- Configuration
- Usage
- Monitoring
- Upgrading - contains information about important changes from older versions
Features
- Supports Electrum protocol v1.4
- Maintains an index over transaction inputs and outputs, allowing fast balance queries
- Fast synchronization of the Bitcoin blockchain (~6.5 hours for ~504GB @ August 2023) using HDD storage.
- Low index storage overhead (~10%), relying on a local full node for transaction retrieval
- Efficient mempool tracker (allowing better fee estimation)
- Low CPU & memory usage (after initial indexing)
txindexis not required for the Bitcoin node- Uses a single RocksDB database, for better consistency and crash recovery
Altcoins
Altcoins are not supported! Forks of Bitcoin codebase that relax the consensus rules (hard forks) are also not supported.
You may be able to find a fork of electrs that does support them, look around or make your own, just don't file issues/PRs here.
Index database
The database schema is described here.
Contributing
All contributions to this project are welcome. Please refer to the Contributing Guidelines for more details.
Logo
Our logo is generously provided by Dominik Průša under the MIT license. Based on the Electrum logo and the Rust language logo.