Deno & Fetch

Using Deno (or Node) & fetch to create a transaction with CIP-20 metadata

Introduction

This example demonstrates how to create a transaction with CIP-20 metadata using the Anvil API. CIP-20 provides a standardized way to include human-readable messages in Cardano transactions using metadata label 674.

For more information about transactions, please refer to the Transaction Overview.

Objectives

This example creates a transaction with a CIP-20 compliant message on the Preprod network.

Requirements

  • A Cardano wallet with ADA

  • A valid API key

  • Deno or Node.js environment

API Request Structure

Payload Format

{
  "changeAddress": "addr_sender...",
  "message": "Your message" // String or array of strings
}

Message Format Options

Single String Message

Array of Strings

Auto-split for Long Messages

For messages exceeding 64 bytes, the API automatically splits them:

Will be formatted as:

Implementation

Configuration and Parameters (using Deno and Fetch)

Using a preprod wallet for the transaction

Request Body

Body Structure for creating a transaction with CIP-20 metadata

API Call (using Deno and Fetch)

Basic POST call with Fetch

Deno Command

Expected Output

The Whole File (Deno Version)

cip-20.ts

Last updated

Was this helpful?