Query Stride's Redemption Rate
What is this?
Partners integrating with Stride sometimes need to query the rate at which Stride protocol redeems stATOM for ATOM (the “Redemption Rate”). The Stride blockchain exposes this rate via RPC and API endpoints. It can also be recomputed manually.
(Simple) Query the redemption rate directly
You can query the redemption rate directly through REST or the RPC (via the CLI).
- API/REST
- Show all the host zones, which contain redemption rate fields:
curl -basic https://stride-api.polkachu.com/Stride-Labs/stride/stakeibc/host_zone
- Look for the host_zone with your desired chain_id (e.g. for ATOM, look for cosmoshub-4), then choose the field “redemption_rate”.
- Show all the host zones, which contain redemption rate fields:
- CLI
- Show all the host zones, which contain redemption rate fields:
strided-local q stakeibc list-host-zone --node https://stride-rpc.polkachu.com:443
- Look for the host_zone with your desired chain_id (e.g. for ATOM, look for cosmoshub-4), then choose the field “redemption_rate”.
- Show a single redemption rate (example for cosmoshub-4):
strided q stakeibc show-host-zone cosmoshub-4 --node https://stride-rpc.polkachu.com:443 | grep redemption_rate: | tail -n 1
- Show all the host zones, which contain redemption rate fields:
If you’d like a reliable endpoint to query, we recommend Polkachu’s. We can provide our team endpoint too, if you’d like.
(Advanced) Recompute the redemption rate manually
You can also reconstruct the redemption rate from Stride’s internal record keeping. First, query the relevant internal record keeping, then apply the same formula Stride’s beginBlocker logic uses to update the redemption rate. This will yield a redemptionRate that’s slightly more updated, relative to that you could query using the previous approach.
- Step 1: Query Stride’s internal record keeping and calculate native token balance
- To obtain records for a particular host zone (e.g. cosmoshub-4), query with:
- API:
curl -basic https://stride-fleet.main.stridenet.co/api/Stride-Labs/stride/records/deposit_record
- RPC:
strided q records list-deposit-record --node https://stride-rpc.polkachu.com:443
- API:
- Compute the inputs to the redemption rate formula:
- Undelegated record balance:
- Sum the “amount” field across all records with the proper chain_id having status either DELEGATION_QUEUE or DELEGATION_IN_PROGRESS
- Module account balance
- Sum the “amount” field across all records with the proper chain_id having status either TRANSFER_QUEUE or TRANSFER_IN_PROGRESS
- Staked balance
- Parse the relevant host zone’s
stakedBal
field fromcurl -basic https://stride-api.polkachu.com/Stride-Labs/stride/stakeibc/host_zone
- Parse the relevant host zone’s
- Undelegated record balance:
- To obtain records for a particular host zone (e.g. cosmoshub-4), query with:
- Step 2: Calculate the st-token supply (e.g. statom): Parse the relevant denom (e.g. stATOM)
strided q bank total --node https://stride-rpc.polkachu.com:443
- Step 3: Apply the Redemption Rate formula
The formula is(undelegated record balance + module account balance + staked balance)/(st-token supply)
- You can inspect the Stride protocol’s logic for updating the redemption rate using this formula.
Updated 10 months ago