Skip to content

Commit a792e82

Browse files
authored
Merge pull request #4576 from dwardu/main
docs: Mining multiple transactions in 1 block on Hardhat Network (#4138)
2 parents df59765 + 909224f commit a792e82

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/src/content/hardhat-network/docs/explanation/mining-modes.md

+12
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@ const pendingBlock = await network.provider.send("eth_getBlockByNumber", [
2727
]);
2828
```
2929

30+
### Mining multiple transactions in one block
31+
32+
Note that for the special case of the Hardhat Network, the transaction `gas`-limit config [defaults to the fixed `blockGasLimit`](../reference/index.md#gas), not to [`auto`](/hardhat-runner/docs/config) (gas-estimation). This [speeds things up](https://github.com/NomicFoundation/hardhat/issues/4090#issuecomment-1622155314), but consequently limits the transactions per block to a maximum of 1. So to mine multiple transactions in a single block on the Hardhat Network, in addition to disabling automine, either specify the transaction `gasLimit` explicitly for each of the transactions, or force automatic gas-estimation in your config with:
33+
34+
```
35+
networks: {
36+
hardhat: {
37+
gas: "auto",
38+
},
39+
},
40+
```
41+
3042
### Mining transactions in FIFO order
3143

3244
The way Hardhat Network's mempool orders transactions is customizable. By default, they are prioritized following Geth's rules, but you can enable a FIFO behavior instead, which ensures that transactions are added to blocks in the same order they are sent, and which is useful to recreate blocks from other networks.

0 commit comments

Comments
 (0)