Hi,
I installed bitcoin core on ubuntu server and using JSON RPC on php. I am in the process of developing a gaming site. When a client requests a withdrawal it automatically process the transaction and the transaction fee is charged from my main balance. Is there any way to make the the transaction fees deducted from the withdrawn money by the user.
Example - If a client requests for a withdrawal of 0.1 btc, i want to deduct the fee and send the balance as withdrawal. How do i put it in php code? Please help me. I dont want to charge a fixed fee from the clients. I want to just deduct the fees that will incur for that withdrawal..
I don't know if this parameter is implemented in your bitcoin core version, but on
https://chainquery.com/bitcoin-api/sendtoaddressYou can see parameter 5: subtractfeefromamount (boolean), that is exactly what you want.
Just a general remark: it is usually more convenient for all users to know exactly what fees will be substracted.
As soon as you pass on the network fees directly to your customers, they will be encountering "random" fees, just depending on the network load. New users won't understand at all, why they received 0.1 BTC yesterday and 0.05 today.
Setting a fee that is generally a bit higher than the typical mining fees is the way of doing it predictably in the view of the users.
Thanks for your help. Can you please tell me how do i use that 5 parameter in php?
For example:
I use the below code for withdraw:
$wind = $bitcoin->sendtoaddress($address,$amount1);
$info = '<span class="msgOk">Paid to the address: <b>'.$address.'</b><br><br>Txid: <b>'.$wind.'</b><br></span>';
Please tell me how should i use it in php