Diet RPC Node
Introduction
The diet client has to request specific shreds and block headers from the full nodes, in order to do that we have to implement a RPC node that can communicate with the light client using the JSON RPC API.
We added two new methods to the RPC node:
Get block headers method get_block_headers
Returns the requested block header by the slot number and block configuration
Input params:
- Slot
- RpcBlockConfig
Output:
BlockHeader
Block Header type
pub struct BlockHeader {
pub vote_signature: Vec<Option<String>>,
pub validator_identity: Vec<Option<Pubkey>>,
pub validator_stake: Vec<Option<u64>>,
}
Get shreds method get_shreds
Returns the requested shreds upon call filtered by the slot number and indices
Input params:
- Slot
- Shred Indices
Request:
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc": "2.0","id":1,"method":"getShreds","params":[1,[0,1,2] ]}
'
Output:
Vec<Option<Shred>>
Steps to build and run the RPC node
⚠️
Note: In the future once merkle shreds are enabled on devnet and testnet, the node will be able to run on the respective networks, but for now you will have to rely on the solana-test-validator