[Ethereum] Cheapest Transaction Fee When Sending Tokens

contract-designcontract-developmentgasgas-pricesolidity

I have created a Smart Contract to return tokens to any address that sends me Ether, but I have noticed that the transaction fees range from 20 cents to a couple of dollars when tokens are sent from the contract address!
I would be happy with a transaction fee every time that is 0.0005 Ether. My questions are:

1.) What is the current minimum transaction fee that the system will accept for tokens? I dont need them transferred instantly, under 15 minutes would be good, but I do need the transactions to go through every time.

2). How can I set that max transaction fee, gwei price, and what values should I use? This is the current setup so far:

function () public payable {
    require(msg.value > 0);
    token.transfer(msg.sender, 1000000000000000000000); // send 1000 18 decimal tokens
}

Best Answer

1) The gas price is market based. So you can't determine an amount that will guarantee you that the transaction will go through every time. You wallet should give you some gas price proposal which is dynamically adjusted depending to gas price of previous transactions.

2) All the gas is paid by the external account calling the function, not by the smart contract. So you don't fix that at a solidity level by at the wallet level.

Related Topic