How many transactions can be executed in one smart contract?
I'm curious about the theoretical explanation.
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.
Sign up to join this communityHow many transactions can be executed in one smart contract?
I'm curious about the theoretical explanation.
Three scenarios (assuming no gas has been consumed yet in the block):
If a single transaction costs more than the block gas limit, the transaction cannot be executed (because the cost of this single transaction exceeds the block gas limit)
If a single transaction costs the same as the block gas limit, only one transaction can be executed (theoretically) in one smart contract (because the cost of this single transaction equals the block gas limit).
If a single transaction costs less than the block gas limit, the number of transactions can be executed is (block gas limit)/(cost of the transaction), with the number rounded down, in one smart contract.
I take that to mean how many can be executed with a single initial contract call, to which I would say one. Can have multiple function calls from within the one transaction.
If you want to chain multiple transactions you have to use something like flashbots.
If you want some theoretical block gas limit / gas to call a contract. As if an entire block was saturated with only calls to that contract, then you need the gas cost for the function or functions being called.
How many transactions can be executed in one smart contract?
That question doesn't really make sense, it's a bit like asking "how many times a program can be run", well... depends how much time you give it, lmao.
Now if you're asking how many transactions can be executed by a smart contract in a single block, then the answer depends on the specific function you're executing and on the block gas limit of the chain you're on.