queryLedgerState_projectedRewards - Cardano

This method projects the rewards a set of stake credentials or ada amounts would earn, using a non-myopic model across stake pools.

Parameters

ParameterTypeRequiredDescription
stakearrayNoAda amounts to project rewards for
keysarrayNoStake credentials to project rewards for

Request

bashcurl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "queryLedgerState/projectedRewards",
    "params": {
        "stake": [
            {
                "ada": {
                    "lovelace": 100000000000
                }
            }
        ]
    },
    "id": "getblock.io"
}'

example.js

javascriptconst response = await fetch(
    'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
    {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({"jsonrpc": "2.0", "method": "queryLedgerState/projectedRewards", "params": {"stake": [{"ada": {"lovelace": 100000000000}}]}, "id": "getblock.io"})
    }
);
console.log(await response.json());

example.py

pythonimport requests

response = requests.post(
    'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
    headers={'Content-Type': 'application/json'},
    json={"jsonrpc": "2.0", "method": "queryLedgerState/projectedRewards", "params": {"stake": [{"ada": {"lovelace": 100000000000}}]}, "id": "getblock.io"}
)

print(response.json())

Response

json{
    "jsonrpc": "2.0",
    "method": "queryLedgerState/projectedRewards",
    "result": {
        "stake1uxy2lpan99fcnhhyzr8w8qk4dqz4mp7g6b8h3r2v5c9d0e1f2g3h4": {
            "pool1abc...": {
                "ada": {
                    "lovelace": 512340
                }
            }
        }
    },
    "id": "getblock.io"
}

Response Parameters

FieldTypeDescription
resultobjectProjected rewards per credential per pool, in lovelace

Use Cases

  • Reward Estimation: Show expected rewards before delegating
  • Pool Comparison: Compare projected rewards across pools
  • Delegation Advice: Recommend a pool from projected returns
  • Planning: Model rewards for a hypothetical stake amount

Error Handling

Error CodeMessageDescription
-32602Invalid paramsA required field is missing or has the wrong type
-32000Query unavailableThe query is not available in the current ledger era
-32603Internal errorThe node failed to answer the query