Bitcoin core RPC FEE

0


I want to use BitcoinCore for the RPC requests from the site. But I could not find anywhere else how to ask a commission for withdrawal.
In the instruction there is only:
sendtoaddress: bitcoinaddress amount comment comment-to - there is nowhere to cover the commision.
settxfee: amount - it is assigned to the entire account, not to a specific transaction.
How to implement the conclusion with a manual commission?

220VOLT

Posted 2018-09-11T13:45:44.310

Reputation: 3

Welcome @22VOLT, can you explain what you mean by commission, do you mean transaction fee to the miners?JBaczuk 2018-09-11T14:12:51.867

Answers

1

If you want to set the transaction fee manually, then you will need to use the *rawtransaction commands. Those commands give you full control over the inputs and outputs so you can set the fee accordingly (since the fee is the difference between the inputs and outputs).

You can create a raw transaction with no inputs and no change output using createrawtransaction. You do so like this:

bitcoin-cli createrawtransaction '[]' '[{"<address>":<amount}]'

where <address> is the address you want to send to and <amount> is the amount you want to send. You can then take the resulting raw transaction and use fundrawtransaction with it to get inputs and a change output if necessary. fundrawtransaction allows you to set the fee rate. So if you wanted a transaction with a fee rate of 0.0001 BTC/kB (10 satoshis per byte):

bitcoin-cli fundrawtransaction <raw tx> '{"feeRate":0.0001}'

The funded transaction is the one in the hex field of the output of that command. You sign this with signrawtransaction and then broadcast it with sendrawtransaction.

Andrew Chow

Posted 2018-09-11T13:45:44.310

Reputation: 40 910