Anchor Templates
Templates turn the free-form anchor label into a structured, consistent format. Each template defines a prefix and a set of fields that are encoded into a single on-chain label, so anchors of the same kind read and search the same way.
Why templates
Every anchor carries an optional label of up to 64 ASCII characters. Left free-form, labels drift: one paper is thesis final v2, the next is Thesis-FINAL. Templates record the same fields in the same order every time, which keeps a wallet's history tidy and makes structured labels easy to parse back into their parts on the verify and history pages.
Label format
A structured label is the template prefix followed by key:value pairs joined by |. The prefix ends with a dash and joins directly onto the first field:
paper-title:my-thesis|v:2|dept:biologyEmpty optional fields are skipped. Values have whitespace collapsed to dashes and the | and : delimiters removed so the label always parses back unambiguously. The combined label is capped at 64 characters; the anchor form shows a live preview and warns before anything would be truncated. The Generic template has no prefix and stores whatever you type, exactly like the original single label field.
Built-in templates
| Template | Prefix | Fields | Example label |
|---|---|---|---|
| Academic Paper | paper- | Title, Version, Department | paper-title:thesis-chapter-3|v:2|dept:biology |
| Legal Document | legal- | Title, Case Number, Jurisdiction | legal-title:services-agreement|case:2026-cv-1234|juris:ny |
| Code Release | release- | Repository, Version, Tag | release-repo:thesis-lock|v:1.4.0|tag:stable |
| Dataset | data- | Name, Version, Format | data-name:survey-results|v:3|fmt:csv |
| Certificate | cert- | Recipient, Issuer, Date | cert-to:jane-doe|by:state-university|date:2026-06 |
| Generic | none | Label | thesis-chapter-3-draft-v2 |
Using a template
- Browse the template library and choose
Use this template, or pick one directly on the anchor page. - Fill in the fields. The generated label updates live below the form.
- Anchor as usual. The structured label is what gets written on chain.
- On the verify and history pages, a structured label is shown with a template badge and its fields broken out as key-value pairs.
The library page also accepts a deep link: /anchor?template=paper opens the anchor form with that template pre-selected.
Custom templates
Templates are defined in web/lib/templates.ts as plain data. To add one, append an AnchorTemplate to the TEMPLATES array with a unique id, a single character icon, a labelPrefix ending in a dash, and a list of fields. Each field needs a short key used in the encoded label and a human name shown in the form:
{
id: "invoice",
name: "Invoice",
icon: "I",
description: "Billing documents. Records number, client, and amount.",
labelPrefix: "inv-",
category: "Finance",
fields: [
{ name: "Number", key: "no", placeholder: "2026-014", required: true, maxLength: 16 },
{ name: "Client", key: "client", placeholder: "acme", required: false, maxLength: 20 },
{ name: "Amount", key: "amt", placeholder: "1200-usd", required: false, maxLength: 16 },
],
}Keep the keys terse: every character counts against the 64 character on-chain budget. The selector, fields form, live preview, verify badge, and history filter all pick up the new template automatically.