Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Account min balance field #2898

Closed
barnjamin opened this issue Sep 15, 2021 · 3 comments
Closed

Account min balance field #2898

barnjamin opened this issue Sep 15, 2021 · 3 comments
Labels
new-feature-request Feature request that needs triage Team Scytale

Comments

@barnjamin
Copy link
Contributor

Problem

It'd be nice to have the min balance required for an account to be computed during the API request to the algod/indexer

Solution

Prior to sending the Account payload back to the requestor, call MinBalance and add it to the payload

func (u AccountData) MinBalance(proto *config.ConsensusParams) (res MicroAlgos) {

@barnjamin barnjamin added the new-feature-request Feature request that needs triage label Sep 15, 2021
@algoanne
Copy link
Contributor

algoanne commented Nov 3, 2021

Motivation

Transactions submitted to the algod frequently fail because they would cause the min balance of an address to increase to more than the current balance of that address.
It would be preferable for an application to know that the min balance condition will cause the transaction to fail before submitting the transaction.

Currently, applications wanting to know an account's min balance have to calculate it themselves based on the known calculation for min balance and other information about the account. If the min balance calculation were ever to change, this would cause their implementations to break. And it's a duplication of logic.

An easy example is a wallet user who wants to know how many Algos she can actually spend from her account. If we make this information easy to access, her wallet can display her min balance to her at all times.

The min balance information can be added as part of the existing account information endpoints (the one for algod and the one for indexer) since these will usually already be called before submitting the transaction and this is the natural place to put it.

@algoanne
Copy link
Contributor

algoanne commented Nov 3, 2021

@barnjamin if we just add this to the algod API would that work? We're wondering if there's a good reason to have it on indexer as well (if people need it they can always go to algod for it)

@algoanne
Copy link
Contributor

algoanne commented Nov 3, 2021

This is a duplicate of #2419, closing this issue.

@algoanne algoanne closed this as completed Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-feature-request Feature request that needs triage Team Scytale
Projects
None yet
Development

No branches or pull requests

2 participants