Skip to content

Template Metadata

Tari Ootle supports off-chain template metadata with on-chain hash anchoring. This allows template consumers to verify authorship, discover templates by category, and audit provenance.

  1. Template authors declare metadata in their Cargo.toml
  2. A build.rs script encodes the metadata as CBOR and computes a SHA-256 multihash
  3. The metadata hash is submitted on-chain alongside the WASM binary during publishing
  4. Anyone can verify the off-chain metadata matches the on-chain hash

Metadata is sourced from two sections of Cargo.toml:

These come from the [package] section:

FieldSource
namepackage.name
versionpackage.version
descriptionpackage.description
licensepackage.license
repositorypackage.repository

These go under [package.metadata.tari-template]:

FieldTypeDescription
tagsstring[]Searchable tags
categorystringTemplate category
documentationstringDocumentation URL
homepagestringProject homepage URL

Arbitrary key-value pairs can be added under [package.metadata.tari-template.extra]:

[package.metadata.tari-template.extra]
audit = "https://example.com/audit-report"
Terminal window
tari template init ./my-template

Prompts for tags, category, documentation URL, and homepage.

Terminal window
tari template init ./my-template -y \
--tags token,fungible,defi \
--category token \
--documentation https://docs.example.com \
--homepage https://example.com

When you create a new template with tari create, metadata generation is automatically configured. Use --skip-metadata to opt out.

[package]
name = "fungible-token"
version = "1.2.0"
description = "A standard fungible token"
license = "BSD-3-Clause"
repository = "https://github.com/example/fungible-token"
[package.metadata.tari-template]
tags = ["token", "fungible", "defi"]
category = "token"
documentation = "https://docs.example.com/fungible-token"
homepage = "https://example.com"

After building, inspect the generated metadata:

Terminal window
# Human-readable table
tari template inspect
# JSON output (pipe-friendly)
tari template inspect --json

The metadata hash uses domain-separated SHA-256 encoded as a multihash (code 0x12, compatible with IPFS CIDv1):

SHA-256("com.tari.ootle.TemplateMetadata" || cbor_bytes)

This hash is anchored on-chain when you publish with tari template publish.