Skip to content

Querying for Account Balance, Staked Balance, Staking Rewards #310

Answered by arjanz
cr0n-dist0rti0n asked this question in Q&A
Discussion options

You must be logged in to vote

To see the current stake, you can use the following storage functions:

controller_account = substrate.query(
    'Staking', 'Bonded', ['<STASH_ACCOUNT_ID>']
)

stake_info = substrate.query(
    'Staking', 'Ledger', [controller_account.value]
)

print(stake_info.value)

More info about Staking storage_functions: https://polkascan.github.io/py-substrate-metadata-docs/polkadot/#storage-functions_9

As for historical stake balance and rewards, that is a another combination of storage calls, you can check out https://github.com/stakelink/substrate-payctl which is a CLI to staking reward related actions

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by arjanz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants