Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TIP-53: Tagged Data #156

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions tips/TIP-0053/tip-0053.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
tip: 53
title: Tagged Data Payload
description: Block payload for arbitrary data
author: Philipp Gackstatter (@PhilippGackstatter) <[email protected]>
discussions-to: https://github.com/iotaledger/tips/pull/156
status: Draft
type: Standards
layer: Core
created: 2023-11-02
replaces: 23
---

# Abstract
PhilippGackstatter marked this conversation as resolved.
Show resolved Hide resolved

This TIP is a slightly revised version of TIP-23 with updates to IOTA 2.0, like the the type prefix of the _Tagged Data_
PhilippGackstatter marked this conversation as resolved.
Show resolved Hide resolved
Payload type and its syntactic validation. The payload concept offers a very flexible way to combine and encapsulate
information in the IOTA protocol. This document proposes a basic payload type that allows the addition of arbitrary
data.

# Motivation

The most flexible way to extend an existing object is by the addition of arbitrary data. This payload provides a way to
do just that. An optional tag can be used to categorize the data.

# Specification

## Tagged Data

The following table describes the serialization of a _Tagged Data Payload_ following the notation from
[TIP-21](../TIP-0021/tip-0021.md):

<details>
<summary>Tagged Data</summary>
<blockquote>Data with an optional tag.</blockquote>
</details>
<table>
<tr>
<td>
<b>Name</b>
</td>
<td>
<b>Type</b>
</td>
<td>
<b>Description</b>
</td>
</tr>
<tr>
<td>Payload Type</td>
<td>uint8</td>
<td>Set to <strong>value 0</strong> to denote a <i>Tagged Data Payload</i>.</td>
</tr>
<tr>
<td>Tag</td>
<td>(uint8)ByteArray</td>
<td>The tag of the data.</td>
</tr>
<tr>
<td>Data</td>
<td>(uint32)ByteArray</td>
<td>Binary data.</td>
</tr>
</table>

It is important to note that `Tag` is not considered by the protocol, it just serves as a marker for second layer
applications.

## Syntactic Validation

- The length of the `Tag` must not be larger than `64`.
- The length of `Data` must not be larger than `8192`.
PhilippGackstatter marked this conversation as resolved.
Show resolved Hide resolved
- Given the type and length information, the _Tagged Data Payload_ must consume the entire byte array of the `Payload`
field of the encapsulating object.
PhilippGackstatter marked this conversation as resolved.
Show resolved Hide resolved

# Rationale

As the tag is not considered by the protocol, it could also be removed completely. However, Legacy IOTA and Chrysalis
supported sending of arbitrary data indexed with a tag. Thus, in order to simplify the migration of second layer
applications using these protocols, the optional `Tag` has been added which can be used in a similar manner.

# Copyright

Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).
Loading