Skip to content
/ read-rpc Public

Read-only NEAR RPC centralized-like performant solution

Notifications You must be signed in to change notification settings

near/read-rpc

Repository files navigation

Read RPC

This workspace holds the collection of components for the Read RPC.

Current content

The JSON RPC server implementation that repeats all the APIs current real NEAR JSON RPC but using a different data sources:

  • The Read RPC Storage (ScyllaDB currently)
  • NEAR Lake Data buckets (AWS S3 currently)
  • real NEAR JSON RPC

The indexer built on top of Lake Framework that watches the network and stores the StateChanges into the Storage (ScyllaDB) using the designed data schemas.

The indexer built on NEAR Indexer Framework

The indexer built on top of Lake Framework that watches the network and stores the Transactions along with all the related entities (Receipts, ExecutionOutcomes) into the Storage (ScyllaDB) using the specifically defined TransactionDetails structure in a dumped way (using the simplest key-value schema)

The configuration module is responsible for managing the configuration settings of the NEAR ReadRPC project.

Docker compose

Note! The docker compose is not fully ready yet. It's still in progress. However, you can run the entire project to play around with it. It is still not convenient for development or debugging purposes. We are working on improving it.

Run the entire project

Put TOML file config.toml with configuration in the home root of the project. See the example here.

Run the docker compose:

$ docker-compose up

This will spin up:

  • read-rpc-server - the JSON RPC server
  • state-indexer - the indexer that watches the network and stores the StateChanges into the Storage (ScyllaDB) using the designed data schemas.
  • tx-indexer - the indexer that watches the network and stores the Transactions along with all the related entities (Receipts, ExecutionOutcomes) into the Storage (ScyllaDB) using the specifically defined TransactionDetails structure in a dumped way (using the simplest key-value schema)
  • jaeger - the Jaeger instance for tracing (http://localhost:16686)

Examples:

See examples here.

TODO:

  • Setup all the services to use volumes for the codebase and using cargo watch to recompile the code on the fly
  • Come up with the way of changin the configuration for the indexers in a convenient way
  • Robust documentation for the docker compose setup

Development

Check the entire product

cargo check

Fmt the entire product

cargo fmt --all

Run a specific package

cargo run --package <package_name>

Example:

cargo run --release --package rpc-server

Please don't forget to handle .env files properly if you're running the package from the root using the proposed approach.

Keep in mind

You can move to the folder with a package

cd rpc-server/

And run a package as usually from the folder

cargo run --release

In this case you would want to have an .env file in the package folder.

Tracing

See the tracing documentation here