🥷 Private Transactions
Overview of how private transactions work to secure your trades.
Private transactions offer a reliable mechanism to protect your trades from being exploited by malicious actors such as front-runners and sandwich attackers. By leveraging private transaction pools and specialized endpoints, we can ensure that your transaction details remain confidential until they are confirmed on the blockchain.
Benefits of Private Transactions
Increased Security: By keeping your transaction data private, you reduce the risk of MEV bots and other malicious entities from exploiting your trades.
Reduced Front-Running: Front-runners cannot see your transactions in the public mempool, which prevents them from placing orders ahead of yours to gain an unfair advantage.
Protection Against Sandwich Attacks: Private transactions make it difficult for attackers to manipulate the price by placing large buy and sell orders around your transaction.
Example: Private Transaction vs. Normal Transaction
Normal Transaction
In a normal transaction, the details are broadcasted to the public mempool, where they are visible to all network participants, including miners and malicious actors such as front-runners and sandwich attackers.
Broadcast: When you submit a trade, it is broadcasted to the public mempool.
Visibility: All network participants can see your transaction details, including the token being traded, the amount, and the gas price.
Risk: Front-runners can place orders ahead of yours, and sandwich attackers can manipulate the price by placing large buy and sell orders around your transaction.
Private Transaction
In a private transaction, the details are kept confidential and only revealed to miners who will include the transaction in the next block. This method prevents malicious actors from exploiting the transaction.
Broadcast: When you submit a trade, it is sent directly to a private transaction pool, such as Flashbots, instead of the public mempool.
Visibility: The transaction details are only visible to the miners who have access to the private pool.
Execution: Miners include the transaction in the next block without broadcasting it to the public mempool.
Protection: This process prevents front-runners and sandwich attackers from seeing and exploiting your transaction.
Step-by-Step Example
Normal Transaction
Submit Transaction: You decide to buy 10 ETH worth of a new token.
Broadcast to Mempool: Your transaction is broadcasted to the public mempool.
Visibility: Malicious actors see your transaction and place their own orders to front-run or sandwich your trade.
Execution: Your transaction is mined, but you end up paying a higher price due to front-running, or you get a worse execution due to sandwich attacks.
Private Transaction
Submit Transaction: You decide to buy 10 ETH worth of a new token.
Send to Private Pool: Your transaction is sent to a private transaction pool using Flashbots.
Visibility: Only the miners in the private pool see your transaction.
Execution: Your transaction is included in the next block without being exposed to the public mempool.
Protection: Your trade is executed at the expected price without interference from front-runners or sandwich attackers.