contract_id that you use when creating map ACLs.
Before you run this code, make sure you have:
- An authenticated
TenantClientnamedtenant. If you have not created one yet, complete step 4 and 5 of set up the dev environment first. - A compiled WASM file at
target/wasm32-wasip2/release/your_contract.wasm. - Your
tenantDid, for exampledid:t3n:abcdef0123456789abcdef0123456789abcdef01.
Choose a contract tail
Thetail is the local name of your contract inside your tenant namespace. Pass only the part after z:<tid>:. For example, the tail travel/contracts becomes:
z:<tid>: in the tail; the SDK and host derive that from the authenticated tenant.
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.
Register the WASM
WASM_PATH to point at the .wasm file.
Registration does not run your code, create maps, seed secrets, or grant outbound HTTP access. It only stores the component and records the versioned contract entry for your tenant.
What T3N stores
The register payload is just{ tail, version, wasm }; there is no manifest.
Host-side, T3N:
- Stores the WASM blob in content-addressed storage.
- Allocates a numeric
ContractId. - Records the contract under your tenant registry.
world.wit, not from this registration request. See Capabilities come from your WIT imports.
Outbound hosts are also not declared here. They come from the calling user’s authorization grant at invoke time. See Outbound HTTP is authorized by the user, not the contract.
First-run troubleshooting
| Error or symptom | What it usually means | What to do |
|---|---|---|
ENOENT: no such file or directory | The WASM path is wrong, or the contract was not built yet. | Re-run Step 2 and confirm the path with ls -lh target/wasm32-wasip2/release/*.wasm. |
tenant not found | The session DID does not match an admitted tenant — you constructed or derived tenantDid instead of reading it from the session. | Read tenantDid from did.value after authenticating (see Step 5 in set up dev env), then rebuild TenantClient with it. Confirm with tenant.me(). |
version <x> is not higher than current version <y> | You already registered this tail with the same or a higher version. | Bump CONTRACT_VERSION, for example from 0.1.0 to 0.1.1. |
The contract registers, but later cannot read secrets | The map does not exist yet, or its ACL does not include this contractId. | Use the returned contractId when creating the secrets map ACLs. |