0

I am creating a dApp that is a game where players compete for the prize pool and that pool is built from the sum of all the entry fees payed by the player at the start of the game. The player that creates the game is responsible for choosing the entry fee.

I want to revert attempts to create a game where the entry fee is just too low reasonably to facilitate the game. For example, an entry fee so low that just the transaction costs of creating the game contract and then making the payouts to the players will end up with little to no funds left being available after those operations to actually give any amount of any reasonable value to the players.

I know there's no exact answer here, but if someone could give me a way to use the estimate gas functions or some other function, or even just a good "rule-of-thumb" heuristic, then I would at least have a base value I can use to reject entry fees that are just too low to be usable. As you can see, a straight greater-than-zero check doesn't help me here.

0

The gas cost of creating the contract will be 53000 gas. All other transactions will be paid by the players (unless the creator calls the contract). This gas will have to be multiplied by the gas price, which, for a "fast" transaction (according to https://www.ethgasstation.info/), will be 5 gwei.

5 gwei * 53000 = 265000 gwei

265000 gwei = 0.000265 ether

So the base cost of creating a contract with "fast" (<2m) speed will be 0.000265 ether. The cost for about 30 minutes would be 0.000053 ether. These might change, so I would recommend there be a way for you to change the minimum fee to adapt to the future.

If there is any more that the creator will have to do other than create the contract, or I missed something, please tell me so I can change my answer.




References:

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.