Giter Club home page Giter Club logo

solana-drpc's Introduction

SOLANA-DRPC

https://solana-drpc.blockpi.io/

A Decentralized RPC service for Solana

Partially open source

Solana DRPC is an innovative Web3 based infrastructure, establish a decentralized RPC service for Solana network.

The service will automatically scan the network and try to find out all the RPC nodes. Sort the RPC nodes and establish a DRPC proxy server with these nodes which have the lowest latency. Nodes are auto reweighted by latency and kicked out by status if not synced up. All the RPC requests will be distributed to different backends with fastest response.

Solana DRPC will give users a better experience and help developers to "Keep services always online".

Inspiration

Solana provides a very fluent user experience. But RPC is an obstacle in daily use. A better PRC infrastructure is expected both from our own experience and feedback from the community. It ensures that Solana's network provides an improved user and developer experience.

What it does

BlockPI DRPC service provides a distributed public RPC service network, it discovers the RPC nodes on the network automatically. Users' requests are allocated to the nearest RPC node or a node with the lowest latency. In this way, the RPC request pressure is spread over the entire network, maximizing resource utilization efficiency and improving user experience.

How we built it

Our team has more than four years of blockchain industry development experience. Team members are proficient in multiple programming languages, especially have rich experience in network and middleware development. We deployed more than one thousand blockchain nodes. The team developed the DRPC system based on our expertise in the blockchain infrastructure industry.

The system is developed by Golang and integrates the components such as Request, Cache, Rate Limit, Load Balance, Upstream Backends, Response, etc. The system currently supports JSON-RPC over HTTP requests and routing of a particular request to a specific RPC node. In the future, it will also support more request methods such as WebSocket, GRPC, and so on.

Challenges we ran into

During the development of the Solana DRPC renovation, we built RPC nodes by ourselves and found that Solana's RPC nodes required high hardware configurations. With the gradual development process, we realized that an excellent distributed RPC scheme that can reduce the cost of all developers and users and improve the efficiency of using network resources is very important.

Accomplishments that we're proud of

We finally finished the first phase of development! Thanks to all the developers who contributed resources and maintenance to Solana's infrastructure, BlockPI Solana DRPC can provide RPC services free of charge to the community.

What we learned

The Infrastructure of the Web 3.0 should have distinctive innovations along with a more open and inclusive community spirit. We hope that Solana DRPC will benefit all users and developers, empowering them to use the Solana network more smoothly and focus on their own business.

What's next for BlockPI Solana DRPC

We plan to add more utility functions, such as Cache Response, Load Balance, Offline Request, etc. Ultimately, we plan to integrate Solana DRPC into BlockPI networks, which will provide additional incentives for all RPC operators to ensure that Solana users and developers can continue to enjoy more stable, high-speed RPC services.

Features

  • Auto rpc nodes discovery
  • Backends are sorted by latency
  • Upstream: http
  • Load-balance: WeightedRound-Robin algorithm implement
  • Route rpc methods to specified endpoints
  • Dashboard
  • Upstream: websocket and grpc support
  • Cache requests
  • Offline requests

Usage

Getting Started

Dependencies

  • Install Go

Building from source

git clone https://github.com/blockpilabs/solana-drpc.git
go build

DRPC status api

http://localhost:8181/api/status

DRPC proxy endpoint

http://localhost:9191/

The backend upstream is set in the response headers.

curl -D - -H "Content-Type: application/json" \
  --data '{"method":"getHealth","params":[],"id":1,"jsonrpc":"2.0"}' \
  -X POST http://localhost:9191/
  
HTTP/2 200 
date: Wed, 13 Oct 2021 03:50:38 GMT
content-type: application/json
content-length: 38
access-control-allow-methods: GET, POST, PATCH, PUT, DELETE, OPTIONS
access-control-allow-origin: *
upstream: http://86.109.15.141:8899

{"id":1,"jsonrpc":"2.0","result":"ok"}
curl -D - -H "Content-Type: application/json" \
  --data '{"method":"getBlockHeight","params":[],"id":1,"jsonrpc":"2.0"}' \
  -X POST http://localhost:9191/
  
HTTP/2 200 
date: Wed, 13 Oct 2021 03:51:55 GMT
content-type: application/json
content-length: 42
access-control-allow-methods: GET, POST, PATCH, PUT, DELETE, OPTIONS
access-control-allow-origin: *
upstream: http://147.75.xx.xxx:8899

{"id":1,"jsonrpc":"2.0","result":90744928}
curl -D - -H "Content-Type: application/json" \
  --data '{"method":"getBalance","params":["ADDRESS"],"id":1,"jsonrpc":"2.0"}' \
  -X POST http://localhost:9191/
  
HTTP/2 200 
date: Wed, 13 Oct 2021 03:53:34 GMT
content-type: application/json
content-length: 81
access-control-allow-methods: GET, POST, PATCH, PUT, DELETE, OPTIONS
access-control-allow-origin: *
upstream: http://203.90.xxx.xxx:8899

{"id":1,"jsonrpc":"2.0","result":{"context":{"slot":101199099},"value":5565072}}

solana-drpc's People

Contributors

blockpinetwork avatar nodeasy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

solana-drpc's Issues

go build error

hello
Seems to be a little wrong

โžœ solana-drpc git:(main) โœ— go build

github.com/blockpilabs/solana-drpc/proxy

proxy/server.go:16:27: undefined: http_upstream.HttpUpstreamMiddleware
proxy/server.go:26:28: undefined: http_upstream.options

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.