From 5559e14355c0565e3af696ae483d9f13c28c7dae Mon Sep 17 00:00:00 2001 From: Sam Kleinman Date: Thu, 3 Jun 2021 05:46:21 -0400 Subject: [PATCH] rpc: add chunked genesis endpoint (#299) * rpc: add chunked genesis endpoint * fix lint * feedback * add info about error * fix lint Co-authored-by: marbar3778 --- spec/rpc/README.md | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/spec/rpc/README.md b/spec/rpc/README.md index d1dc50579..fb66f2bda 100644 --- a/spec/rpc/README.md +++ b/spec/rpc/README.md @@ -30,6 +30,7 @@ This file defines the JSON-RPC spec of Tendermint. This is meant to be implement | [Commit](#commit) | ✅ | ✅ | | [Validators](#validators) | ✅ | ✅ | | [Genesis](#genesis) | ✅ | ✅ | + | [GenesisChunked](#genesischunked) | ✅ | ❌ | | [ConsensusParams](#consensusparams) | ✅ | ❌ | | [UnconfirmedTxs](#unconfirmedtxs) | ✅ | ❌ | | [NumUnconfirmedTxs](#numunconfirmedtxs) | ✅ | ❌ | @@ -796,7 +797,8 @@ curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\ ### Genesis -Get Genesis of the chain. +Get Genesis of the chain. If the response is large, this operation +will return an error: use `genesis_chunked` instead. #### Request @@ -856,6 +858,43 @@ curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\ } ``` +### GenesisChunked + +Get the genesis document in a chunks to support easily transfering larger documents. + +#### Parameters + +- `chunk` (integer): the index number of the chunk that you wish to + fetch. These IDs are 0 indexed. + +#### Request + +##### HTTP + +```sh +curl http://127.0.0.1:26657/genesis_chunked?chunk=0 +``` + +##### JSONRPC + +```sh +curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"genesis_chunked\",\"params\":{\"chunk\":0}}" +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 0, + "result": { + "chunk": 0, + "total": 10, + "data": "dGVuZGVybWludAo=" + } +} +``` + ### ConsensusParams Get the consensus parameters.