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?

  • Welcome @22VOLT, can you explain what you mean by commission, do you mean transaction fee to the miners? – JBaczuk Sep 11 '18 at 14:12

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.