# Create Transaction with Metadata (CIP-20)

## Overview

Sometimes you want to attach a message, comment, or memo to a Cardano transaction—whether it's a receipt reference, a note for future auditing, or just user-friendly text. **CIP-20** standardizes how these messages appear on-chain by using **label 674** in transaction metadata. With the Anvil API, you can easily attach messages to your transactions with minimal configuration.

The Anvil API lets you supply a simple message or array of messages. Under the hood, Anvil auto-formats them for CIP-20 compliance:

* **Single string** → `["Your message"]`
* **Array of strings** → `["Line 1", "Line 2"]`
* **Long string** → Automatically split across multiple array entries if it exceeds **64 bytes**

For more information on **transactions**, please refer to the [Transaction Overview](https://github.com/Cardano-Forge/anvil-api/blob/main/docs/guides/transaction/transaction/README.md).

## Key Features

* Simple message attachment to transactions
* Automatic CIP-20 compliance formatting
* Support for single strings or arrays of strings
* Automatic handling of messages exceeding 64 bytes

## Requirements

* A Cardano wallet with sufficient ADA
* Valid API key for authentication

## Full Examples

### Using Bash and cURL

{% content-ref url="/pages/w6SsgSQBjROumM1l6E4g" %}
[Bash & cURL](/guides/transaction/create-transaction-with-metadata-cip-20/bash-and-curl.md)
{% endcontent-ref %}

### Using TS/JS Fetch

{% content-ref url="/pages/Rf3mUgGbN5yjRYdr18LE" %}
[Deno & Fetch](/guides/transaction/create-transaction-with-metadata-cip-20/node-and-fetch.md)
{% endcontent-ref %}

***

## **Specifications**

### API Endpoint

```
POST /transactions/build
```

### Request Structure

```json
{
  "changeAddress": "<sender_address>",
  "message": "Your message" // String or array of strings
}
```

### CIP-20 Formatting

The Anvil API automatically formats your messages for CIP-20 compliance:

* **Single string** → `["Your message"]`
* **Array of strings** → `["Line 1", "Line 2"]`
* **Long string** → Automatically split across multiple array entries if it exceeds **64 bytes**

## Best Practices

* Keep messages concise and relevant
* Consider privacy implications of on-chain messages
* Test transactions on testnet before moving to mainnet
* Remember that all on-chain metadata is publicly visible
* Keep your API key secure and never expose it in client-side code


---

# 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://dev.ada-anvil.io/guides/transaction/create-transaction-with-metadata-cip-20.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.
