I want to send an ERC20 token (Ropsten network). So I execute a function 'transfer' on a contract. When The transaction is sent, I can get the gas used in the receipt. Few months ago this amount was 36879 (0xff82bbc36b89e9ba428863c639ceebd87115c1012cdbf94b881641579aba07fe), now it is 51879 (0xe0bc6f9faad1135f3dad652603864792b7b1f16d7148c550fe580772952c3130) and I got a 'out of gas' error message.
1) the transaction fees are (gasPrice * gas), right ? If I set gasPrice and gas, why, gas used (36879) is not enough anymore ?
2) If I set the value of gas, why must I need to provide gasLimit also ?
3) How can I know the exact transaction fees (gas used) before sending it ?