# Data Format

The **OP data** is constructed in **JSON** format and MUST comply with the following rules:

* All keys and values MUST be **strings** and MUST contain **ASCII printable** characters only.
* All numeric values MUST be expressed in **decimal** and denominated in the **smallest unit**.
* If duplicate keys occur, the **last key-value pair** prevails.
* Unknown fields outside the protocol scope will be **filtered out**.
* For certain OPs, byte-level consistency MUST be enforced and duplicate keys and unknown fields are not permitted (e.g., send).

For example, a typical transfer OP data:

```json
{"p":"krc-20","op":"transfer","tick":"KKKKK","amt":"100000000","to":"kaspa:..."}
```

### Use P2SH Redeem Script

OP data can be embedded into a Layer-1 transaction via a Commit–Reveal scheme using a P2SH redeem script. This approach involves two transactions:

* **Commit transaction:** Creates an output (UTXO) locked to a P2SH address, committing to a redeem script that will be revealed later. The redeem script contains the defined OP data and serves as the “envelope” carrier.
* **Reveal transaction:** Spends the UTXO produced by the Commit transaction, thereby revealing the redeem script contents on Layer-1. KRC-20 nodes parse OP data based on the Reveal transaction, extracting it from the “envelope”.

<figure><img src="/files/KEkLurSdKaSnAX1wz3LB" alt=""><figcaption></figcaption></figure>

### Use Transaction Payload

With Kaspa now supporting transaction payloads, KRC-20 also supports embedding OP data directly via the payload field. This method requires only a **single transaction** and writes the OP JSON body directly (without constructing an “envelope”), making it simpler and more efficient. However, for specific OPs that bind KRC-20 tokens to UTXOs (e.g., send), the P2SH Commit–Reveal scheme is still used.


---

# 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-kasplex.gitbook.io/krc20/technical-overview/data-format.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.
