> For the complete documentation index, see [llms.txt](https://docs.radfi.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.radfi.co/technical-architecture/radfi-op_12.md).

# radFi OP\_12

radFi utilizes `OP_12` as a key component of its Automated Market Maker (AMM) system. Unlike its traditional usage as a simple numeric constant in Bitcoin Script, radFi repurposes `OP_12` to encode structured AMM data within dust value outputs. This allows RadFi to facilitate decentralized token AMM using Bitcoin-native transactions.

### How radFi Uses OP\_12

In radFi’s AMM design, a dust value output containing `OP_12` encodes details such as:

* **Transaction type** (provide liquidity, swap, withdraw liquidity)
* **Input and output asset amounts**
* **Token identifiers**
* **Trading fee information**
* **Price range for limit orders** (if applicable)

This approach enables fully on-chain AMM execution while remaining lightweight and efficient.

### OP\_12 Structure

Each radFi transaction contains at least 1 `OP_12` data output formatted as follows:

```bash
# RadFi AMM Script 
# Example: Swap Rune for BTC
OP_12 # RadFi Flag (Indicates a RadFi transaction)
OP_PUSHBYTES_23 # Mark the size of swap data
02818080b08a83b7f6d39801930a4564ac8636bf020000 # Swap data

```

### Innovating Bitcoin DeFi

radFi’s repurposing of `OP_12` for encoding demonstrates how Bitcoin Script can be extended to support DeFi applications on-chain natively, without smart contracts. By embedding structured data in dust UTXOs, radFi enables efficient AMM-based txs while maintaining the security and transparency of Bitcoin’s UTXO model.

For the complete radFi `OP_12`usage structure, refer to [**Bitcoin Data Availability**](/technical-architecture/bitcoin-data-availability.md)**.**
