Skip to content

Commit

Permalink
chore: add more doc
Browse files Browse the repository at this point in the history
  • Loading branch information
zensh committed Jan 1, 2024
1 parent d56688d commit 41b4ec2
Show file tree
Hide file tree
Showing 6 changed files with 590 additions and 11 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# ns-rs
# NS-RS — Inscribing Name service on Bitcoin network

Rust implementation of NS-Protocol (Name & Service Protocol) by the LDC Labs
Rust implementation of [NS-Protocol](https://github.com/ldclabs/ns-protocol) (Name & Service Protocol) by the LDC Labs

| Crate | | Crates.io | Documentation |
| -------------------------------------------------------------------------------------------------------------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
| [Generic NS-Protocol library implementation](https://github.com/ldclabs/ns-rs/tree/main/crates/ns-protocol) | [`ns-protocol`] | [![crates.io](https://img.shields.io/crates/v/ns-protocol.svg)](https://crates.io/crates/ns-protocol) | [![Documentation](https://docs.rs/ns-protocol/badge.svg)](https://docs.rs/ns-protocol) |
| [NS-Protocol Indexer service in Rust](https://github.com/ldclabs/ns-rs/tree/main/crates/ns-indexer) | [`ns-indexer`] | [![crates.io](https://img.shields.io/crates/v/ns-indexer.svg)](https://crates.io/crates/ns-indexer) | [![Documentation](https://docs.rs/ns-indexer/badge.svg)](https://docs.rs/ns-indexer) |
| [NS-Protocol Inscriber library in Rust](https://github.com/ldclabs/ns-rs/tree/main/crates/ns-inscriber) | [`ns-inscriber`] | [![crates.io](https://img.shields.io/crates/v/ns-inscriber.svg)](https://crates.io/crates/ns-inscriber) | [![Documentation](https://docs.rs/ns-inscriber/badge.svg)](https://docs.rs/ns-inscriber) |
| [NS-Protocol Inscriptions and states data fetcher library in Rust](https://github.com/ldclabs/ns-rs/tree/main/crates/ns-fetcher) | [`ns-fetcher`] | [![crates.io](https://img.shields.io/crates/v/ns-fetcher.svg)](https://crates.io/crates/ns-fetcher) | [![Documentation](https://docs.rs/ns-fetcher/badge.svg)](https://docs.rs/ns-fetcher) |
54 changes: 51 additions & 3 deletions crates/ns-indexer/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,61 @@
# ns-indexer
# 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
cargo run --package ns-indexer --bin ns-indexer
./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`.
Loading

0 comments on commit 41b4ec2

Please sign in to comment.