# NS-Indexer — NS-Protocol Indexer service in Rust [![License](https://img.shields.io/crates/l/ns-indexer.svg)](https://github.com/ldclabs/ns-rs/blob/main/LICENSE) [![Crates.io](https://img.shields.io/crates/d/ns-indexer.svg)](https://crates.io/crates/ns-indexer) [![CI](https://github.com/ldclabs/ns-rs/actions/workflows/ci.yml/badge.svg)](https://github.com/ldclabs/ns-rs/actions/workflows/ci.yml) [![Docs.rs](https://img.shields.io/docsrs/ns-indexer?label=docs.rs)](https://docs.rs/ns-indexer) [![Latest Version](https://img.shields.io/crates/v/ns-indexer.svg)](https://crates.io/crates/ns-indexer) More information about the protocol can be found in the [protocol documentation](https://github.com/ldclabs/ns-protocol) ## Dependencies 1. **Bitcoin RPC server** with `txindex` option enabled, don't need wallet. For example, run a regtest node: ```sh bitcoind -regtest -txindex -rpcuser=test -rpcpassword=123456 -fallbackfee=0.00001 ``` 2. **ScyllaDB** as a database, run it in a docker container as development environment: ```sh 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](https://github.com/ldclabs/ns-rs/tree/main/crates/ns-indexer/cql) ## Development ### Run the indexer on local machine Build: ```sh cargo build --package ns-indexer --bin ns-indexer ``` Create `.env` file from sample and edit it: ```sh cp ./crates/ns-indexer/sample.env .env ``` Run: ```sh ./target/debug/ns-indexer ``` ### Build for production Cross compile for linux: ```sh 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](https://github.com/ldclabs/ns-rs/tree/main/crates/ns-indexer/doc) generated by [Insomnia](https://insomnia.rest/). The mime type of the request and response in documentation is `application/json`, but the real mime type is `application/cbor`.