Transaction-Ordering Dependence (TOD)
Given enough resources, someone can reorder the transactions in the mempool to arrive at the result they need. This is a big concern in a system with a high volume of public transactions. Protecting against this comes down to the specific contract, and there are multiple ways to do this.
In this recipe, you will learn more about TOD attacks and some common places where you can avoid them.
Getting ready
It's expected that you have a basic understanding of the Ethereum blockchain and solidity before stepping through this recipe.
The Remix IDE (https://remix.ethereum.org) can help you quickly test and deploy the contract. Also, you can use any Ethereum client (geth
, parity
, and so on) and the solc
compiler to run this contract.
How to do it...
- Transactions in the mempool are public and anyone can read the transaction data directly from it. This feature is there to help miners and bringtransparencyto the system.
- This also allows the sender to replace a specific...