Secret Network — Information, Transactions, ABCI, Gaia REST, Staking (3/3)
API reference for Secret Network. All methods ->
ABCI
abci_info
Retrieves application info.
Parameters
None.
Returns
Application info.
Request example
- JSON-RPC
- REST
curl -X POST https://rpc.ankr.com/scrt/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "abci_info",
"params": [],
"id": 1
}'
curl https://rpc.ankr.com/http/scrt/abci_info
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"response": {
"data": "secret",
"version": "1.6.1",
"last_block_height": "7690381",
"last_block_app_hash": "J1tJC9R3q3cNzkDcI7ipyi9NuZ8XUVbMyy7B42TPWuc="
}
}
}
abci_query
Queries the application for particular information.
Parameters
path(string; required): a path to the data ("/a/b/c").data(string; required): the data.height(integer; default: 0): the height (0 means latest).prove(boolean; default: false): adds proofs of the transactions inclusion in the block.
Returns
Particular info according to the query submitted.
Request example
- JSON-RPC
- REST
curl -X POST https://rpc.ankr.com/scrt/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "abci_query",
"params": ["a/b/c", "the_data", "1", true],
"id": 1
}'
curl https://rpc.ankr.com/http/scrt/blockchain?path=%2Fa%2Fb%2Fc&data=the_data&height=1&prove=true
Response example
{
"error": "",
"result": {
"response": {
"log": "exists",
"height": "0",
"proof": "010114FED0DAD959F36091AD761C922ABA3CBF1D8349990101020103011406AA2262E2F448242DF2C2607C3CDC705313EE3B0001149D16177BC71E445476174622EA559715C293740C",
"value": "61626364",
"key": "61626364",
"index": "-1",
"code": "0"
}
},
"id": 0,
"jsonrpc": "2.0"
}
Gaia REST
/node_info
Retrieves the properties of the connected node.
Parameters
None.
Returns
Node status.
Request example
curl https://rpc.ankr.com/http/scrt_cosmos/node_info
Response example
{
"application_version": {
"build_tags": "string",
"client_name": "string",
"commit": "string",
"go": "string",
"name": "string",
"server_name": "string",
"version": "string"
},
"node_info": {
"id": "string",
"moniker": "validator-name",
"protocol_version": {
"p2p": 7,
"block": 10,
"app": 0
},
"network": "gaia-2",
"channels": "string",
"listen_addr": "192.168.56.1:26656",
"version": "0.15.0",
"other": {
"tx_index": "on",
"rpc_address": "tcp://0.0.0.0:26657"
}
}
}
Transactions
/txs
Broadcasts a signed transaction to a full node.
Parameters
txBroadcast(object; required): the transaction must be a signed StdTx. The supported broadcast modes includeblock(returns after tx commit),sync(returns after CheckTx) andasync(returns right away).
{
"tx": {
"msg": [
"string"
],
"fee": {
"gas": "string",
"amount": [
{
"denom": "stake",
"amount": "50"
}
]
},
"memo": "string",
"signature": {
"signature": "MEUCIQD02fsDPra8MtbRsyB1w7bqTM55Wu138zQbFcWx4+CFyAIge5WNPfKIuvzBZ69MyqHsqD8S1IwiEp+iUb6VSdtlpgY=",
"pub_key": {
"type": "tendermint/PubKeySecp256k1",
"value": "Avz04VhtKJh8ACCVzlI8aTosGy0ikFXKIVHQ3jKMrosH"
},
"account_number": "0",
"sequence": "0"
}
},
"mode": "block"
}
Returns
Tx broadcasting result.
Request example
curl -X POST https://rpc.ankr.com/http/YOUR_ANKR_API_KEY/scrt_cosmos/txs
Response example
{
"check_tx": {
"code": 0,
"data": "data",
"log": "log",
"gas_used": 5000,
"gas_wanted": 10000,
"info": "info",
"tags": [
"",
""
]
},
"deliver_tx": {
"code": 5,
"data": "data",
"log": "log",
"gas_used": 5000,
"gas_wanted": 10000,
"info": "info",
"tags": [
"",
""
]
},
"hash": "EE5F3404034C524501629B56E0DDC38FAD651F04",
"height": 0
}
Staking
/staking/delegators/{delegatorAddr}/delegations
Submits a delegation.
Parameters
delegation(body): delegates an amount of liquid coins to a validator.
{
"base_req": {
"from": "cosmos1g9ahr6xhht5rmqven628nklxluzyv8z9jqjcmc",
"memo": "Sent via Cosmos Voyager",
"chain_id": "Cosmos-Hub",
"account_number": "0",
"sequence": "1",
"gas": "200000",
"gas_adjustment": "1.2",
"fees": [
{
"denom": "stake",
"amount": "50"
}
],
"simulate": false
},
"delegator_address": "cosmos1depk54cuajgkzea6zpgkq36tnjwdzv4afc3d27",
"validator_address": "cosmosvaloper16xyempempp92x9hyzz9wrgf94r6j9h5f2w4n2l",
"amount": {
"denom": "stake",
"amount": "50"
}
}
delegatorAddr(string; required): a Bech32 AccAddress of a delegator.
Returns
Submission result codes:
- 200 — OK.
- 400 — Invalid delegator address or delegation request body.
- 401 — Key password is wrong.
- 500 — Internal Server Error.
Request example
curl -X POST https://rpc.ankr.com/http/YOUR_ANKR_API_KEY/scrt_cosmos/staking/delegators/{delegatorAddr}/delegations
Response example
{
"msg": [
"string"
],
"fee": {
"gas": "string",
"amount": [
{
"denom": "stake",
"amount": "50"
}
]
},
"memo": "string",
"signature": {
"signature": "MEUCIQD02fsDPra8MtbRsyB1w7bqTM55Wu138zQbFcWx4+CFyAIge5WNPfKIuvzBZ69MyqHsqD8S1IwiEp+iUb6VSdtlpgY=",
"pub_key": {
"type": "tendermint/PubKeySecp256k1",
"value": "Avz04VhtKJh8ACCVzlI8aTosGy0ikFXKIVHQ3jKMrosH"
},
"account_number": "0",
"sequence": "0"
}
}
/staking/delegators/{delegatorAddr}/unbonding_delegations
Submits an unbonding delegation.
Parameters
delegation(body): unbonds an amount of bonded shares from a validator.
{
"base_req": {
"from": "cosmos1g9ahr6xhht5rmqven628nklxluzyv8z9jqjcmc",
"memo": "Sent via Cosmos Voyager",
"chain_id": "Cosmos-Hub",
"account_number": "0",
"sequence": "1",
"gas": "200000",
"gas_adjustment": "1.2",
"fees": [
{
"denom": "stake",
"amount": "50"
}
],
"simulate": false
},
"delegator_address": "cosmos1depk54cuajgkzea6zpgkq36tnjwdzv4afc3d27",
"validator_address": "cosmosvaloper16xyempempp92x9hyzz9wrgf94r6j9h5f2w4n2l",
"amount": {
"denom": "stake",
"amount": "50"
}
}
delegatorAddr(string; required): a Bech32 AccAddress of a delegator.
cosmos16xyempempp92x9hyzz9wrgf94r6j9h5f06pxxv
Returns
Result codes:
- 200 — OK.
- 400 — Invalid delegator address or unbonding delegation request body.
- 401 — Key password is wrong.
- 500 — Internal Server Error.
Request example
curl -X POST https://rpc.ankr.com/http/YOUR_ANKR_API_KEY/scrt_cosmos/staking/delegators/{delegatorAddr}/unbonding_delegations
Response example
{
"msg": [
"string"
],
"fee": {
"gas": "string",
"amount": [
{
"denom": "stake",
"amount": "50"
}
]
},
"memo": "string",
"signature": {
"signature": "MEUCIQD02fsDPra8MtbRsyB1w7bqTM55Wu138zQbFcWx4+CFyAIge5WNPfKIuvzBZ69MyqHsqD8S1IwiEp+iUb6VSdtlpgY=",
"pub_key": {
"type": "tendermint/PubKeySecp256k1",
"value": "Avz04VhtKJh8ACCVzlI8aTosGy0ikFXKIVHQ3jKMrosH"
},
"account_number": "0",
"sequence": "0"
}
}