Skip to content

Commit

Permalink
Motivate key-value pairs in metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippGackstatter committed Dec 21, 2023
1 parent d2af320 commit c0c274a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tips/TIP-0038/tip-0038.md
Original file line number Diff line number Diff line change
Expand Up @@ -1049,6 +1049,23 @@ revert it. In conclusion, it is very difficult to backdate even with just accept
waiting for higher levels of finality. This attack relates to the fundamental fact that the best approximation of time
is the block's `Issuing Time` timestamp, which is is meant to be very difficult to falsify.

## Metadata Feature Map

In Stardust, the Metadata Feature was defined as an arbitrary byte array to allow applications to be built on top of the
data stored in the ledger. However, only one such feature was allowed in a given output making it practically impossible
for two independent applications to both store data in the same output. Moreover, it was hard to identify what
application has written data into the metadata, making it tough for applications, such as wallets, that read these
values, to interpret the data correctly. To address this, the feature was changed to a map of key-value pairs, where the
keys are human-readable identifiers and the keys are arbitrary byte values. This additional level of abstraction allows
multiple applications to write data into the same output, as long as they use different keys. The keys are limited to
printable ASCII characters (excluding space) such that it's easy for a human to read which keys are in a given feature
(for example in explorers or when looking at the JSON response from an API). In order for applications to avoid naming
collisions in the key, another registry TIP could be considered where applications can reserve their keys. Although not
enforced by the protocol, this would help avoid collisions and, as a side-effect, means that the data writers can define
their encoding, compression or other relevant information for the correct interpretation of the data. That allows
wallets and other data readers to detect content based on the keys, which is much more resilient than attempting to
inspect the raw bytes for magic bytes, encoding or compression markers.

# Copyright

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

0 comments on commit c0c274a

Please sign in to comment.