# 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)**.**


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.radfi.co/technical-architecture/radfi-op_12.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
