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.
How it works
Section titled “How it works”- Template authors declare metadata in their
Cargo.toml - A
build.rsscript encodes the metadata as CBOR and computes a SHA-256 multihash - The metadata hash is submitted on-chain alongside the WASM binary during publishing
- Anyone can verify the off-chain metadata matches the on-chain hash
Metadata fields
Section titled “Metadata fields”Metadata is sourced from two sections of Cargo.toml:
Standard package fields
Section titled “Standard package fields”These come from the [package] section:
| Field | Source |
|---|---|
name | package.name |
version | package.version |
description | package.description |
license | package.license |
repository | package.repository |
Template-specific fields
Section titled “Template-specific fields”These go under [package.metadata.tari-template]:
| Field | Type | Description |
|---|---|---|
tags | string[] | Searchable tags |
category | string | Template category |
documentation | string | Documentation URL |
homepage | string | Project homepage URL |
Extra fields
Section titled “Extra fields”Arbitrary key-value pairs can be added under [package.metadata.tari-template.extra]:
[package.metadata.tari-template.extra]audit = "https://example.com/audit-report"Setting up metadata
Section titled “Setting up metadata”Interactive
Section titled “Interactive”tari template init ./my-templatePrompts for tags, category, documentation URL, and homepage.
Non-interactive (scripting)
Section titled “Non-interactive (scripting)”tari template init ./my-template -y \ --tags token,fungible,defi \ --category token \ --documentation https://docs.example.com \ --homepage https://example.comAutomatic setup
Section titled “Automatic setup”When you create a new template with tari create, metadata generation is automatically configured. Use --skip-metadata to opt out.
Example Cargo.toml
Section titled “Example Cargo.toml”[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"Inspecting metadata
Section titled “Inspecting metadata”After building, inspect the generated metadata:
# Human-readable tabletari template inspect
# JSON output (pipe-friendly)tari template inspect --jsonHash verification
Section titled “Hash verification”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.