Rust implementation of indexing node for ergvein mobile wallet.
- The local nix shell provides rustup or install it manually.
- Add toolchain:
rustup toolchain add nightly && rustup default nightly
- You will need
clang
andllvm
to build rocksdb dependency. - Build:
cargo build
andcargo build --release
for release binary.
You will need either any public remote node, or local one (prefer for speed of indexation):
cargo run --release -- 127.0.0.1:8333
We have official docker image ergvein/ergvein-index-server:rusty built from the Dockerfile
.
docker run --rm --volume ergveindata:/data --network host ergvein/ergvein-index-server:rusty --host 0.0.0.0 --bitcoin 127.0.0.1:8333
Here we use no network isolation and assumes that you have running BitcoinCore on the 8333
port.
- Create nix module based on following code:
{config, lib, pkgs, ...}:
let
ergvein = (import <nixpkgs> {}).fetchFromGitHub {
owner = "hexresearch";
repo = "ergvein-rusty";
rev = "c4eb3fdb19a90e0a153f97413a8ee68fd3f0efa3";
sha256 = "19q3g9w8rk5rf4a22c1a8igxbhyh3j1zln57m6px918yfq7aa131";
};
in {
imports = [
"${ergvein}/nix/modules/ergvein.nix"
];
config = {
services.ergvein = {
enable = true;
externalAddress = "{ExternalAddress}:8667";
metrics = true;
};
services.ergvein-rusty = {
blockBatch = 100;
maxCache = {UTXO_COUNT};
};
services.bitcoin.passwordHMAC = "{HMAC}";
};
}
Where:
- ExternalAddress is IP of hosting machine thus an address of indexer
- HMAC credentials for bitcoin node RPC. Follow this to generate your own https://github.com/bitcoin/bitcoin/tree/master/share/rpcauth
- UTXO_COUNT is number of UTXO stored in RAM cache. Max memory consumption: 15Gb at 40000000, 10.5Gb at 20000000. Feel free to experiment with it but beware of out of memory error on high values
- Edit configuration.nix
- add created module to import
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
./cachix.nix
{PATH_TO_MODULE}
];
- allow indexer port (8667 by default for mainnet) in firewall
networking.firewall.allowedTCPPorts = [ 8667 ];
3 Apply changes by running nixos-rebuild switch
command