Skip to content
George Milescu edited this page Sep 13, 2023 · 13 revisions

ReadRPC

ReadRPC is an API server designed to integrate seamlessly with NEAR-RPC. ReadRPC is a departure from the conventional use of the NEAR node. By sidestepping the traditional dependence on the NEAR node, ReadRPC harnesses the ability to scale easily, leveraging efficiencies offered by a dedicated database system.

The journey begins with the NEAR Lake indexing solution, which directly captures and funnels the data into a unified database. From there, the ReadRPC server functions like a typical web 2.0 API server, delivering the data with exceptional speed and efficiency.

Merging the robustness of blockchain technology with the agility of a dedicated database framework, ReadRPC offers a cutting-edge solution for optimized data access.

The API of the ReadRPC is the same as NEAR RPC API. You can query like you used to, just replace the endpoint URL, like in the example (using cURL):

curl -X POST https://beta.rpc.testnet.near.org \
     -H "Content-Type: application/json" \
     -d '{
         "jsonrpc": "2.0",
         "id": "dontcare",
         "method": "block",
         "params": {
           "finality": "final"
         }
     }'

See NEAR RPC API Docs for the reference.

Rationale Behind ReadRPC

Our primary motivation behind the ReadRPC project was to find an efficient alternative to running numerous nearcore nodes for RPC service, given their high costs and required maintenance.

As the project unfolded, we identified an opportunity to extend its benefits beyond our internal needs. We recognized its potential to serve the broader community, allowing individuals and entities like dApp owners to run customized ReadRPC "nodes." These nodes can be tailored to retain only data pertinent to their specific applications, enhancing efficiency.

An unexpected advantage emerged during our development phase: the capability of ReadRPC to house archival data. This meant that the entire historical data could be stored within ReadRPC using significantly less storage space, further emphasizing the system's cost and space efficiency.

Clarification on ReadRPC versus Archival RPC

While ReadRPC has been developed to offer a streamlined approach to reading data, it is important to understand that for the moment it is not intended as a direct replacement for Archival RPC. There are distinct differences and inherent limitations that users should be aware of:

  • Proofs: ReadRPC does not currently provide proofs, which may be essential for some applications.
  • Method Implementation: Not all methods present in Archival RPC are currently implemented in ReadRPC. Some of these methods might never see an implementation in the future.
  • Data Reading Focus: The core competency of ReadRPC is centered on reading data, and it is optimized for this primary function.
  • Lag in Data Update: Built atop the NEAR Lake Framework, ReadRPC's final block typically lags behind the network by approximately 3 blocks. We are aware of this lag and are exploring avenues to improve this aspect in the future.

If any of these limitations are critical for your specific use-case, we highly encourage you to share back your concerns. Please open an issue detailing your requirements so we can gain insight into its impact on the community. Your feedback helps us understand the needs better and prioritize our development initiatives effectively.

Current State of ReadRPC

Currently, the ReadRPC project operates as a service in beta mode. Our primary objective during this phase is to rigorously test its capabilities, monitor its performance, and gather valuable feedback to refine and enhance its functionalities.

Future Provisions for Distribution:

In our commitment to making the ReadRPC platform more accessible and user-friendly, we have plans to publish database snapshots regularly in the future. This approach will enable users to initialize and run their own ReadRPC node rapidly, eliminating the need to start from scratch and ensuring a smoother, quicker setup process.

Documentation Efforts:

Recognizing the importance of comprehensive guidance for our user community, we are actively working on drafting detailed documentation tailored for ReadRPC node operators. This documentation will serve as an invaluable resource, providing step-by-step instructions, best practices, and troubleshooting guidelines to ensure optimal operation and maintenance of ReadRPC nodes.

We are enthusiastic about the journey ahead and look forward to expanding and refining ReadRPC in response to the needs and feedback of our community.

Known issues

Please look for issues with labels beta and/or data mismatch to track the known issues we're handling.

Don't hesitate to fire issues if you notice something

Future Plans for ReadRPC

As we look ahead, there are exciting enhancements and modifications in the pipeline for the ReadRPC project:

Database-Agnosticism:

One of the primary advancements we're targeting is refactoring the project to be database-agnostic. By doing so, we aim to make ReadRPC adaptable and compatible with various database systems, broadening its applicability and flexibility for diverse use cases.

Selective Data Retention:

In our quest to optimize performance and reduce storage demands, we are working on a feature allowing instances to carry only specific account or contract-related data. This tailored approach will make each instance more efficient and significantly decrease the database size, leading to better scalability and reduced operational costs.

By implementing these enhancements, we are confident that ReadRPC will continue to evolve, offering even more value to its users while staying true to its core principles of efficiency and adaptability.

More technical details