Skip to main content
Registration uploads the WASM component you built in Step 2 and gives it a tenant-local name. After this step, T3N knows about your contract and gives you a numeric contract_id, which you then use to create the vault map the contract reads and writes. This code goes back in quickstart.ts — the Node/TypeScript project from Quickstart — not in the agent-vault-starter Rust repo. Append it to the bottom using the cat >> quickstart.ts << 'EOF' pattern from Running the code samples in this guide. Before you run this code, make sure you have:
  • An authenticated TenantClient named tenant. If you have not created one yet, complete Quickstart and Set Up Dev Env first.
  • A compiled WASM file at target/wasm32-wasip2/release/agent_vault_starter.wasm, inside the separate agent-vault-starter folder you cloned in Write your TEE contract — not inside your Node project.
  • Your tenantDid, for example did:t3n:abcdef0123456789abcdef0123456789abcdef01.

Choose a contract tail

The tail is the local name of your contract inside your tenant namespace. Pass only the part after z:<tid>:. This walkthrough uses the tail vault, which becomes:
Do not include z:<tid>: in the tail; the SDK and host derive that from the authenticated tenant. A tail may contain letters, digits, _, -, and . — but not /. The SDK rejects slashes (tail must match /^[a-zA-Z0-9_-][a-zA-Z0-9_.-]{0,127}$/). Pick a stable tail for each contract you plan to maintain. When you register a new build at the same tail, increase the version value; changing the tail creates a separate contract entry.
Keep tails short and simple (a few words, hyphen-separated) rather than long or descriptive. The full canonical name (z:<tid>:<tail>) gets reused downstream in places like delegation grants, and a handful of teams have hit unexpectedly-strict length limits further down the pipeline when using long tails. The 128-character limit above is enforced at registration; treat it as a ceiling, not a target.
A contract and a map are named separately, so the contract z:<tid>:vault and the map z:<tid>:vault it stores records in don’t collide.

Register the WASM

WASM_PATH above assumes you cloned agent-vault-starter as a sibling folder next to your Node project (i.e. ../agent-vault-starter/... from quickstart.ts) — if you put it somewhere else, update the path accordingly. The --register flag keeps later runs of quickstart.ts from registering again, and running --register a second time is harmless: an already-registered version is skipped. Keep the contract_id it prints. T3N returns it only from register, and there’s no call to look it up later.
Registration does not run your code, create maps, or grant anyone access. It only stores the component and records the versioned contract entry for your tenant — which is why the map is created as a separate call straight after.

Create the vault map

The contract reads and writes z:<tid>:vault, and that map must exist before the first store. The call above creates it private, readable and writable only by your contract’s contractId:
  • readers must be set explicitly — leave it off and the contract’s own reads fail with AccessDenied.
  • If the map already exists (you registered before, then raised CONTRACT_VERSION), the code updates its readers and writers to the new contractId instead of failing on map already exists.
  • There are no secrets to seed: this contract makes no outbound calls.
See Create Tenant KV maps for visibility options and the owner’s control-plane access.

What T3N stores

The register payload is just { tail, version, wasm }; there is no manifest. Host-side, T3N:
  1. Stores the WASM blob in content-addressed storage.
  2. Allocates a numeric ContractId.
  3. Records the contract under your tenant registry.
Your contract’s capabilities come from the host interfaces it imports in world.wit, not from this registration request. See Capabilities come from your WIT imports.
Re-registering a tail allocates a new contract_id. Unpinned calls resolve to the latest registered version (that’s what getContractVersion() returns); if you need a specific version, pass it explicitly to contracts.execute() and it will be honored. The real gotcha is the id: there is currently no API to fetch a tail’s current contract_id after re-registering, so the vault map’s ACL keeps pointing at the old contract_id unless you move it. The --register code above does that for you when you raise CONTRACT_VERSION; if you register some other way, update the map’s readers and writers with tenant.maps.update. Either way, keep a record of each contract_id your tenant registers.

First-run troubleshooting

The contract is registered and its map exists. Next, store a record, grant your agent and let it check.