On-chain front-running refers to searchers or miners inserting their own transactions ahead of others by increasing gas
or using other methods to capture value. In blockchain, miners can profit by packaging, excluding, or reordering transactions in the blocks they generate, and MEV
is the measure of this profit.
- Demo contract
- Front-running script
To get started with this boilerplate, you just need to follow these simple steps:
-
Start the Foundry local test chain:
anvil --chain-id 12345 -b 20
-
Connect to Foundry provider:
-
Deploy demo contract with first account
-
Run locally by last account private key
node scripts/frontrunning/frontrunning.js
-
Mint by first account
Then you will find that the currently mined NFT belongs to last account
By MIT licensed.