this post was submitted on 21 Nov 2023
1 points (100.0% liked)

Ethereum

5 readers
1 users here now

Resources

founded 1 year ago
MODERATORS
 

Hello, I'm curious if it's possible to design a simple smart contract in such a way that interacting with it will require a higher gas fee than usual? Any input is greatly appreciated.

top 4 comments
sorted by: hot top controversial new old
[–] atrizzle@alien.top 1 points 11 months ago

Yes, there are multiple ways that you could burn unnecessary arbitrary gas when calling functions on a smart contract.

To start, go to the Yellow Paper, see what some of the most expensive gas operations are, and do those things in your smart contract functions.

Why would you want to do this though?

[–] genesis_crazy_one@alien.top 1 points 11 months ago

As example you can try to recreate scam contract that mint chi token with approve transaction

[–] hexoctahedron13@alien.top 1 points 11 months ago

make a loop with unnecessary operations

[–] eggzecutor@alien.top 1 points 11 months ago

You use the gasleft() function and revert if it's not above some threshold you want