The deployment of transaction executions is bounded by the
block gas limit that changes dynamically. If a block fits only one transaction, then the gas limit per transaction is, in theory, the same as block gas limit. As of 2020, this limit is around 10 million. There is also a minimum base cost for each transaction of 21,000 gas.
From answer for this question How are transactions stored in a block? @Richard Horrocks:
However, miners can order transactions however they like, as long as the order equates to a set of valid state transitions.
[Q] Hence, transaction order is decided based on the miners, but how the transactions to be included into blocks are decided?
As I know miners select the most profitable transactions based on
gasPrice * gasLimit.
Does using a very high gas limit somehow get your transactions executed slower? @iamdefinitelyahuman:
The reasoning: miners seek to maximize their profit within each block. Calls to
eth_estimateGascan be computationally heavy, so miners typically do not determine the actual gas each tx will consume. Instead they calculate
gasPrice * gasLimitfor each given transaction and from that determine the most cost-effective set of transactions to mine.
=> For example, I submit a transaction with a very high
gasPrice which has 10,000,000
gasLimit. It is selected and added into a block. Since it consumes all the
gasLimit of a block no other transaction is included.
Afterwards, during execution, my transaction only consumed 21,000 of gas and remaining part is refunded back to me. There is still remaining 9,979,000 of gas to be consumed on the block. Can the miner dynamically add more transactions after selected transactions' executions are completed?
or all the transactions are decided statically and cannot be updated after their executions are completed. If it is the case, miners tend to prioritize a lot of smaller tx's over one large one and larger ones never be deployed.
=> Is there are common algorithm for miners to decide the transactions to be included into a block? Let's say, does all the combinations of pending transactions is generated in order to select the most profitable one using brute force or greedy algorithm? Since time is very important to solve the puzzle first, deciding the transactions to be included into block might consume additional time.