currently in ripple when i need to check how much is the minimum required to keep account valid there is a property called reserve base XRP is there something similar in stellar? because to write hard coded 1 XML is not what i am looking for. so i guess there must be a way to figure what is the minimum that requires to keep an account valid.
If you query the /accounts/{account_id}
endpoint, the subentry_count
will tell you how many sub entries the account has.
The reserve is basereserve * (2 + subentry_count)
-
i am still do not know how to get the "basereserve" for this equation - this as my main question. what is the way to get it? – Tzion buchris Jan 2 '19 at 10:05
-
-
the basereserve is included in the ledger headers. Using the JS SDK,
const ledger = await server.ledgers().order('desc').limit(1).call();
, then get eitherbase_reserve
orbase_reserve_in_stroops
– Johan Stén Jan 2 '19 at 10:53 -
so, it does not always return same response? i mean 1 ledger can give base_reserve_in_stroops and the other base_reserve? and 100000000 in stroops is 1 xlm? btw, Synesso - i only now saw the link at the bottom of the page reffers to the param. – Tzion buchris Jan 2 '19 at 14:11
-
The property name depends on the protocol version. I don't remember when it changed. I check for both of them. – Johan Stén Jan 2 '19 at 15:27
The minimum account balance is a function of the number of entries on the account.
Every account needs 2 x base reserve. Then an additional 1 base reserve for every entry. Entries include:
- Trustlines
- Offers
- Signers; and
- Data Entries
See minimum account balance in the documentation.