Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add V1 Rpc calls #2

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 47 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,47 @@
# rpc-v2-specs
A repository to store RPC-v2 related specification documents
# Solana RPC v2 Specs
A repository for RPC v2 related specifications & documents. This document is work-in-progress and subject to change.

## Objectives
1. Discuss changes to the standard RPC API. [https://docs.solana.com/api/http#json-rpc-api-reference]
2. Create a reference implementation that will support the standard API using common open-source software tools. The primary objectives are API compatibility and vendor configurability. Performance is a secondary concern for the reference implementation because vendor-specific infrastructure will ultimately determine performance.
3. The reference implementation should provide a base level of service for local testing with modular options to scale up for mainnet.

## Overview
### Intended User
Solana developers building the next great web3 app who want to run their own infrastructure.

### Problem
They need reference RPC software that scales from localhost up to a single-location, single-tenant mainnet service.

### Solution
The default configuration is suitable for a local test RPC service. There is also documentation illustrating a single-location, single-tenant mainnet service along with recommended hardware & configuration. Teams building Commercial or large-scale applications can use the reference implementation as a guide for their work -- some assembly required.

### Value Proposition (how much will this cost?)
A typical mainnet solution will be possible on a single high-spec bare metal server running in a professional data center. Additional servers will be required for scaling up or add-on services like the Metaplex DAS Read API.

## Details
### Model View Controller (MVC)
Built using a common MVC architecture for modular and maintainable code.
- Router -- Receive client request, route the request to the appropriate controller, get formatted response from controller, send it to the client. Written as a stand-alone service so it is not tied to load balancer software (HAproxy, NGINX, etc).
- Controller -- Get the request from the router, send it to backend, get the respsonse from the backend, send the response to the view layer for parsing, get the rendered view, and send the response to router to send back to the client.
- Views -- Parse the backend response based on the client request. For example, jsonParsed TX + parsing from Anchor IDL. Requests for the default format of base64 will bypass the view later for better performance.
- Model -- the backend data servers or validator RPC which will return data in base64 format.

Architecture is represented [here](architecture.md)

### Subject Domains
Solana RPC can be segmented into several subject domains. Each of the domains can be served from separate backends. The domains are:
- [sendTX](send_tx.md) -- methods related to sending and confirming transactions.
- [Accounts](accounts.md) -- methods used to query accounts by id, program, owner, etc.
- [Consensus](consensus.md) -- methods related to validator consensus (leader schedule, stakes, vote accounts, etc.)
- [History](history.md) -- query transactions and blocks back to genesis
- [Cluster](cluster) -- metadata related to cluster performance, health, etc.

## Contributors
- [Ellipsis Labs](https://ellipsislabs.xyz/)
- [Helium](https://www.helium.com/)
- [Helius](https://helius.xyz)
- [Mango Markets](https://mango.markets)
- [Sniper Labs](https://www.sniper.xyz/)
- [Solana Foundation](https://solana.org)
- [Triton One](https://www.triton.one)
26 changes: 26 additions & 0 deletions accounts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Accounts domain specifications

## V1 RPC call
- [getMultipleAccounts](https://docs.solana.com/api/http#getmultipleaccounts)
- [getProgramAccounts](https://docs.solana.com/api/http#getprogramaccounts)
- [getAccountInfo](https://docs.solana.com/api/http#getaccountinfo)
- [getLargestAccounts](https://docs.solana.com/api/http#getlargestaccounts)
- [getTokenLargestAccounts](https://docs.solana.com/api/http#gettokenlargestaccounts)
- [getBalance](https://docs.solana.com/api/http#getbalance)
- [getStakeActivation](https://docs.solana.com/api/http#getstakesctivation)
- [getTokenAccountBalance](https://docs.solana.com/api/http#gettokenaccountbalance)
- [getTokenAccountsByDelegate](https://docs.solana.com/api/http#gettokenaccountsbydelegate)
- [getTokenAccountsByDelegate](https://docs.solana.com/api/http#gettokenaccountsbydelegate)
- [getTokenSupply](https://docs.solana.com/api/http#gettokensupply)
- [getTransactionCount](https://docs.solana.com/api/http#gettransactioncount)

## V1 Subscriptions
- [programSubscribe](https://docs.solana.com/api/websocket#programsubscribe)

## V2 RPC call



## Entities

## Data source
118 changes: 118 additions & 0 deletions architecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# Architecture

This page present the way the RPC components can be organized.

This architecture suppose that RPC call have to works as the V1.

## Key points

Each domain are connected with the others using messages. It allow less dependency and a more flexible set up.

The Router route the client incoming request to the right domains backend

The View format the domains backend answer to the format asked by the clients.

Each domain implements its own access point using the protocol that is the most appropriate (Json, Grpc, GraphQL, ...).

An example of client request routine is presented for the account domain. This is the same for the other domains.

## Diagram

```mermaid
flowchart TD
subgraph History Domain
History("History Domain

at confirm/finalized
getBlock()
getTransaction()
...
")
end

subgraph Send Tx Domain
SendTx("SendTx Domain

send_transaction()
...
")
end

subgraph Account Domain
Account("SendTx Domain

getAccountInfo()
getProgramAccounts()
...
")
AccountSubscription("Subscription
programSubscribe
")
end

subgraph Validator Host
Validator["Solana Validator
Validator process
+ GRPC Geyser"]
end

subgraph Consensus
Consensus("RPC calls:
getVoteAccounts()
getLeaderSchedule()
getSlot()
...
")
ConsensusSubscription("Subscriptions:
slotSubscribe
blockSubscribe
...
")
end
subgraph Cluster Domain
Cluster("Cluster Sub Domain

getClusterNodes()")
end

subgraph Router
AccessRouter("Get client request
route to the domain
")

AccesView("Format answer
return to the client
")
end

subgraph Client
RPCClient("Client
Send a request/subscription
")
end

Validator-- "geyser Block/Slot" -->Consensus
Validator-- "geyser Account" -->Account
Validator-- "Cluster info" -->Cluster
Account-- "Stake/Vote Account" -->Consensus
Consensus-- "Block Info/Slot/Leader Schedule" -->SendTx
Consensus-- "confirmed Tx" -->SendTx
Cluster-- "Cluster info" -->SendTx
Consensus-- "Full Block/Slot/Epoch" -->History

AccessRouter-- "forward request" --> Account
Account-- "get answer" --> AccesView

Client<-- "get answer" --> AccessRouter

classDef consensus fill:#1168bd,stroke:#0b4884,color:#ffffff
classDef history fill:#666,stroke:#0b4884,color:#ffffff
classDef sendtx fill:#08427b,stroke:#052e56,color:#ffffff
classDef redgray fill:#62524F, color:#fff
classDef greengray fill:#4F625B, color:#fff

class SendTx sendtx
class History redgray
class Consensus consensus
class Cluster greengray
```
26 changes: 26 additions & 0 deletions cluster.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Cluster domain specifications

## V1 RPC calls
- [getclusternodes](https://docs.solana.com/api/http#getclusternodes) not in geyser plugin can be get from gossip. Try to update gyser first.
- [getBlockProduction](https://docs.solana.com/api/http#getblockproduction)
- [getEpochSchedule](https://docs.solana.com/api/http#getepochschedule)
- [getFeeForMessage](https://docs.solana.com/api/http#getfeeformessage)
- [getGenesisHash](https://docs.solana.com/api/http#getgenesishash)
- [getHealth](https://docs.solana.com/api/http#gethealth)
- [getHighestSnapshotSlot](https://docs.solana.com/api/http#gethighestsnapshotslot)
- [getInflationGovernor](https://docs.solana.com/api/http#getinflationgovernor)
- [getInflationRate](https://docs.solana.com/api/http#getinflationrate)
- [getMinimumBalanceForRentException](https://docs.solana.com/api/http#getminimumbalanceforrentexemption)
- [getRecentPerformanceSamples](https://docs.solana.com/api/http#getrecentperformancesamples)
- [getStakeMinimumDelegation](https://docs.solana.com/api/http#getstakeminimumdelegation)
- [getSupply](https://docs.solana.com/api/http#getsupply)
- [getVersion](https://docs.solana.com/api/http#getversion)
- [requestAirdrop](https://docs.solana.com/api/http#requestairdrop)


## V2 RPC calls
- [getclusternodes](https://docs.solana.com/api/http#getclusternodes) not in geyser plugin can be get from gossip. Try to update gyser first.

## Entities

## Data source
57 changes: 57 additions & 0 deletions consensus.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Consensus domain specifications

## V1 RPC calls
- [getslot](https://docs.solana.com/api/http#getslot)
- [getBlockHeight](https://docs.solana.com/api/http#getblockheight)
- [getblocktime](https://docs.solana.com/api/http#getblocktime)
- [getfirstavailableblock](https://docs.solana.com/api/http#getfirstavailableblock)
- [minimumledgerslot](https://docs.solana.com/api/http#minimumledgerslot) can be merged with getfirstavailableblock
- [getlatestblockhash](https://docs.solana.com/api/http#getlatestblockhash)
- [isblockhashvalid](https://docs.solana.com/api/http#isblockhashvalid)
- [getblockcommitment](https://docs.solana.com/api/http#getblockcommitment) only for the last 150 blocks.
- [getepochinfo](https://docs.solana.com/api/http#getepochinfo)
- [getleaderschedule](https://docs.solana.com/api/http#getleaderschedule)
- [getSlotLeader](https://docs.solana.com/api/http#getslotleader)
- [getSlotLeaders](https://docs.solana.com/api/http#getslotleaders)
- [getvoteaccounts](https://docs.solana.com/api/http#getvoteaccounts)
- [getrecentperformancesamples](https://docs.solana.com/api/http#getrecentperformancesamples)
- [getsignaturesforaddress](https://docs.solana.com/api/http#getsignaturesforaddress) at process commitment.
- [getsignaturestatuses](https://docs.solana.com/api/http#getsignaturestatuses) at process commitment
- [getrecentprioritizationfees](https://docs.solana.com/api/http#getrecentprioritizationfees)
- [getBlockCommitment](https://docs.solana.com/api/http#getblockcommitment) at process commitment.
- [getFirstAvailableBlock](https://docs.solana.com/api/http#getfirstavailableblock)
- [getIdentity](https://docs.solana.com/api/http#getidentity)
- [getMaxRetransmitSlot](https://docs.solana.com/api/http#getmaxretransmitslot)
- [getRecentPrioritizationFees](https://docs.solana.com/api/http#getrecentprioritizationfees)

## V1 Subscriptions
- [slotSubscribe](https://docs.solana.com/api/websocket#slotsubscribe)
- [blockSubscribe](https://docs.solana.com/api/websocket#blocksubscribe)
- [transactionSubscribe](https://github.com/solana-foundation/solana-improvement-documents/pull/69)
- [logsSubscribe](https://docs.solana.com/api/websocket#logssubscribe)
- [signatureSubscribe](https://docs.solana.com/api/websocket#signaturesubscribe)
- [slotsUpdatesSubscribe](https://docs.solana.com/api/websocket#slotsupdatessubscribe)
- [voteSubscribe](https://docs.solana.com/api/websocket#votesubscribe)

## V2 RPC calls
- [getslot](https://docs.solana.com/api/http#getslot)
- [getepochinfo](https://docs.solana.com/api/http#getepochinfo)
- [getleaderschedule](https://docs.solana.com/api/http#getleaderschedule)
- [getlatestblockhash](https://docs.solana.com/api/http#getlatestblockhash)
- [getBlockHeight](https://docs.solana.com/api/http#getblockheight)
- [getvoteaccounts](https://docs.solana.com/api/http#getvoteaccounts)
- [getsignaturesforaddress](https://docs.solana.com/api/http#getsignaturesforaddress) at process commitment.
- [getsignaturestatuses](https://docs.solana.com/api/http#getsignaturestatuses) at process commitment
- getTransactionsByAddress at process commitment

## V2 Subscriptions
- [slotSubscribe](https://docs.solana.com/api/websocket#slotsubscribe)
- [blockSubscribe](https://docs.solana.com/api/websocket#blocksubscribe)
- [transactionSubscribe](https://github.com/solana-foundation/solana-improvement-documents/pull/69)

## Entities
- Leader Schedule: Vec<String, Vec<usize>>> : List of slot number per node Id.

## Data source
- Geyser plugin: Stake account, Vote account, Slot, FullBLock.

24 changes: 24 additions & 0 deletions history.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# History domain specifications

## V1 RPC calls
- [getblock](https://docs.solana.com/api/http#getblock)
- [getblocks](https://docs.solana.com/api/http#getblocks)
- [gettransaction](https://docs.solana.com/api/http#gettransaction) at confirm and finalized commitment.
- [getsignaturesforaddress](https://docs.solana.com/api/http#getsignaturesforaddress) at confirm and finalized commitment.
- [getsignaturestatuses](https://docs.solana.com/api/http#getsignaturestatuses) at confirm and finalized commitment.
- [getInflationReward](https://docs.solana.com/api/http#getinflationreward)
- [getBlocksWithLimit](https://docs.solana.com/api/http#getblockswithlimit)
- [getBlockCommitment](https://docs.solana.com/api/http#getblockcommitment) at confirm and finalized commitment.

## V2 RPC calls
- [getblock](https://docs.solana.com/api/http#getblock)
- [getblocks](https://docs.solana.com/api/http#getblocks)
- [gettransaction](https://docs.solana.com/api/http#gettransaction) at confirm and finalized commitment.
- [getsignaturesforaddress](https://docs.solana.com/api/http#getsignaturesforaddress) at confirm and finalized commitment.
- [getsignaturestatuses](https://docs.solana.com/api/http#getsignaturestatuses) at confirm and finalized commitment.
- getTransactionsByAddress at confirm and finalized commitment.


## Entities

## Data source
10 changes: 10 additions & 0 deletions send_tx.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# SendTx domain specifications

## V1 RPC call
- [sendtransaction](https://docs.solana.com/api/http#sendtransaction)
- [simulateTransaction](https://docs.solana.com/api/http#simulatetransaction)
## V2 RPC call

## Entities

## Data source