Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: IGCGamers on August 14, 2017, 09:25:04 PM



Title: Need help in configuring JSON RPC for Bitcoin Core - Please help
Post by: IGCGamers on August 14, 2017, 09:25:04 PM
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..


Title: Re: Need help in configuring JSON RPC for Bitcoin Core - Please help
Post by: Casy on August 15, 2017, 10:40:24 AM
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/sendtoaddress
You 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.


Title: Re: Need help in configuring JSON RPC for Bitcoin Core - Please help
Post by: IGCGamers on August 15, 2017, 11:44:30 PM
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/sendtoaddress
You 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


Title: Re: Need help in configuring JSON RPC for Bitcoin Core - Please help
Post by: IGCGamers on August 16, 2017, 11:54:03 PM
an y one please help me with the code


Title: Re: Need help in configuring JSON RPC for Bitcoin Core - Please help
Post by: MrCrank on August 17, 2017, 04:24:35 AM
an y one please help me with the code

You can read it om bitcoin wiki.
Php examples find with google.
no one tell you working code because is expensive info.

I can help you, cost 0.1BTC