rpc: add chunked genesis endpoint (#299)

* rpc: add chunked genesis endpoint

* fix lint

* feedback

* add info about error

* fix lint

Co-authored-by: marbar3778 <marbar3778@yahoo.com>
This commit is contained in:
Sam Kleinman
2021-06-03 05:46:21 -04:00
committed by GitHub
parent a2a9ffbe7e
commit 5559e14355

View File

@@ -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.