Hello!
I have created RAW transaction like this
createrawtransaction [{"txid":"cb6b3604efd24...","vout":0}]
{"3GW....":1.0,"39dj9....":206.0}
Calculated change and added address for the change.
How to calculate tx fee and add feeto the transaction ?
Thanks
You can choose any fee you like.
Generally, I prefer to pay 0.0001 BTC per kilobyte (or remaining fraction of a kilobyte) at the moment (and I adjust this amount over time as the exchange rate changes).
So, to "calculate tx fee" you would figure out how many kilobytes the transaction will (remembering to add in the remaining fraction of a kilobyte) be and multiply by 0.0001 BTC. If my transaction is 2.21 kilobytes I pay a 0.0003 BTC fee.
As for how to "add" the fee...
The fee is the difference between the inputs and the outputs. Therefore, if you reduce the amount of your change output by 0.0001 BTC then the transaction will have a 0.0001 BTC fee.
Once you decide how much fee you want to pay, make sure that your change is at least that much (if it is not, then you'll need to include larger or additional inputs) and then reduce the change by the amount of fee you want the transaction to have.