8 releases (5 breaking)

0.6.0 Jan 14, 2024
0.5.0 Jan 8, 2024
0.4.1 Jan 5, 2024
0.3.1 Dec 30, 2023
0.1.0 Dec 23, 2023

#3 in #ns-protocol

Download history 3/week @ 2023-12-20 8/week @ 2023-12-27 38/week @ 2024-01-03 6/week @ 2024-01-10 83/week @ 2024-02-14 1/week @ 2024-02-21 2/week @ 2024-02-28 2/week @ 2024-03-06 1/week @ 2024-03-13 17/week @ 2024-03-27 32/week @ 2024-04-03

52 downloads per month
Used in ns-inscriber

CC0 license

245KB
6K SLoC

NS-Indexer — NS-Protocol Indexer service in Rust

License Crates.io CI Docs.rs Latest Version

More information about the protocol can be found in the protocol documentation

Dependencies

  1. Bitcoin RPC server with txindex option enabled, don't need wallet. For example, run a regtest node:
bitcoind -regtest -txindex -rpcuser=test -rpcpassword=123456 -fallbackfee=0.00001
  1. ScyllaDB as a database, run it in a docker container as development environment:
sudo mkdir -p /mnt/scylla/data /mnt/scylla/commitlog /mnt/scylla/hints /mnt/scylla/view_hints
sudo docker run --restart=always --name scylla -d -p 9042:9042 --volume /mnt/scylla:/var/lib/scylla scylladb/scylla:5.2 --smp 1 --memory 2G --developer-mode 0

And then import the CQL schema https://github.com/ldclabs/ns-rs/tree/main/crates/ns-indexer/cql

Development

Run the indexer on local machine

Build:

cargo build --package ns-indexer --bin ns-indexer

Create .env file from sample and edit it:

cp ./crates/ns-indexer/sample.env .env

Run:

./target/debug/ns-indexer

Build for production

Cross compile for linux:

cargo build --release --target x86_64-unknown-linux-musl --package ns-indexer --bin ns-indexer

Docker image

https://github.com/ldclabs/ns-rs/pkgs/container/ns-indexer

API Documentation

Here is the API documentation generated by Insomnia.

The mime type of the request and response in documentation is application/json, but the real mime type is application/cbor.

Dependencies

~35–51MB
~861K SLoC