Block/Tx

RESTFul API endpoint description

Step to send Tx

  • Run rest server

clif rest-server
  • Execute appropriate API endpoint

    • If sending tx purpose, proceed to sign tx

    • If query purpose, use the response

  • Get account number & sequence from `Get account info` API

  • Sign tx in local, and take the result

    • The response is unsigned tx

    • The API endpoint itself do not send the tx

  • Send the response above with `Send Tx` API

Example python SDK (Unofficial) is in https://github.com/psy2848048/hdacpy In Javascript, you may contribute from forking with https://github.com/cosmostation/cosmosjs

get
Check block

https://localhost:1317/blocks/<height>
Get block infor of given height
Request
Response
Request
Path Parameters
height
required
integer
Height of block
Response
200: OK
{
block_meta: {
block_id: {
hash: "D3CDC7F5AE4FD4DA6089E763B2C65396F087D267CDBB3A32721402322DAB91D5",
parts: {
total: "23",
hash: "0A2199FFAF6044260E69EF7BED9B00B72C6FC25D24E4B78E8686CCE090B5081A"
}
},
header: {
version: {
block: "10",
app: "0"
},
chain_id: "friday-devnet",
height: "6",
time: "2019-12-21T12:55:31.817734Z",
num_txs: "1",
total_txs: "1",
last_block_id: {
hash: "FB82EAC2527DF97F1B6D602DDD666BC33A93ED89F4C6767E1001E26FD5DF1156",
parts: {
total: "1",
hash: "A34081FFB9D23E43CDFC54A025C8F22FD8D59EB04B02689080A57A52565419F1"
}
},
last_commit_hash: "83CE78D03180C1B4C2F52FE826C48E72B4077C512100B71D0DA966DC52DD9255",
data_hash: "C1F3F67A513A8493A544DEB22D3488397AA203F13527E7A78402C4D973886EAE",
validators_hash: "FBEA4619EF72C75E9FEFBDE103D4863ECA7CF98CB55CC6F84FAF3295623FCFF2",
next_validators_hash: "FBEA4619EF72C75E9FEFBDE103D4863ECA7CF98CB55CC6F84FAF3295623FCFF2",
consensus_hash: "048091BC7DDC283F77BFBF91D73C44DA58C3DF8A9CBC867405D8B7F3DAADA22F",
app_hash: "6D1B04A1BFA534D78C3181D481133A2AF1CD0DE94B2F2EFB6FA9BCA37FC5DDDA",
last_results_hash: "",
evidence_hash: "",
proposer_address: "724FCF87E77AE1EB4CB730A4EC30BF69BC94FE8B"
}
},
block: {
header: {
version: {
block: "10",
app: "0"
},
chain_id: "friday-devnet",
height: "6",
time: "2019-12-21T12:55:31.817734Z",
num_txs: "1",
total_txs: "1",
last_block_id: {
hash: "FB82EAC2527DF97F1B6D602DDD666BC33A93ED89F4C6767E1001E26FD5DF1156",
parts: {
total: "1",
hash: "A34081FFB9D23E43CDFC54A025C8F22FD8D59EB04B02689080A57A52565419F1"
}
},
last_commit_hash: "83CE78D03180C1B4C2F52FE826C48E72B4077C512100B71D0DA966DC52DD9255",
data_hash: "C1F3F67A513A8493A544DEB22D3488397AA203F13527E7A78402C4D973886EAE",
validators_hash: "FBEA4619EF72C75E9FEFBDE103D4863ECA7CF98CB55CC6F84FAF3295623FCFF2",
next_validators_hash: "FBEA4619EF72C75E9FEFBDE103D4863ECA7CF98CB55CC6F84FAF3295623FCFF2",
consensus_hash: "048091BC7DDC283F77BFBF91D73C44DA58C3DF8A9CBC867405D8B7F3DAADA22F",
app_hash: "6D1B04A1BFA534D78C3181D481133A2AF1CD0DE94B2F2EFB6FA9BCA37FC5DDDA",
last_results_hash: "",
evidence_hash: "",
proposer_address: "724FCF87E77AE1EB4CB730A4EC30BF69BC94FE8B"
},
data: {
txs: [
"<parsed_tx_data>"
]
},
evidence: {
evidence: null
},
last_commit: {
block_id: {
hash: "FB82EAC2527DF97F1B6D602DDD666BC33A93ED89F4C6767E1001E26FD5DF1156",
parts: {
total: "1",
hash: "A34081FFB9D23E43CDFC54A025C8F22FD8D59EB04B02689080A57A52565419F1"
}
},
precommits: [
{
type: 2,
height: "5",
round: "0",
block_id: {
hash: "FB82EAC2527DF97F1B6D602DDD666BC33A93ED89F4C6767E1001E26FD5DF1156",
parts: {
total: "1",
hash: "A34081FFB9D23E43CDFC54A025C8F22FD8D59EB04B02689080A57A52565419F1"
}
},
timestamp: "2019-12-21T12:55:31.817734Z",
validator_address: "724FCF87E77AE1EB4CB730A4EC30BF69BC94FE8B",
validator_index: "0",
signature: "lUFY8r/bSED9/PV2u41O56KrFsATI3fN8HwNQq7xl6sqtj6y5Go6rSAtUp/21XdjIkuaRpb95ybk7hZSWRL5Dw=="
}
]
}
}
}

