i am building service which will recieve exact amount of bitcoins and then devide it for two users and send it to them. For ex.
- Recieve: 10BTC
- To user A: 5BTC
- To user B: 5BTC
Obviously i can't send through "sendfrom" exactly 5BTC because it will spend something like 5.0005.
My first solution was to hardcode .0005 fee and send amount with substracted fee. But its far away from perfect and will not reflect fee algo future changes.
So whats best practice processing this kind of transactions in this moment?
Is there way to ask bitcoind what fee will be for exact transaction or tell bitcoind to substract fee from sending amount?