Go to file
GroovieGermanikus 7f7a931b5f
log GSO enable/disable
2023-10-09 17:40:02 +02:00
.github/workflows spit validator test 2023-09-19 12:57:38 +02:00
bench removing unwanted file 2023-09-01 09:09:54 +02:00
benches use postitional_arg helper 2023-03-30 08:04:58 +05:30
cd Deploy QUIC Proxy (#187) 2023-09-08 14:13:20 +01:00
cluster-endpoints adding previous blockhash and renaming txs to transactions 2023-09-21 16:08:41 +02:00
core remove unused import 2023-10-09 17:39:47 +02:00
docs Add RPC subscriptions 2023-09-22 16:37:32 +02:00
history adding previous blockhash and renaming txs to transactions 2023-09-21 16:08:41 +02:00
lite-rpc implementing history, block storage method 2023-09-21 15:39:25 +02:00
migrations implement parsing of compute budget instructions (#123) 2023-04-17 00:16:53 +02:00
quic-forward-proxy rework flag method 2023-10-04 21:01:07 +02:00
quic-forward-proxy-integration-test fix throughput_50 2023-09-26 19:23:41 +02:00
services log GSO enable/disable 2023-10-09 17:40:02 +02:00
tests fetching block from estimated slot instead of polling by rpc. Dropping transactions that have already been confirmed 2023-05-01 08:11:19 +02:00
.dockerignore Add docker build, fly config 2023-01-13 19:23:53 +00:00
.gitignore optimized create_n_users bench and ignore out.json 2023-03-27 17:20:59 +05:30
CHANGELOG.md Updating changelog.md 2023-09-21 16:05:41 +02:00
Cargo.lock WIP: add DISABLE_GSO env flag 2023-10-04 20:44:52 +02:00
Cargo.toml WIP: add DISABLE_GSO env flag 2023-10-04 20:44:52 +02:00
Dockerfile removing quic forward proxy from the fly 2023-09-09 17:55:37 +02:00
LICENSE switch to AGPL 2023-03-25 15:47:44 +04:00
README.md Merge pull request #168 from blockworks-foundation/groovie/tpu-proxy-improved-docs 2023-09-13 20:21:49 +02:00
fly.toml removing quic forward proxy from the fly 2023-09-09 17:55:37 +02:00
jest.config.js typescript tests 2023-01-04 19:16:43 +05:30
package-lock.json add MAX_RECENT_BLOCKHASSHES and some logs (#49) 2023-02-10 17:01:23 +01:00
package.json random string 2023-03-26 15:59:15 +05:30
rust-toolchain.toml add rust-toolchain.toml with rust 1.70.0 2023-09-19 11:16:56 +02:00
test.bash minor fixed in test.bash 2023-09-19 13:50:05 +02:00
tsconfig.json add MAX_RECENT_BLOCKHASSHES and some logs (#49) 2023-02-10 17:01:23 +01:00
yarn.lock random string 2023-03-26 15:59:15 +05:30

README.md

Lite RPC For Solana Blockchain

Submitting a transaction to be executed on the solana blockchain, requires the client to identify the next few leaders based on the leader schedule, look up their peering information in gossip and connect to them via the quic protocol. In order to simplify the process so it can be triggered from a web browser, most applications run full validators that forward the transactions according to the protocol on behalf of the web browser. Running full solana validators is incredibly resource intensive (>256GB RAM), the goal of this project would be to create a specialized micro-service that allows to deploy this logic quickly and allows horizontal scalability with commodity vms. Optionally the Lite RCP micro-services can be configured to send the transactions to a complementary QUIC forward proxy instead of the solana tpu (details).

Confirmation strategies

  1. Subscribe to new blocks using blockSubscribe
  2. Subscribing to signatures with pool of rpc servers. (Under development)
  3. Listening to gossip protocol. (Future roadmap)

Executing

make sure solana-validator is running in the background with --rpc-pubsub-enable-block-subscription

run using

$ cargo run --release

to know about command line options

$ cargo run --release -- --help

Test and Bench

Make sure both solana-validator and lite-rpc is running

test

$ cargo test

bench

$ cd bench and cargo run --release

Find a new file named metrics.csv in the project root.

Deployment

Environment Variables

env purpose required?
RPC_URL HTTP URL for a full RPC node yes, for docker
WS_URL WS URL for a full RPC node yes, for docker
IDENTITY Staked validator identity keypair no
PG_ENABLED Set to anything but 'false' to enable Postgres no
PG_CONFIG Postgres Connection Config if postgres enabled
CA_PEM_B64 Base64 encoded ca.pem if postgres enabled
CLIENT_PKS_B64 Base64 encoded client.pks if postgres enabled
CLIENT_PKS_PASS Password to client.pks if postgres enabled

Postgres

lite-rpc implements an optional postgres service that can write to postgres database tables as defined in ./migrations. This can be enabled by either setting the environment variable PG_ENABLED to true or by passing the -p option when launching the executable. If postgres is enabled then the optional environment variables shown above must be set.

Metrics

Various Prometheus metrics are exposed on localhost:9091/metrics which can be used to monitor the health of the application in production. Grafana dashboard coming soon!

Deployment on fly.io

While lite-rpc can be deployed on any cloud infrastructure, it has been tested extensively on https://fly.io. An example configuration has been provided in fly.toml. We recommend a dedicated-cpu-2x VM with at least 4GB RAM.

The app listens by default on ports 8890 and 8891 for HTTP and Websockets respectively. Since only a subset of RPC methods are implemented, we recommend serving unimplemented methods from a full RPC node using a reverse proxy such as HAProxy or Kong. Alternatively, you can connect directly to lite-rpc using a web3.js Connection object that is only used for sending and confirming transactions.

Example

fly apps create my-lite-rpc
fly secrets set -a my-lite-rpc RPC_URL=... WS_URL=...   # See above table for env options
fly scale vm dedicated-cpu-2x --memory 4096 -a my-lite-rpc
fly deploy -a my-lite-rpc --remote-only # To just launch lite-rpc
fly deploy -c cd/lite-rpc.toml -a my-lite-rpc --remote-only # To launch lite-rpc with proxy mode

Copyright (c) 2022 Blockworks Foundation

Licensed under the AGPL-3.0 license