Algo SDK : Get Min Balance of Account

Hello,

I am searching a way to get in the SDK the minimum Balance an account need to hold (means with the ASA and the Application it hold)

I have found that : Asset Information — PyTeal documentation but it not seems possible to access this function in the SDK.

So maybe I can recreate this kind of function?
I know I need 0.1 per ASA hold + 0.1 by default, but the issue come from application.
I try (refer to that : Smart contract details - Algorand Developer Portal) to use the formula

(25,000+3,500)*schema.NumUint + (25,000+25,000)*schema.NumByteSlic

where schema.NumUint and schema.NumByteSlic are directly taken from
account_info[“apps-total-schema”][“num-byte-slice”]
account_info[“apps-total-schema”][“num-uint”]

but this is also less than the real value.

What I am missing here ?
btw if such kind of function already been develop, I take it also

1 Like

Hi Spaceis,

This was a common request so it was added to the REST api, you can see the min-balance listed here:

Ben

1 Like

Hello
Thanks for your answer
However, I am not sure to understands.
I have just try using algoexplorer v2 API and a random account :
https://api.algoexplorer.io/v2/accounts/ZW3ISEHZUHPO7OZGMKLKIIMKVICOUDRCERI454I3DB2BH52HGLSO67W754

and I am not able to see this min-balance parameter.
Am I on the wrong API for that ?

Try again, the change was pushed to mainnet last week :slight_smile:

interesting feature, from this address

https://api.algoexplorer.io/v2/accounts/ZW3ISEHZUHPO7OZGMKLKIIMKVICOUDRCERI454I3DB2BH52HGLSO67W754

I get the minimum balance, but shouldn’t api.algoexplorer.io be deprecated? So if I use this address

https://algoindexer.algoexplorerapi.io/v2/accounts/ZW3ISEHZUHPO7OZGMKLKIIMKVICOUDRCERI454I3DB2BH52HGLSO67W754

the minimum balance is not here

And is there a way to get it with Python SDK and Purestake?

1 Like

Alternatively, the min-balance can be obtained from the API that powers up AlgoExplorer:

$ curl -s 'https://indexer.algoexplorerapi.io/v2/accounts/ZW3ISEHZUHPO7OZGMKLKIIMKVICOUDRCERI454I3DB2BH52HGLSO67W754' | jq '.["account"]["min-balance"]'
400000

This API doesn’t have documentation yet, but is mostly compatible with the Algorand Indexer.

Hi @mmorselli

Algorand Indexer does not return the minimum balance. Also the node endpoint you are hitting is deprecated in our services because the node does not scale like indexers for Saas.

Now I’m a bit confused

both these addresses report the minimum balance

https://indexer.algoexplorerapi.io/v2/accounts/ZW3ISEHZUHPO7OZGMKLKIIMKVICOUDRCERI454I3DB2BH52HGLSO67W754

https://api.algoexplorer.io/v2/accounts/ZW3ISEHZUHPO7OZGMKLKIIMKVICOUDRCERI454I3DB2BH52HGLSO67W754

but not

https://algoindexer.algoexplorerapi.io/v2/accounts/ZW3ISEHZUHPO7OZGMKLKIIMKVICOUDRCERI454I3DB2BH52HGLSO67W754

what is the difference between indexer.algoexplorerapi.io and algoindexer.algoexplorerapi.io?

Do we have a reliable API to get the minimum balance?

what is the difference between indexer.algoexplorerapi.io and algoindexer.algoexplorerapi.io?

Do we have a reliable API to get the minimum balance?

Yes, you can use http://indexer.algoexplorerapi.io for that purpose.

1 Like