Skip to content

tari template publish

Builds and publishes a template with its metadata hash anchored on-chain.

Terminal window
tari template publish [PATH] [OPTIONS]
ArgumentDescription
[PATH]Path to the template crate directory (default: current directory)
OptionDescription
-a, --account <ADDRESS|NAME>Account for publishing fees
-c, --custom-network <NAME>Custom network name
-y, --yesAuto-confirm publishing
-f, --max-fee <AMOUNT>Maximum fee in microtari
--binary <PATH>Path to pre-compiled WASM binary
--api-key <API_KEY>Wallet daemon API key (bearer token). Also read from TARI_WALLET_DAEMON_API_KEY

Publishing authenticates with the wallet daemon using an API key sent as a bearer token. Provide it with --api-key or the TARI_WALLET_DAEMON_API_KEY environment variable. The key must be minted with at least the templates:read, templates:create, accounts:read and transactions:read permissions. The key is never read from or written to a config file.

Terminal window
# Build and publish with metadata from current directory
tari template publish
# Publish template at a specific path
tari template publish ./templates/my-token
# Auto-confirm
tari template publish -y
# Publish with a specific account
tari template publish -a my-account
  1. Builds the WASM template (cargo build --target wasm32-unknown-unknown --release)
  2. Finds the metadata CBOR file in the build output (target/.../build/<crate>/out/template_metadata.cbor)
  3. Computes the metadata hash using domain-separated SHA-256
  4. Submits both the WASM binary and metadata hash to the wallet daemon
  5. Waits for the transaction to finalize and returns the template address

If no metadata CBOR is found, the template is published without a metadata hash (with a warning).