1

I like to doing to submit every new transaction with user specific fee. I don't see any valid documentation for achieve it using RPC call. Give any suggestion.

Thankyou

  • Can you provide additional details as to what exactly you are trying to achieve? – Ugam Kamat Apr 2 at 18:32
  • Hi.. I try to setup a bitcoin web based wallet. I planning to setup a full node on cloud and do the wallet operation by using RPC call. I need to setup a user choosing fee for every withdrawal transaction. How to achieve it..?? – salman faris Apr 3 at 3:30
  • Fees = inputs - outputs. You can just adjust how much the user is allowed to spend in the outputs when they are consuming their UTXO. – Ugam Kamat Apr 3 at 6:57
  • Any way are available to calculate the exact fee before sending transaction...??? – salman faris Apr 3 at 7:01
1

Every transaction references input UTXOs (also called VOUTs) as VINs and outputs bitcoins to certain addresses. The input value, in bitcoins, is summed up. This sum is the maximum amount that can be allocated to outputs, but does not need to (and usually is not) what is completely allocated to outputs.

Usually, the sum of outputs is slightly less than the sum of inputs. In Bitcoin, the difference between these two is paid to the coinbase address of the block that the transaction is included in.

Most likely, your client uses the "change address" paradigm. From your HD wallet, a new key pair and address are derived. This new address serves as a change address. You specify how much bitcoins you want to spend to an output(s), the remaining amount is then calculated from the subtraction of all the specified output amounts. This remaining amount is then subtracted further, using a fee estimate. The final value is paid to that change address, which you control. The fee estimate then becomes what is paid to the miner. All of these operations are automated by your wallet client, so you normally don't need to fiddle with these change addresses. However, it can be customized.

Following this logic, all you need to do to customize your fee is to increase/decrease the number of bitcoins sent to your change address. The higher the number, the smaller the fee, and vice versa. After calculating all these parameters, you can then create a custom transaction, serialize it (createrawtransaction), sign it (signrawtransaction), and broadcast it.

  • Thanks for answering. Any documentation or any formula is available to calculate the fee...??? – salman faris Apr 4 at 3:34

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.