140 lines
3.6 KiB
Markdown
140 lines
3.6 KiB
Markdown
# zenithd API
|
|
|
|
The zenithd node exposes REST API endpoints for querying blockchain state and network information. By default, the API server runs on port 1317, with Tendermint RPC on port 26657.
|
|
|
|
## Node and Network Information
|
|
|
|
```bash
|
|
# Get node status
|
|
curl http://localhost:26657/status
|
|
|
|
# Get node info
|
|
curl http://localhost:26657/node_info
|
|
|
|
# Get blockchain info
|
|
curl http://localhost:26657/blockchain
|
|
|
|
# Get latest block
|
|
curl http://localhost:26657/block
|
|
```
|
|
|
|
## Account and Balance Queries
|
|
|
|
```bash
|
|
# Query account information
|
|
curl http://localhost:1317/cosmos/auth/v1beta1/accounts/zenith1...
|
|
|
|
# Query account balances
|
|
curl http://localhost:1317/cosmos/bank/v1beta1/balances/zenith1...
|
|
|
|
# Query specific denomination balance
|
|
curl http://localhost:1317/cosmos/bank/v1beta1/balances/zenith1.../by_denom?denom=znt
|
|
```
|
|
|
|
## Onboarding Module Queries
|
|
|
|
```bash
|
|
# List all participants
|
|
curl http://localhost:1317/zenith/onboarding/participants
|
|
|
|
# Get specific participant
|
|
curl http://localhost:1317/zenith/onboarding/participant/zenith1...
|
|
```
|
|
|
|
## Scry Oracle Module Queries
|
|
|
|
```bash
|
|
# Get scry binding by path
|
|
curl http://localhost:1317/zenith/scryoracle/bindings?path=/~zen/group-store/groups
|
|
|
|
# Get bindings by block number
|
|
curl http://localhost:1317/zenith/scryoracle/bindings_by_block/100
|
|
|
|
# Get bindings in block range
|
|
curl http://localhost:1317/zenith/scryoracle/bindings_by_range?start=100&end=200
|
|
```
|
|
|
|
## Zenith Module Queries
|
|
|
|
```bash
|
|
# Get ownership by Azimuth point ID
|
|
curl http://localhost:1317/zenith/zenith/ownership/123
|
|
|
|
# Get balances by point
|
|
curl http://localhost:1317/zenith/zenith/balances_by_point/123
|
|
|
|
# Get current Ethereum height
|
|
curl http://localhost:1317/zenith/zenith/eth_height
|
|
|
|
# Get module parameters
|
|
curl http://localhost:1317/zenith/zenith/params
|
|
```
|
|
|
|
## Treasury Module Queries
|
|
|
|
```bash
|
|
# Get distribution info
|
|
curl http://localhost:1317/zenith/immutabletreasury/distribution/participant-id
|
|
|
|
# Get claimable tokens
|
|
curl http://localhost:1317/zenith/immutabletreasury/claimable/zenith1...
|
|
|
|
# Get block rewards state
|
|
curl http://localhost:1317/zenith/immutabletreasury/block_rewards
|
|
```
|
|
|
|
## Validator and Staking Queries
|
|
|
|
```bash
|
|
# List all validators
|
|
curl http://localhost:1317/cosmos/staking/v1beta1/validators
|
|
|
|
# Get specific validator
|
|
curl http://localhost:1317/cosmos/staking/v1beta1/validators/zenithvaloper1...
|
|
|
|
# Get delegations for an address
|
|
curl http://localhost:1317/cosmos/staking/v1beta1/delegations/zenith1...
|
|
```
|
|
|
|
## Using with Remote Nodes
|
|
|
|
```bash
|
|
# Query testnet node
|
|
curl https://zenithd.zenith-test.tlon.systems/status
|
|
|
|
# Query account balance on testnet
|
|
curl https://zenithd.zenith-test.tlon.systems/cosmos/bank/v1beta1/balances/zenith1...
|
|
|
|
# Query participants on testnet
|
|
curl https://zenithd.zenith-test.tlon.systems/zenith/onboarding/participants
|
|
```
|
|
|
|
## Formatted Output with jq
|
|
|
|
```bash
|
|
# Pretty print node status
|
|
curl -s http://localhost:26657/status | jq
|
|
|
|
# Extract specific fields
|
|
curl -s http://localhost:26657/status | jq '.result.sync_info'
|
|
|
|
# Get latest block height
|
|
curl -s http://localhost:26657/status | jq '.result.sync_info.latest_block_height'
|
|
|
|
# Format account balances
|
|
curl -s http://localhost:1317/cosmos/bank/v1beta1/balances/zenith1... | jq '.balances'
|
|
```
|
|
|
|
## Pagination Examples
|
|
|
|
```bash
|
|
# Get validators with pagination
|
|
curl "http://localhost:1317/cosmos/staking/v1beta1/validators?pagination.limit=10&pagination.offset=0"
|
|
|
|
# Get next page of validators
|
|
curl "http://localhost:1317/cosmos/staking/v1beta1/validators?pagination.limit=10&pagination.offset=10"
|
|
|
|
# Get all balances with pagination
|
|
curl "http://localhost:1317/cosmos/bank/v1beta1/balances/zenith1...?pagination.limit=100"
|
|
```
|