> For the complete documentation index, see [llms.txt](https://davidjosearaujo.gitbook.io/online-courses/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://davidjosearaujo.gitbook.io/online-courses/blockchain-security/blockchain-in-action/attacking-block-creation/frontrunning.md).

# Frontrunning

**Transactions are not instantaneously added to the blockchain**. First, they are **publicly transmitted to the nodes in the network** and **added to a pool of pending transactions**. Later, they are added to a block and official become part of the distributed ledger

**Priority** is often given to transactions with a **higher fee**

This enables frontrunning attacks. **After observing a transaction, an attacker can create one with a higher fee.** This malicious transaction will likely be processed first

Frontrunning attacks can be used for a variety of purposes, like making a profit or winning a contest
