How to subtract fee from amount include native currency and issue

+1 vote

asked Aug 4, 2018 by liutao0532dev
Is this a question about MultiChain?
How do that in multichain?

1 Answer

0 votes

In general, MultiChain calculates the required fee automatically when building a transaction using high-level APIs such as send or issue. If this does not answer your question, please clarify exactly what operation you are looking to do.

answered Aug 6, 2018 by MultiChain
If I had 100 native currency, I want transfer all the money to another address,  commission from the 100, what commands need to be invoked´╝îthx
There is no simple formula because the fee depends on the size of the transaction.

Your simplest choice here is to repeatedly use createrawsendfrom to test out the maximum amount that can actually be sent. You can try different amounts in this form:

createrawsendfrom <from-address> '{"<to-address>":<send-amount>}'

If the <send-amount> is not possible you'll get an error. Iteratively try this using a binary search to home in on exactly the most you can possibly send.