get
Get account info

https://localhost:1317/auth/accounts/<friday_address>
Request
Response
Request
Path Parameters
friday_address
optional
string
Address of friday system
Response
200: OK
{
"height": "552",
"result": {
"type": "friday/Account",
"value": {
"address": "friday1lgharzgds89lpshr7q8kcmd2esnxkfpwmfgk32",
"coins": [
{
"denom": "dummy",
"amount": "99226000"
}
],
"public_key": {
"type": "tendermint/PubKeySecp256k1",
"value": "A49sjCd3Eul+ZXyof7qO460UaO73otrmySHyTNSLW+Xn"
},
"account_number": "8",
"sequence": "2"
}
}
}

get
Check Tx

https://localhost:1317/txs/<tx_hash>
Check the whole JSON data of given tx hash
Request
Response
Request
Path Parameters
tx_hash
required
string
Broadcasted tx hash
Response
200: OK
{
"hash": "string",
"height": 0,
"tx":{
"fee":{
"amount":[],
"gas":"37000"
},
"memo":"",
"msg":[
{
"type":"executionengine/Execute",
"value":{
"block_hash":"AA==",
"contract_owner_account":"friday1lgharzgds89lpshr7q8kcmd2esnxkfpwmfgk32",
"exec_account":"friday1lgharzgds89lpshr7q8kcmd2esnxkfpwmfgk32",
"gas_price":"2000000",
"payment_args":"AQAAAAQAAAADgIQe",
"session_args":"AgAAABgAAAAUAAAAFX2WU5Tkt49ZzKlXxfh9zBFKLkQIAAAAAAAAAAAAAAA="
}
}
],
"signatures":[
{
"account_number":"11335",
"pub_key":{
"type":"tendermint/PubKeySecp256k1",
"value":"A49sjCd3Eul+ZXyof7qO460UaO73otrmySHyTNSLW+Xn"},"sequence":"0","signature":"spk/FpIIwMvPv1aKKPCxGWgJ0jdfATpAd2Z0Go+onOhPgMXJtNdiyl+MDaqPLevVlGaZPw42BbhHxrt/EtXFLg=="
}
}
]
}
}

post
Send Tx

https://localhost:1317/txs
[NOTE] Content-type: application/json
Request
Response
Request
Body Parameters
mode
required
string
:= block, sync, async
tx
required
string
Signed StdTx body
Response
200: OK