# Data Transactions

Certain token templates allow for data to be incorporated into transactions in varying ways. In order to maintain a universal format, the data format will always employ an array format. Each element within the array will be regarded as a single script chunk, and all data will be provided as plain text strings. Let us explore some examples of how we can leverage this feature in some of the token templates.

### STAS-20 data output

The STAS-20 token template permits an optional extra output in each transaction, which is always positioned as the last output even after the payment change output. All transactional functions in the STAS library contain the "data" argument. To incorporate this additional output, we can easily provide this value as an argument in the function, as shown below:

```javascript
const data = [
    "Some plain text string",
    "Some other plain text string"
]

const transferHex = await stasTransfer.signed(
    ownerPrivatekey, 
    stasUtxo, 
    destinationAddress, 
    paymentUtxo, 
    paymentPrivateKey,
    data
)
```

{% hint style="info" %}
the data array can contain&#x20;
{% endhint %}

In this instance, the stasTransfer function is being utilized. An additional parameter can be included in the function if an extra output is needed in the transaction. If no data output is necessary, this parameter can be disregarded. The array can contain numerous elements, but it's important to note that the data's maximum size must not surpass 63337 bytes.<br>

### STAS-789 data append

The STAS-789 template possesses a distinctive capability to append additional data to the token script when executing a transfer transaction. The data that previously resided in the script cannot be altered and is immutable. This is an optional feature and not necessary for token transfers. To include additional data, the stasTransfer function must be supplied with the data in array format.

```javascript
const data = [
    "Some plain text string",
    "Some other plain text string"
]

const transferHex = await stasTransfer.signed(
    ownerPrivatekey, 
    stasUtxo, 
    destinationAddress, 
    paymentUtxo, 
    paymentPrivateKey,
    data
)
```

Subsequently, the transaction output will contain the supplementary data in the script. Each element in the data array will be converted into data script chunks in ASM format. By including the data in chunks, we can introduce new OP CODES or other data that may be supported in applications that adhere to the data format.


---

# 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.stastoken.com/library/advanced-features/data-transactions.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.
