One can know the contract's native balance by using ink_env::balance()

But, How can one know the native balance of a particular address/account in ink? For example, knowing the native balance of Alice, Bob, Charlie e.t.c?

1 Answer 1


I'm not sure of any specific command in ink! to fetch the native balance, but it sounds like you want to build a chain extension that can return the user's balances from the runtime. You would add the chain extension in the runtime configuration, for example: https://github.com/paritytech/ink/blob/80d302eb9b9cddb726200a9a86c71ae344d1b042/examples/rand-extension/runtime/chain-extension-example.rs#L20

Then you can configure the chain extension in your contract and call the function.

  • 2
    Of course adding a chain extension is doable. However compared with mature smart contract language like Solidity, it's definitely reasonable to have native balance query. You can find the full list of the native API here: paritytech.github.io/ink/ink_env/#functions
    – h4x3rotab
    Commented Jun 8, 2022 at 3:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.