# The ZK13 token standard Date: 2026-08-30 Status: **specification, with a conforming reference implementation.** **Corrected 2026-09-08.** This line used to read *"No compliant token exists. Nothing here describes deployed code."* The first half stopped being true when `templates/zk13-token.ares` was written: it is a conforming implementation of everything below, and `tests/integration/template-zk13-token.integration.test.ts` holds 20 tests over it — including `exposes every view the standard requires`, the lifetime-issuance cap, the permanent close of minting, the refusal of a self-transfer, and the absence of `approve`/`transferFrom`. The second half is still true and is the residual: **no ZK13 token has been deployed on a live network**, because no realm has a published address (`docs/INSTALL.md` §6). A template that compiles, deploys and passes its tests on a local chain is not the same claim as a token holding value in public, and this page will not let the first stand in for the second. This is the protocol other projects build tokens on. It says what a token must expose, what it must refuse, where its state lives, and what identity its holders need. **It is now one of four.** The non-fungible, multi-token and vault standards were written on 2026-09-17 as siblings of this one, each with a conforming reference implementation that compiles, deploys and runs — [`ZK13_NFT_STANDARD.md`](ZK13_NFT_STANDARD.md), [`ZK13_MULTI_TOKEN_STANDARD.md`](ZK13_MULTI_TOKEN_STANDARD.md), [`ZK13_VAULT_STANDARD.md`](ZK13_VAULT_STANDARD.md). They do not repeat §2 (where state lives), §3 (identity) or §6 (what an issuer must not be able to do); they point here. §12 says which to use, and §10 lists the profiles of THIS standard that ship as templates. > **A naming collision, recorded rather than resolved.** `NAMING.md` already carries **ZK13** > for the proof system and **ZK13STR / strzk13** for the address format, both under the rule > that existing SourceLess names are never renamed. "ZK13 token" is a third use of the same > family name, and the owner's instruction is to build the token protocol under it. The three > are different things: a proof, an address format, and now an asset standard. This document > uses **ZK13 token** in full and never bare "ZK13", and a registry entry disambiguating the > three is owed to the naming owner. This agent may not edit `NAMING.md`. > > **Resolved: `docs/NAMING.md:110` now carries the disambiguation.** Re-checked 2026-09-07 by > the owner of the proof system: **this standard assumes no property the proof system lacks.** > It never references `ZK13Proof`, `prove`, `verify`, a commitment or a nullifier, and there is > no path by which a token's behaviour depends on `src/crypto/zk13.providers.ts`. Nor does it > depend on the address format being anything other than a hash — §7.3 already treats > `zk13str_` as a formatting question. The proof system is a reference implementation with a > prover-chosen statement and no anonymity set (`docs/book/CRYPTOGRAPHY.md` §7); **a token > conforming to this standard is unaffected by that**, and must not cite it as evidence of any > privacy or spend-once property, which §7.4 already forbids in the general case. --- ## 1. What a ZK13 token is, and is not A **ZK13 token** is a fungible asset implemented as an AresLang contract deployed on a SourceLess chain, holding its ledger in its own contract storage, and conforming to the interface and rules below. It is **not**: - one of the seven native ledgers (STR, CCOS, WSTR, ARSS, STR_USD, WNFT, ESTR); - an entry in `TokenType`, `ALL_TOKENS` or `TOKEN_DEFINITIONS`; - governed by the Althing or by any SourceLess steward domain; - subject to, or protected by, `LedgerManager.validate`; - able to be locked to back an STR.domain. Every item on that list is a consequence of §2, and each is stated because an issuer who assumes the opposite has assumed a protection that is not there. --- ## 2. Decision: a ZK13 token lives in contract storage, not in a ledger **The question.** Does a ZK13 token's balance state live in the storage of its own contract, committed through Sindri, or does each token get a `YggdrasilLedger` beside the seven native ones? **The decision: contract storage. A ZK13 token never becomes an eighth ledger.** Five reasons, in order of the weight each carries. ### 2.1 Contract storage is chain state now, so the old objection is gone This would have been the weak answer a week ago and is not any more. The difference is the whole basis of the decision and is worth stating precisely. Contract state used to live in a `Map` on `ContractExecutor` — process memory. The state root did not move when a contract executed; two nodes replaying the same chain could hold arbitrarily different contract storage and both return `validateChain() === accepted`; and a restart lost every contract. `SindriLedger` is that state now. Each contract's storage is a `GlasirTree` — the same sparse Merkle tree the token ledgers commit with — and each contract's leaf commits address, name, bytecode, ABI hash, compiler version, deployer, salt **and its storage root**. `stateRootHex()` folds into the chain state root. So a ZK13 balance in contract storage has the **same commitment structure and the same replay promise** as an STR balance in Yggdrasil. The choice is no longer between "committed" and "not committed" — both options are committed — and it therefore turns entirely on the four reasons below. ### 2.2 A native ledger cannot be created without a hard fork `TokenType` is a TypeScript enum. `ALL_TOKENS` is a compiled array. `TOKEN_DEFINITIONS` is a compiled record. `LedgerManager` constructs one `YggdrasilLedger` per entry, and `MultiLedgerSnapshot.ledgers` is keyed by those names. Adding a ledger therefore means editing `src/core/tokens.ts`, shipping it to all 1313 validators, and coordinating the cutover — because a node holding the new enum and a node holding the old one build different snapshot shapes and different roots, which is a fork whether or not anybody intended one. **A standard whose instantiation requires a hard fork is not a standard. It is a governance request, filed once per token.** The requirement this document answers is that other projects can tokenise on SourceLess without asking permission. A token that takes a coordinated network upgrade to exist fails that at the first attempt and fails it worse at the hundredth. ### 2.3 The seven ledgers carry authority a third party must not inherit — in both directions `TOKEN_DEFINITIONS` gives every ledger a `mintAuthority` and a `burnAuthority`: `governance`, `treasury`, `echo-vault`, `stable-str-pool`, `starw-vm-emission`, `domain-registry`, and `undecided` for eSTR, whose issuance rule has never been decided. `GOVERNANCE.md` gives every ledger a steward domain and a voting pool. Putting a business's token in that table has two possible shapes and both are wrong: - it hands SourceLess governance the mint authority over somebody else's asset; or - it introduces a ledger with no steward, in a table whose entire point is that every row has one. The other direction matters as much. `applyPostMining` mints on native ledgers against caps the chain enforces, and `TOKENOMICS.md` requires the Feeless Pool to reconcile `minted = lockedForLife + spentOnExecution + burned + available`. A third-party supply inside that arithmetic makes the network's own reconciliation depend on a number the network does not control. **The failure prevented: a business's minting bug becoming an unreconcilable discrepancy in SourceLess's own supply books.** ### 2.4 The properties a token actually needs are in Sindri, and a ledger does not have them | Property | Sindri | A native ledger | |---|---|---| | Atomic revert — nothing commits unless the whole call succeeds | yes, by construction | n/a: no code to revert | | Immutable logic | yes: bytecode is in the address preimage *and* in the account commitment, and there is no `setCode` anywhere in the ledger | n/a | | ABI-checked entry before the first opcode | yes | n/a | | Signed caller, per-caller nonce, bound to this chain's genesis hash | yes | the transaction layer does this separately | | Deterministic replay from a block-carried record | yes | yes | The first three have no ledger equivalent, because a ledger has no code — and a token is mostly rules about who may move what, which is to say, code. ### 2.5 Blast radius A defect in a ZK13 token is confined to one contract's storage. A defect in a native ledger is in `LedgerManager`, which every token shares — and `TOKENOMICS.md` §10 rests on ledger independence: *"a fault in one cannot corrupt another's balances."* That claim is credible while the ledger set is seven, audited and closed. It is not credible at seven plus however many tokens strangers deploy. ### 2.6 What the decision costs, stated plainly | A ZK13 token does not get | Consequence | |---|---| | the domain gate in `LedgerManager.validate` | §3 — the identity rules are different, and weaker on the receive side | | `lock` / `lockForLife` | it cannot back an STR.domain, and cannot use the Feeless Pool's lock-for-life exit | | ledger-enforced supply caps | the contract enforces its own cap, or has none | | `strblk tokens`, `formatToken`, the multi-ledger snapshot | accounting is the issuer's problem, and so is discovery: the browser wallet shows a token only when the holder names its contract (§7.2), because nothing indexes who holds what | | parallel ledger validation | contract records execute in one sequence, in block order | | a steward, a voting pool, or any governance recourse | there is nobody to appeal to; the code is the only authority, and it is immutable | **The one exception is a fork, not an escape hatch.** A business that genuinely needs its asset to be native can have that — on its own chain, where `TokenType` is its own code. See [`BUSINESS_FORKS.md`](BUSINESS_FORKS.md). --- ## 3. Decision: what STR.domain proof a holder needs ### 3.1 The chain's own rule, and why it is split `LedgerManager.validate` enforces two different bars for native transfers: - **spending requires a proved domain** — 1000 STR locked, a signed binding of domain, wallet, WNFT and lock; - **receiving requires nothing.** An address with no STR.domain at all may be paid and may hold. Only a **Hnitbjorg** account is refused (`src/core/hnitbjorg.ts`), and a deployed contract is admitted explicitly. This section previously said receiving required an *allocated* domain, on the code's own reasoning: *"a newcomer must be able to receive the 1000 STR before it can lock them, and requiring proof to receive would make the lock unfundable — nobody could ever join."* That reasoning did not stop where it was stopped — a newcomer still had to know what an STR.domain was before anyone could pay them — and the receive side is now open. The sybil cost did not move: it is charged at the moment value first *leaves* an account. See `docs/book/LEDGER_AND_STATE.md` §2.2.1. ### 3.2 What is enforced on the contract path today: the recipient, not the caller Stated first, because the decision below is a proposal against this baseline rather than a description of it. `SindriLedger.applyCall` authenticates the caller's **key**: the public key must derive to the claimed address, the nonce must be the one the ledger expects, and the signature must verify over that exact call bound to that chain's genesis hash. It does not consult `StrDomainRegistry`. `submitContractRecord` queues without checking. `produceBlock` applies without checking. So **a wallet with a valid keypair and no STR.domain at all can deploy and call contracts today**, and every call post-mines STR into the Feeless Pool at one minor STR per gas, up to a tenth of its declared gas limit. The identity gate that replaces transaction fees has a contract-shaped hole in it on the *caller* side. That is a finding, not a design, and it is reported to the owner of `src/core/contract-state.ts` rather than fixed here. **The receive side is enforced identically on both paths, and both paths moved together.** Nidavellir's value journal calls the same `reservedAccountRefusal` `LedgerManager.validate` calls, so a contract can pay exactly where a person can pay and nowhere else. This paragraph used to say the receive side was *closed* — refusing any recipient with no allocated domain — and quoted the argument for it: *"if a contract could pay an address with no allocated domain, then routing value through a two-line contract would be the way to put STR anywhere at all."* That argument depended on the ordinary transfer path refusing such a recipient, which it no longer does, so both sides were relaxed in one movement rather than one of them being left to guard nothing. **The finding above is unaffected: the caller's domain is what is unchecked on the contract path.** ### 3.3 The decision **Spending a ZK13 token requires a proved domain. Receiving requires nothing, and cannot.** **Spending — proved, enforced at the ledger.** *(Proposal: `SindriLedger` takes the domain registry and refuses a non-`view` call whose caller has no proved domain.)* Two reasons it must be the ledger and not the contract: - the contract cannot see the registry — there is no domain accessor in AresLang, and none in the `AresHost` surface as specified; - a rule enforced per contract is a rule each author can omit, and the one who omits it is the one whose token becomes the spam vector. Why *proved* and not *allocated*: the failure being prevented is that ZK13 tokens become the cheap route around the sybil cost. If a contract call needs only a keypair, an attacker mints a million identities for nothing, and every one of them can transact — on a chain that charges no fees and post-mines for every call. The 1000 STR lock is the *only* thing standing between the fee-free model and unbounded spam. A second transaction type that skips it is not a lighter version of the rule; it is the rule not existing. **Receiving — nothing enforced.** Three reasons, and the third is the one that decides it. 1. **The contract cannot check.** No registry accessor exists. 2. **The ledger cannot tell what a recipient is.** `transfer(to, amount)` and `proposeOwner(next)` are the same shape at the ABI: one `address`, then whatever follows. Gating every `address` argument would refuse a legitimate `proposeOwner` to a cold key that has not yet allocated, and would still miss a recipient passed as a `string`. 3. **Even with both solved, the answer would still not be "proved".** Requiring proof to receive recreates the bootstrap deadlock one level up: an employee paid in a business's token cannot be paid until they have locked 1000 STR, and the token is frequently how they would have earned the STR. The chain already faced this question for its own asset and answered it the same way. ### 3.4 Which failure this accepts, and why that one Not gating receipt means **a ZK13 token balance can sit at an address holding no domain at all** — weaker than native STR, where the recipient must at least be allocated. That is accepted deliberately, because the failure it enables is bounded and the failure the alternative enables is not. | | Accepted | Rejected | |---|---|---| | Rule | receipt ungated | receipt gated at proved | | Failure it enables | a balance exists at an address that is not a verified network user | a token cannot be distributed to anyone who has not already locked 1000 STR | | Why bounded / unbounded | **bounded**: nothing moves from that address, because spending requires a proved domain. The balance is inert until its holder joins properly. Holding is not acting, so it is not a sybil primitive. | **unbounded**: a business cannot pay a new employee, cannot airdrop, cannot onboard. That is not a security posture; it is the token being unusable, which means nobody uses the standard, which means the standard protects nothing. | **The rule that follows, and it is mandatory.** *A compliant token must not treat "holds a balance" as "is a verified user."* Airdrop eligibility, governance weight, revenue shares and any KYC-linked claim must be checked against the registry off-chain, or against an allowlist the token maintains itself. **A token that computes voting power from `balanceOf` is computing it over an unauthenticated set**, and that is the specific failure this rule prevents. ### 3.5 The optional tier: a domain-gated token A token **may** declare itself domain-gated by maintaining its own allowlist — an `allowed(address) -> bool` map its owner populates from the registry — and refusing transfers to addresses not on it. It must be a **public view**, so a holder can read the rule before buying. And the cost must be stated by the issuer, not discovered by the holder: **this is a permissioned token, and the owner can therefore refuse anyone, including refusing an existing holder's counterparty.** The power has to be visible in the ABI. A token that gains it later cannot — the code is immutable — which is the one respect in which immutability protects the holder here. ### 3.6 Proposal: the right long-term answer Add a host accessor to `AresHost`: ```ts isProvedDomain(address: string): boolean; domainOf(address: string): string; // "" when the address holds none ``` It belongs at L1 by the boundary rule in [`ARESLANG_STDLIB.md`](ARESLANG_STDLIB.md) §4: it is a host fact and no bytecode can derive it. It is feasible on the determinism grounds that matter here — identity is already chain state, and `produceBlock` settles allocations and registrations **before** contract records, in one order every node uses, so every replaying node reads the same answer at the same point. With it, a token can enforce its own receive rule, and this standard can require the **allocated** bar on receipt — matching the native rule exactly, closing the gap in §3.4, and keeping the bootstrap path open. Until then the standard requires only that a recipient address be non-empty, and states the gap rather than implying it is covered. --- ## 4. The interface ### 4.1 Views — every compliant token must expose all of these ``` view fn name() -> string view fn symbol() -> string view fn decimals() -> uint view fn totalSupply() -> uint view fn maxSupply() -> uint // 0 means uncapped. Bounds LIFETIME ISSUANCE — see 5.2 view fn lifetimeIssued() -> uint // only ever goes up. What maxSupply is actually checked against view fn balanceOf(account: address) -> uint view fn owner() -> address view fn minter() -> address // "" when minting is permanently closed view fn paused() -> bool // always present; a token with no pause returns false ``` `lifetimeIssued()` was added to this required set on 2026-09-08, with the §5.2 correction. It is required rather than optional because without it a wallet cannot compute remaining mintable at all: `maxSupply() - totalSupply()` is the obvious formula and it is wrong after any burn, and nothing else in this interface exposes the number the contract actually checks. `minter()` and `paused()` are required **even when the token does not use them**, and this is the rule that does the most work in the whole interface: a holder must be able to ask "who can mint this, and can it be frozen?" and get an answer from the ABI rather than from reading bytecode. A token that simply omits the function is indistinguishable, to a wallet, from a token whose answer is inconvenient. `SindriLedger.catalog(address)` returns the callable function catalog, so this is a question any client can ask of any deployed contract. ### 4.2 Mutating functions ``` fn transfer(to: address, amount: uint) -> bool fn burn(amount: uint) -> bool // the caller burns its own balance fn mint(to: address, amount: uint) -> bool // minter only; absent if never mintable fn proposeOwner(next: address) fn acceptOwnership() fn setPaused(next: bool) // absent if the token cannot pause fn setMinter(next: address) // owner only; REFUSES once minting is closed fn closeMinting() // owner only, one-way, permanent ``` `setMinter` and `closeMinting` were added to this list on 2026-09-08. Both are shipped by the reference implementation and neither was here — `setMinter` was in no part of this standard at all, which mattered because it is a real owner power: the owner may appoint **itself** minter at any time until minting is closed. §6.5's disclosure rule was satisfied only by the accident of it appearing in the ABI. A holder reading this section to learn what the owner can do would not have learned it. This list is the minimum interface. A token may add functions; it may not omit these. **There is no `approve` and no `transferFrom` in v1.** Not an omission — a decision. An allowance exists so that *another contract* can spend on a holder's behalf, and there are no cross-contract calls in AresLang. An allowance nothing can spend is a stored approval that does nothing except sit there waiting for a mechanism that does not exist yet, and every approval a holder ever granted becomes live on the day that mechanism ships. **The failure prevented: a chain-wide stock of forgotten unlimited approvals becoming spendable at once, at a moment nobody chose.** When cross-contract calls land, allowances are added under a zero-first rule and a new interface version, and the tokens deployed before it have none. ### 4.3 Events ``` event Transfer(from: address, to: address, amount: uint) event OwnerChanged(previous: address, next: address) event PausedChanged(paused: bool, by: address) event MinterChanged(previous: address, next: address) ``` **`Transfer` is the single record of every balance movement, and there is no second one.** - a mint emits `Transfer("", to, amount)`; - a burn emits `Transfer(from, "", amount)`; - a transfer emits `Transfer(from, to, amount)`. The reason is reconstruction: an indexer summing `Transfer` must arrive at exactly the balances in storage. A separate `Mint` event alongside a `Transfer` doubles the movement for anyone who sums both, and omitting `Transfer` on a mint leaves a balance an indexer cannot account for. One event, every movement, no exceptions. `""` in the `to` position therefore means *burned*, and §5.4 requires `transfer` to reject `to == ""` so that nothing else can ever produce it. **Events are deliberately not in the state root.** Sindri excludes them, because an event is "a log of how state was reached, not the state itself" and folding a running event hash would make the root depend on execution history rather than on position. Two consequences a token author must respect: an event is evidence, never state; and **no contract logic may depend on an event having been emitted**, because nothing can read one back. ### 4.4 Errors AresLang has no error type. `require` carries a message string, and that string is the entire error surface. A compliant token uses these exact strings, so a wallet can recognise and localise them without parsing prose: | String | Raised when | |---|---| | `insufficient balance` | the sender's balance is below `amount` | | `empty recipient` | `to == ""` | | `self transfer` | `to == caller` (§6.6) | | `not owner` | an owner-gated function is called by another address | | `not minter` | `mint` is called by another address | | `not the pending owner` | `acceptOwnership` is called by another address | | `paused` | a mutating function is called while paused | | `supply cap` | a mint would take `totalSupply` past `maxSupply` | | `mint closed` | `mint` is called when `minter()` is `""` | | `not allowed` | a domain-gated token rejects an address not on its allowlist | Message strings are also a gas item: `REQUIRE` costs 5 regardless of the message, and the string is an operand in the module, so it costs deployment size and not execution. --- ## 5. Compliance rules A token conforms when it obeys every rule in §5 and §6. There is no partial conformance and no optional rule that is not marked optional. ### 5.1 Decimals **13, unless the token declares otherwise and says why in its own documentation.** The seven native ledgers are all 13 (`TOKEN_DECIMALS`), and a wallet showing two assets at different precision is where a user sends 10^5 times what they meant to. A token using another value is not non-compliant; a token whose `decimals()` disagrees with the units its own functions take is. `decimals` is fixed at deployment and there is no function that changes it. A token that could redenominate itself could halve every holder's balance in one call. ### 5.2 Supply - `totalSupply` changes **only** through `mint` (`+amount`) and `burn` (`-amount`). `transfer` never changes it. - `maxSupply` is set at deployment and **immutable**. There is no function that raises it. The failure prevented is the oldest one in tokens: a "hard cap" raised the night before an unlock. - `maxSupply == 0` means uncapped, and must be declared as such rather than set to a very large number that looks like a cap. - `mint` refuses at the cap rather than truncating: `require(lifetimeIssued + amount <= maxSupply, "supply cap")`. Truncating a mint silently gives the minter less than they asked for and tells nobody. > **CORRECTED 2026-09-08, and the spec was the broken half.** This read > `require(totalSupply + amount <= maxSupply, ...)`, which caps CIRCULATING supply — and a cap > checked against a burnable number is defeated by mint, burn, mint. The reference template > caps LIFETIME issuance and was right; `template-zk13-token.integration.test.ts` demonstrates > the exploit the spec's version allows, issuing 4,000 against a cap of 1,000 with the chain > still valid. > > **`maxSupply()` therefore bounds lifetime issuance, not circulating supply**, and the two are > different promises: only the first is keepable. The holder-facing consequence of the old text > was concrete — a wallet written strictly to this standard computes remaining mintable as > `maxSupply() - totalSupply()`, and after any burn that number reports headroom the contract > will refuse with `"supply cap"`. `lifetimeIssued()` is required in §4.1 for exactly that > reason. **The invariant that cannot be checked on-chain, stated as such.** `totalSupply` must equal the sum of all balances. There is no way to verify that inside the contract: there is no iteration over a map, and there must not be (`ARESLANG_STDLIB.md` §5.8). It is maintained *by construction* — every function that moves a balance moves `totalSupply` by exactly 0, `+amount` or `-amount` — and it is verified *off-chain* by summing `Transfer` events, which §4.3 exists to make possible. An issuer who wants a stronger promise is asking for a native ledger, and §2 is the answer to that. ### 5.3 Mint - Only `minter()` may call it. - It may **only credit**. A mint that can also debit is a confiscation primitive (§6.1). - It must respect `maxSupply` and `paused`. - It must emit `Transfer("", to, amount)`. - **Minting can be closed permanently and cannot be reopened**: setting `minter` to `""` is one-way. A token that promises a fixed supply must be able to prove it by closing minting, and a promise that can be revoked is not a fixed supply. ### 5.4 Transfer - `require(to != "", "empty recipient")` — 8 gas. Until `validateArgs` checks address well-formedness (`ARESLANG_STDLIB.md` §5.6), `""` reaches the bytecode as a well-typed argument, and a token that does not check credits a slot no key can reach. The tokens are not burned — no supply counter moves — they are stranded, permanently, in an immutable contract. - `require(balanceOf(caller) >= amount, "insufficient balance")` before any write. - `require(to != caller, "self transfer")` — see §6.6, which is a real inflation bug and not a stylistic preference. - A zero-amount transfer is **permitted and must emit**. Refusing it breaks batch payers that send a list including zeros, and an indexer that assumes zero transfers cannot occur breaks on the first one it sees. - It must respect `paused`. ### 5.5 Burn - The caller burns **its own** balance and no other. With no allowance mechanism (§4.2) there is no authority by which anyone could burn someone else's, and a token that invents one has invented confiscation. - It must reduce `totalSupply` by exactly the amount burned. A burn that reduces a balance and not the supply permanently breaks the §5.2 invariant, and nothing on chain will ever notice. - It must emit `Transfer(from, "", amount)`. ### 5.6 The ledger mode this all depends on Every access rule in this standard is enforced by `require(caller == ...)`, and `caller` is only meaningful when `SindriLedger` runs in `signed` mode — where the caller presents a public key deriving to the claimed address and a signature over that exact call, at that exact nonce, bound to that chain's genesis hash. In `unauthenticated-local` mode the caller is a string the caller chose, and **every rule in this document is worth nothing**. That mode is a property of the ledger, not of the contract, and a contract cannot defend against being deployed onto one. `signed` is the default and a chain-facing executor must be constructed with the chain's own ledger; an issuer's deployment checklist must confirm it rather than assume it. --- ## 6. Design against theft: what a compliant token must not permit Each rule names the failure it prevents. A token permitting any of these is non-compliant, and — because contract code is immutable — a token that ships with one has shipped it forever. ### 6.1 No function that writes a balance to an arbitrary value No `setBalance`, no `adjust`, no `rebase` that is not a documented, holder-visible mechanism. **Prevents:** the administrative-convenience confiscation. It never looks like theft in the source; it looks like a support tool, right up until it is used. ### 6.2 No owner path that moves another holder's balance The owner may pause, may mint if it is the minter, may hand over ownership. It may **not** move a balance it does not hold. **Prevents:** the rug pull in its simplest form — one function, one key, every holder's balance. ### 6.3 No raisable cap and no reopenable mint §5.2 and §5.3. **Prevents:** the supply promise that was true when people bought and false when they sold. ### 6.4 No single-step ownership change `proposeOwner` then `acceptOwnership`, both required. **Prevents two distinct failures:** a handover to a mistyped address, which is permanent because there is no administrator anywhere in SourceLess who can reach into a contract's slots; and instant capture by a compromised key, where a two-step handover at least leaves a window in which the pending change is visible on chain. ### 6.5 No selective freeze unless it is declared A token may not freeze one holder's balance while others move freely, unless it is a declared domain-gated or permissioned token exposing `allowed(address) -> bool` as a public view (§3.5). **Prevents:** a token that behaves as a free asset until the moment a specific holder tries to sell. The rule is not "no permissioned tokens" — it is "no *undisclosed* permissioned tokens", and the disclosure has to be machine-readable because a holder reads a wallet, not a whitepaper. ### 6.6 No self-transfer that mints The classic implementation is `balance[from] = balance[from] - amount; balance[to] = balance[to] + amount;`. When `from == to` and the first value was read before the second is written, the second write **overwrites the debit** and the holder gains `amount` from nothing. **Prevents:** unbounded inflation by anyone, callable in a loop, with no special privilege at all. Two acceptable fixes, and the standard mandates the first: - `require(to != caller, "self transfer")` — 8 gas, unambiguous, and correct regardless of how the map primitives end up behaving; - read-modify-write ordering that is provably correct for `from == to`, which depends on map semantics that are still in flight and therefore cannot be relied on by a document written now. ### 6.7 No upgrade or proxy path There is no code-write path in Sindri — bytecode is in the address preimage and in the account commitment, and there is no `setCode`. A token must not simulate one by routing all logic through an owner-settable address, because it cannot: there are no cross-contract calls. This rule exists to stop the pattern arriving with them. **Prevents:** one key replacing the contract under its holders. Immutability is a property SourceLess has for free and other chains pay dearly to approximate; a token should not give it away. ### 6.8 No reliance on caller-supplied time or on events A contract must never take a timestamp as an argument — a caller-supplied time is a caller-supplied unlock date. And no logic may depend on an event having been emitted, because events are not state and cannot be read back (§4.3). **Prevents:** an unlock schedule the beneficiary sets, and a rule enforced by something no node checks. ### 6.9 No unbounded work No iteration over a holder set, no function whose gas grows with the number of holders. A contract that becomes uncallable at some size **can never be fixed**, because the code is immutable and the balances are inside it. **Prevents:** a token that works in testing and is permanently frozen at scale, with every holder's balance behind the frozen function. ### 6.10 No mint or burn that skips the event §4.3. **Prevents:** storage and the event log disagreeing, so that a supply audit and a wallet show two different tokens and no on-chain check ever notices. --- ## 7. Relationship to the seven native ledgers and to zk13str addresses ### 7.1 What a ZK13 token genuinely inherits These are real and are the reason to build on SourceLess rather than beside it: - **Fee-free use.** The holder pays nothing. The network post-mines STR into the Feeless Pool to cover execution, at one minor STR per gas, capped at a tenth of the declared gas limit. The token's own supply is untouched by this — the mint is STR, on the STR ledger. - **Commitment.** Every balance is in the chain state root through Sindri (§2.1). - **Atomicity.** A reverted call leaves the token exactly as it was; there is no partial state. - **Authenticated callers.** Signed, nonced, chain-bound (§5.6). - **Immutability.** §6.7. - **Deterministic replay.** A call is a record a block carries; every node re-executes it rather than trusting the producer's account of the result. ### 7.2 What it does not inherit §2.6, and one more that matters at the wallet: a ZK13 token has no place in `formatToken`, so a client that displays it must read `decimals()` from the contract. A client that assumes 13 because the native ledgers are 13 will misdisplay any token that is not. The browser wallet does exactly that. Its Assets tab shows a ZK13 token the holder adds by contract address, for that window only: it checks `contractCatalog` for the four views, then reads `name()`, `symbol()`, `decimals()` and `balanceOf(account)` through `simulateCall`, which commits nothing and signs nothing (`src/wallet/gna-zk13.ts`). Name and symbol are drawn as the contract's own claim, apart from the seven ledgers, because a contract may call itself `STR`. ### 7.3 Addresses A holder is a `zk13str_<40 hex>_<4 hex>` address. **A contract is also one** — `deriveContractAddress` formats into the same space deliberately, so the ledger needs no second address format. A ZK13 token can therefore record a balance at a contract address. Whether that balance can ever move is a different question, and the answer is currently **no**: - a contract cannot be `caller`, because `CALLER` is the external signer that authorised the call; - there are no cross-contract calls, so contract A cannot call token B on its own behalf. **So sending a ZK13 token to a contract address is, today, a permanent loss unless that contract is the token itself.** With `SELF` in the v2 container, a token *can* move a balance keyed at its own address — which is exactly what makes escrow, vesting and staking possible **inside the token contract** and only there. See [`CONTRACT_TEMPLATES.md`](CONTRACT_TEMPLATES.md). Two rules follow: - a compliant token must document whether sending to a contract address is recoverable, and the default answer is that it is not; - a token that intends to support custody must expose the custody functions itself, in its own contract, rather than expecting a separate contract to hold its balances. ### 7.4 What a ZK13 token must never claim - That it is backed by, redeemable for, or pegged to a native token, unless a named mechanism enforces it. STR_USD's peg is an invariant `reconcile()` checks against collateral held per asset and per network. A ZK13 token asserting a peg with no such mechanism is asserting a number nobody can verify. - That it confers governance rights over SourceLess. Chain-wide parameters are the Althing's, at a majority of 66,360 declared power, and no contract can touch them. A token's governance is over its own storage and nothing else. - That it is an STR.domain, or that holding it confers identity. Identity is the WNFT, is non-transferable, and is minted only by the domain registry. --- ## 8. What is not built Stated as a list so nothing above reads as a description of working code. | Not built | Where it is discussed | |---|---| | ~~Any compliant token~~ | **Built.** `templates/zk13-token.ares`, 20 tests. This row contradicted the status line at the top of this same document and is kept struck through rather than deleted, so the contradiction is on the record. | | ~~Maps~~ — **landed** while this was being written: `MLOAD` 55 / `MSTORE` 220, compiled and priced. The standard is implementable as written | §4, §5 | | ~~The domain gate on the contract call path~~ **BUILT** — `contractCallerGate` refuses any deploy or call whose actor is not proved, enforced on submit, produce and accept. This row understated the chain. Originally: the domain gate on the contract call path | §3.2, §3.3 — **proposal** | | `isProvedDomain` / `domainOf` on `AresHost` | §3.6 — **proposal** | | ~~Address well-formedness in `validateArgs`~~ **BUILT** — `isValidAddress`, checksum included, before the first opcode. Originally: address well-formedness in `validateArgs` | §5.4; specified in `ARESLANG_STDLIB.md` §5.6 — **proposal**, and the cheapest high-value change named in either document | | Allowances | §4.2 — deliberately out of v1, and out until cross-contract calls exist | | ~~A registry entry disambiguating the three uses of "ZK13"~~ — **landed.** `docs/NAMING.md:110` now carries it | header | | An integer-to-string builtin | Blocks nothing in THIS standard and a great deal in the sibling ones: a metadata URI cannot be derived as `base + id`, so every NFT stores its whole URI. [`ZK13_NFT_STANDARD.md`](ZK13_NFT_STANDARD.md) §7 | | A hashing opcode | Blocks a Merkle allowlist, a commit-reveal, and any check of the form "the issuer signed this". Named here because an issuer reading §3.5's allowlist will ask why it has to be stored address by address at 220 gas a write | | An aggregate argument type (array or list) | Blocks every batch operation, in this standard and its siblings. n movements are n call records: n signatures, n nonces, atomic individually and not together. [`ZK13_MULTI_TOKEN_STANDARD.md`](ZK13_MULTI_TOKEN_STANDARD.md) §7 | | ~~Sibling standards for non-fungible, multi-token and vault assets~~ — **written 2026-09-17**, with conforming reference implementations: [`ZK13_NFT_STANDARD.md`](ZK13_NFT_STANDARD.md), [`ZK13_MULTI_TOKEN_STANDARD.md`](ZK13_MULTI_TOKEN_STANDARD.md), [`ZK13_VAULT_STANDARD.md`](ZK13_VAULT_STANDARD.md) | §12 | --- ## 9. Interface discovery: `standard()` **Added 2026-09-17, numbered after §8 deliberately.** §8 is cited by section number from `CONTRACT_TEMPLATES.md` and from two of the sibling standards, so renumbering to put this in interface order would break references that are correct today. The seam is left visible rather than hidden. A token **SHOULD** expose: ``` view fn standard() -> string // "zk13-fungible/1", optionally with a profile suffix ``` It returns a family and version, optionally with a profile (§10): `"zk13-fungible/1"`, `"zk13-fungible/1+fixed-supply"`, `"zk13-fungible/1+allowlist"`. **RECOMMENDED and not required, for one reason that will not change:** tokens conforming to this standard were deployed before this section existed, and **a deployed contract cannot grow a function.** Bytecode is in the address preimage and there is no `setCode` anywhere in Sindri. A requirement would retroactively declare conforming tokens non-conforming, which is a statement about this document's history rather than about those tokens. `templates/zk13-token.ares` — the reference implementation — is one of them, and does not ship `standard()`. **It is a self-declaration and proves nothing.** Any contract can return any string, and no node checks it. What it buys is a first question a client can ask cheaply when two standards' required sets overlap, which they do. **The check is `SindriLedger.catalog(address)`** against §4.1 and §4.2: the catalogue is derived by the compiler from the source every node recompiles, so it cannot lie about which functions exist. There is no interface-query function to ask instead, and there cannot be a better one than the catalogue: answering that question by CALLING a contract is a cross-contract call, and nothing on this chain can call a contract from inside another. --- ## 10. Profiles of this standard A **profile** is this standard plus a declared restriction or a declared extra power. Every profile conforms to §4, §5 and §6 in full; each is shipped as a template whose header states what it gives up. | Profile | Template | What it adds or refuses | The trade, stated | |---|---|---|---| | reference | `templates/zk13-token.ares` | Nothing. Owner, pause, minter role, permanent close | The owner keeps powers a holder must read in the ABI | | `+fixed-supply` | `templates/fixed-supply-token.ares` | One `issue()` call mints the whole declared supply and closes issuance in the same call. **No owner, no pause, no minter role, and none of `setPaused`, `setMinter`, `proposeOwner` or `acceptOwnership` in the ABI.** `owner()` returns `""` | No emergency stop, ever. A stolen key cannot be frozen while it is sorted out. And if the deployer key is lost before `issue()`, the token is permanently unissuable | | `+allowlist` | `templates/allowlist-token.ares` | §3.5's optional tier, realised: an `isAllowed(address)` map written by a named compliance key, checked on **both** sides of every transfer and on every mint | **Removal is a selective freeze**, which §6.5 permits only when declared. It is declared in the ABI, in the header, and here. `burn` is deliberately NOT gated, so a frozen holder is not left with no action at all | | `+vault` | `templates/zk13-vault.ares` | A share-accounted pool over the token, in the same contract. See [`ZK13_VAULT_STANDARD.md`](ZK13_VAULT_STANDARD.md) | The vault cannot be separated from the asset, so the asset's issuer has to have wanted it from the start | | `+staking` | `templates/staking-token.ares` | Time-accrued rewards from a funded pool, in the same contract | Rewards are best-effort from a finite pool; a recorded debt is not a promise, and the template's header says so | | `+wrapped` | `templates/wrapped-token.ares` | A bridge-custodied 1:1 wrapper: the reference token plus `custodian()` (an alias for `minter()`, the mint authority), an editable `underlying()` label, and `unwrap(amount, ref)` — a `burn` that also emits `Unwrapped(from, amount, ref)` so a relayer sees the withdrawal destination on the underlying chain. See [`BRIDGE_INTEGRATION.md`](BRIDGE_INTEGRATION.md) §5 | The wrapped balance is a claim on the custodian's promise to have locked the underlying, no stronger than that custodian. The contract proves the supply was minted by the mint authority and proves nothing about what backs it; `ref` is opaque and unvalidated, because a contract cannot see the other chain | | `+vesting` | `templates/vesting-token.ares` | A per-beneficiary linear time-vesting schedule in the same contract: `grant` records an immutable schedule and `release` mints `vested − released` on the block clock. The cap is enforced against `committedEver` (minted + granted), which `lifetimeIssued()` returns | The grant spends cap room the moment it is made, not when it is released; and there is no revoke, cancel or accelerate, so a grant the mint authority regrets is a grant it is bound to | §3.5 previously described the allowlist tier as a **domain-gated** token. **It is not, and cannot be:** `AresHost` has no domain accessor, so a contract cannot ask whether an address holds a proved STR.domain. What `+allowlist` enforces is that an address appears in a map one named key writes — which is what a transfer-restricted security needs, and which verifies the ISSUER'S CLAIM about an address rather than anything about the address itself. §3.6's proposed host accessor is what would close the difference. --- ## 11. Conformance checklist A reviewer can walk this against `catalog(address)` and the source. - [ ] Every view in §4.1 is present, is `view` in the ABI, and answers while paused. - [ ] Every function in §4.2 is present, with these names and this argument order. - [ ] `decimals` is 13, or the token documents why not (§5.1). No function changes it. - [ ] `mint` checks the cap against `lifetimeIssued`, never against `totalSupply` (§5.2). - [ ] `maxSupply` is 0 for uncapped, and no function raises it. - [ ] `setMinter` refuses once `minter()` is `""`; `closeMinting` takes no argument. - [ ] `transfer` refuses `""` and `caller`; the debit is `uint - uint`, so the compiler emits the checked `SUBU`. - [ ] A zero-amount transfer is permitted and emits. - [ ] `burn` debits the caller's own balance only, and lowers `totalSupply` by exactly that. - [ ] Exactly one `Transfer` per movement, with `""` for a mint's `from` and a burn's `to`. - [ ] Every error string is from §4.4. - [ ] No `setBalance`, `adjust`, `forceTransfer`, per-account freeze, `approve` or `transferFrom`. - [ ] No loop whose trip count a caller controls, anywhere (§6.9). - [ ] Ownership handover is two-step (§6.4). - [ ] The header states the measured gas of every entry point and the gas limit to declare. - [ ] Any extra power the deployer keeps is declared in the ABI and in the header (§6.5). --- ## 12. The ZK13 asset standards family Four standards, one set of rules about identity, addresses, events, immutability and what an issuer may not do. Each document repeats none of the others; where a rule is shared it points here. | Standard | For | Reference implementation | |---|---|---| | **fungible** — this document | one divisible asset | `templates/zk13-token.ares` | | **[non-fungible](ZK13_NFT_STANDARD.md)** | distinct tokens with per-token metadata and O(1) holder enumeration | `templates/zk13-nft.ares`, `templates/soulbound-badge.ares` (soulbound profile) | | **[multi-token](ZK13_MULTI_TOKEN_STANDARD.md)** | a catalogue of many assets under one set of rules | `templates/zk13-multi-token.ares` | | **[vault](ZK13_VAULT_STANDARD.md)** | a pooled claim on an asset, share-accounted | `templates/zk13-vault.ares` | **Which to use.** One asset: fungible. Many one-of-ones with their own metadata: non-fungible. A catalogue where an issuer will keep adding assets and wants one owner, one pause and one minter: multi-token. A pool somebody deposits into and withdraws a proportion of: vault — and it must be in the asset's own contract, which is the standard's first and largest constraint. **All four share these facts about this chain, and none of them can be designed around:** state lives in contract storage committed through Sindri (§2); receipt is ungated and spending needs a proved STR.domain (§3); a balance or a token at a contract address can never move again, because a contract cannot be `caller`; there are no cross-contract calls, so there are no approvals, no hooks and no routers; and there is no upgrade path, because bytecode is in the address preimage. --- ## 13. Where this standard comes from, and where it diverges | Prior art | Taken | Left, and why | |---|---|---| | **The common fungible-token interface** | `name`, `symbol`, `decimals`, `totalSupply`, `balanceOf`, `transfer`, and one `Transfer` event as the single record of every movement | `approve`/`allowance`/`transferFrom` (§4.2: nothing could spend an allowance, and a stock of forgotten ones would all become live the day something could). `transfer` returning `bool` is KEPT, even though a revert is the only failure mode, because a wallet written against that interface reads the return | | **Token interfaces with operators and receive hooks** | Nothing | Operators and `tokensReceived` hooks: no callbacks exist here, and the hook is the part of those interfaces that surprised integrators | | **SPL Token (Solana)** | The separation of an asset's TERMS from a HOLDING — here the terms are state slots and a holding is a map entry, so a cap is stored once rather than per holder. Also the discipline that a mint authority can be set to none, permanently, which is §5.3's `closeMinting` | Token accounts, rent, and `closeAccount` — a holding here is a map entry nobody has to fund. The **freeze authority**: a per-account freeze is confiscation-adjacent and §6.5 refuses it unless the token declares itself restricted, which is the `+allowlist` profile | | **Fee-model variants of the common interface** | The lesson rather than the interface: such a variant keeps the interface and changes the fee model, and everything it changed is about who pays. Here that question is answered outside the contract, by post-mining and the 1000 STR domain lock, so nothing needed importing | The metered energy and bandwidth model | | **Sui object model** | The framing that ownership can be a property of a thing rather than a row in somebody's table. It fits the sibling NFT standard (`cap == 1` in the multi-token standard is the nearest thing here) and does not fit a fungible balance | Objects, dynamic fields, and transfer-by-moving-an-object. Storage here is a flat key/value set with no ordering of its own, which is exactly what lets Sindri commit it as leaves and reach the same root on every node | | **The tokenised-vault interface** | Out of scope here | [`ZK13_VAULT_STANDARD.md`](ZK13_VAULT_STANDARD.md) §10 records what was taken from it, and why the wrapper structure could not be | --- ## 14. Token options, and the token wizard **Added 2026-10-25, numbered after §13 for §9's reason:** sections are cited by number, so this one goes at the end rather than where it would sit in reading order. **Revised 2026-10-26**, when the wizard came to offer every option on the list below that this VM can build. Nothing in §1 to §13 moved: the options that leave the standard are generated as labelled extensions OUTSIDE it, and a token carrying one does not conform. §14.2 says what that means and how a holder is told. An issuer asks which options the token wizard offers. This is each of them, and what this chain does with it: checked against what AresLang and the STARW VM can do in this build and against §4 to §6 of this standard. The options and their verdicts are those of `contracts/token-options.ts`, the same list the explorer page shows, and `tests/integration/token-wizard.integration.test.ts` fails if a verdict here and a verdict there disagree. - **SUPPORTED** — the wizard generates it and the token conforms. - **EXTENSION, NOT CONFORMING** — the wizard generates it when asked for by name, and the token is then NOT a ZK13-conforming token. The sections it departs from are named, and §14.2 lists every place the token says so. - **UNBUILDABLE** — no bytecode on this VM can do it. The missing instruction or host call is named, and adding one is a hard fork. The form shows these as disabled controls with the reason. | Option | Here | Why | |---|---|---| | Name, symbol, decimals (`--name --symbol --decimals`) | **SUPPORTED** | Required views (§4.1). Decimals default to 13 like the native ledgers; any other value is recorded in the manifest because §5.1 asks the issuer to say why. Fixed at deployment; nothing redenominates. | | Initial supply to a chosen wallet (`--initial-supply --recipient`) | **SUPPORTED** | Not in the initializer: a deployment keeps no events from __init, and a mint without its Transfer breaks §6.10. The supply is reserved against the cap at deployment and issued once by issueInitial(), which anyone may call and which can only pay the fixed amount to the fixed recipient. | | Designated owner at deployment (`--owner`) | **SUPPORTED** | The owner is a literal in the source, so owner() is that wallet from block one and the deployer holds no power. AresLang has init(...) parameters, but a deploy record carries no initializer arguments, so the value has to be in the bytecode. | | Two-step ownership transfer | **SUPPORTED** | proposeOwner then acceptOwnership, required by §6.4. Every wizard token has it. | | Renounce ownership (`--renounceable`) | **EXTENSION, NOT CONFORMING** | Departs from §6.4. Generated as renounceOwnership(): the owner gives ownership up in one call, which is the single-step ownership change §6.4 forbids. Every owner power ends with it, including the power to close minting, so a minter that is still open stays open for ever. The conforming way to give up control is closeMinting() on a token generated without --pausable or --allowlist. | | Max supply cap, or uncapped (`--cap or --uncapped`) | **SUPPORTED** | maxSupply() bounds lifetime issuance and is immutable (§5.2); 0 means uncapped and is declared, never a large number posing as a cap. | | Mintable, with a minter role (`--mintable [--minter]`) | **SUPPORTED** | One mint authority (§5.3), changeable by the owner with setMinter and closable for ever with closeMinting. Without --mintable, minter() is "" from block one and the only issuance is the initial supply. | | Holder burn | **SUPPORTED** | Mandatory, not optional: burn(amount) is in the §4.2 minimum interface and burns only the caller's own balance (§5.5). A token without it does not conform. | | burnFrom by a spender (`--burn-from`) | **EXTENSION, NOT CONFORMING** | Departs from §5.5, §4.2. Generated in its allowance form only: a spender the holder approved burns up to that allowance, so it needs --allowances. §5.5 says the caller burns its own balance and no other. The form in which the owner burns a holder's balance with no allowance is not generated at all: that is confiscation (§6.2). | | Pausable (`--pausable`) | **SUPPORTED** | setPaused by the owner; paused() is present on every token and answers false on one that cannot pause (§4.1). | | Allowlist (`--allowlist [--compliance]`) | **SUPPORTED** | The declared +allowlist profile (§10): both sides of every transfer and every issuance are checked against a map one named compliance key writes. Removal is a declared selective freeze, which §6.5 permits only in this form. Burn stays ungated. | | Blocklist or per-account freeze (`--blocklist [--freezer]`) | **EXTENSION, NOT CONFORMING** | Departs from §6.5, §11. Generated as setFrozen(account, frozen) by a named freeze key: a frozen account can neither send nor receive. §6.5 permits a selective freeze only as the declared allowlist profile, and §11 lists a per-account freeze as non-conforming. Burn stays ungated, so a frozen holder keeps one action. | | approve / transferFrom / allowance (`--allowances`) | **EXTENSION, NOT CONFORMING** | Departs from §4.2, §11. Generated with a zero-first approve (an allowance moves to a new non-zero value only through zero) and transferFrom by wallet spenders. §4.2 excludes allowances from v1 and §11 lists approve/transferFrom as non-conforming. The standard's reason is about contract spenders, which cannot exist here; whether wallet-spender allowances belong in a v2 of the standard is still a governance decision, and generating them as a labelled extension does not take it. | | permit (gasless approval) (`--permit`) | **UNBUILDABLE** | Needs signature verification inside the contract. The VM has SHA256 and ISADDR but no signature-verify instruction and no host call for one (AresHost exposes self address, block time, height, balance and transfer). Adding one is a hard fork. The reason permit exists — a holder with no gas — does not arise: holders pay no fees on this chain. | | Votes and delegation (`--votes [--votes-clock block\|timestamp]`) | **SUPPORTED** | Additive functions (§4.2): delegate, getVotes, getPastVotes and getPastTotalSupply over per-account checkpoints keyed by the block height or the block clock, never by a caller-supplied time (§6.8). A holder counts only after delegating. The weight is over balances, which §3.4 calls an unauthenticated set, and a token's governance is over its own storage only (§7.4); the header says both. | | Snapshots (`--snapshots`) | **SUPPORTED** | Additive (§4.2): the owner takes a snapshot, and balanceOfAt / totalSupplyAt answer what each was at that moment, recorded lazily on the first movement after it. A snapshot moves nothing, so the power it gives the owner is to record, not to change. | | Flash mint (`--flash-mint`) | **UNBUILDABLE** | A flash loan calls the borrower's contract and expects repayment in the same call. The v3 CALL instruction reaches functions inside the same contract only; there is no cross-contract call, so there is nothing to call. Needs a hard fork. | | Transfer hooks / transferAndCall (`--transfer-hooks`) | **UNBUILDABLE** | Same missing instruction: a contract cannot call another contract, so there is no receiver to notify. | | Fee on transfer (tax) (`--transfer-fee BPS [--fee-max BPS] [--fee-recipient]`) | **EXTENSION, NOT CONFORMING** | Departs from §6.2. Generated with the rate in basis points and a ceiling fixed in the bytecode (at most 2,500, 25%): the owner may move the rate up to the ceiling and change the fee recipient. That is an owner path over every holder's transfers, which §6.2 forbids. The fee is a second Transfer event, so the event sum still reconstructs every balance. | | Max wallet / anti-whale (`--max-wallet --max-tx`) | **EXTENSION, NOT CONFORMING** | Departs from §4.4, §11. Generated as a per-transfer limit and a per-wallet limit the owner can only lift, for good, never tighten. It refuses transfers with "max transaction" and "max wallet", reasons outside the §4.4 error set, and §11 requires every error string to be from §4.4. | | Metadata: logo or metadata URI, website, description (`--metadata-uri --website --description`) | **SUPPORTED** | Additive immutable views (§4.2 permits added functions). There is no setter. | | Upgradeable (proxy) (`--upgradeable`) | **UNBUILDABLE** | Bytecode is in the address preimage, Sindri has no setCode and the VM has no delegate call. §6.7 forbids simulating one. What is deployed is what holders get. | | Vesting (`--vesting`) | **SUPPORTED** | The +vesting profile (§10), composed from templates/vesting-token.ares: the mint authority grants an immutable linear schedule that spends cap room at once, and the beneficiary releases it on the block clock. Needs --mintable, because a grant is a mint-authority power. | | Wrapped (bridge-custodied), or a bridged token (`--wrapped --underlying`) | **SUPPORTED** | The +wrapped profile (§10), composed from templates/wrapped-token.ares: the custodian is the mint authority, underlying() is a label, and unwrap(amount, ref) burns with a destination for the relayer. A bridge contract that mints by calling the token is a cross-contract call and cannot exist here; the custodian is a signing wallet instead. | | Access control: one key per role (`--minter --compliance --freezer`) | **SUPPORTED** | Each power the token carries has its own named key: the owner, the mint authority, the compliance key and, with the blocklist, the freeze key. Each is a public view, so a holder reads who holds which power from the ABI (§4.1). | | Access control: managed (`--managed-access`) | **UNBUILDABLE** | An AccessManager is a separate contract the token calls to ask whether a caller may proceed. With no cross-contract call the token cannot ask it. Needs a hard fork. | **One row is a finding rather than a fact, and it is still escalated rather than settled here.** §4.2 excludes `approve`/`transferFrom` because "an allowance exists so that another contract can spend on a holder's behalf, and there are no cross-contract calls". The VM check says something narrower: a spender that is an ordinary signed wallet needs no cross-contract call, and `map>` compiles today. So allowances are buildable for wallet spenders, and the standard's reason covers only contract spenders. On 2026-10-26 the owner directed that the wizard offer allowances, which it now does as a labelled extension outside this standard, with the zero-first rule §4.2 names. That does not decide the question this paragraph raises: whether wallet-spender allowances belong in a v2 of this standard is still a decision for governance, and until it is taken a token with them does not conform. ### 14.1 The wizard `strblk contract new-token` and the explorer page `/contracts/templates/zk13-token/configure` generate a deployable token from an issuer's answers — name, symbol, decimals, owner wallet, initial supply and recipient, cap or uncapped, the SUPPORTED features above, and on request the extensions of §14.2 — and write the source beside a manifest with every parameter, the profile string, the bytecode digest, the compiler, the measured gas of every entry point and, for a named deployer and salt, the address the deployment would land at. The source is composed from this standard's reference implementation through Hephaestus (`contracts/token-wizard-source.ts`), with the reference's exact error strings, and from `templates/vesting-token.ares` and `templates/wrapped-token.ares` for the two profiles §10 already ships. Three properties of the generated token, each forced by this chain rather than chosen: 1. **The owner is the named wallet from block one, not the deployer.** A deploy record carries no initializer arguments, so the owner is a literal in the source. The deployer holds no power. 2. **The initial supply is issued by a one-shot `issueInitial()`, not in the initializer.** A deployment keeps no events from `__init`, and a mint without its `Transfer` breaks §6.10. The amount and the recipient are constants in the bytecode and the supply is reserved against the cap from deployment, so the call can run once, by anyone, and pays nobody a choice. 3. **`burn` is always present.** It is in the §4.2 minimum interface, so a non-burnable token is not on offer. The four conforming options it gained on 2026-10-26, each additive under §4.2: | Option | Flag | Profile suffix | What a holder should know | |---|---|---|---| | Votes and delegation | `--votes [--votes-clock block\|timestamp]` | `+votes` | Weight counts only after a holder delegates. `getPastVotes` and `getPastTotalSupply` answer from checkpoints keyed by the block height or the block clock, never by a time a caller supplies (§6.8). The weight is over balances, which §3.4 calls an unauthenticated set, and it governs this token's own storage only (§7.4); the header and the manifest say both. | | Snapshots | `--snapshots` | `+snapshots` | The owner takes a snapshot; `balanceOfAt` and `totalSupplyAt` answer what each was at that moment. Recording moves nothing. | | Vesting | `--vesting` (needs `--mintable`) | `+vesting` | §10's `+vesting` profile: an immutable linear grant spends cap room at once and is released on the block clock. No revoke. | | Wrapped | `--wrapped --underlying TEXT` (needs `--mintable`) | `+wrapped` | §10's `+wrapped` profile: the mint authority is the custodian, `underlying()` is a label, `unwrap` carries the destination out. No peg is enforced or may be claimed (§7.4). | Votes, snapshots and both lookups add the only loops a wizard token has: two binary searches whose trip count is the base-2 logarithm of an account's checkpoint count, at most one checkpoint per account per clock tick, so under 64 iterations for any chain that could exist (§6.9). The new functions add the error strings `future lookup` and `snapshot id`, and vesting keeps the template's `nothing to grant`, `duration must be positive`, `grant exists`, `no grant` and `nothing to release`. A token generated with none of the options added on 2026-10-26 is byte for byte the token the wizard generated before them — source, bytecode, address and manifest — and `tests/integration/token-wizard-golden.integration.test.ts` holds that against digests taken from the earlier build. A real `strblk wallet deploy` refuses any source that still carries the catalogue's example constants — a name reading "Example …", an example ticker, a wrapper's `"unset"` underlying — and accepts a generated token, because the refusal keys on those values and not on where a file came from. `templates/new-token.example.sh` is the invocation an issuer runs, with the six answers only the issuer can give — name, ticker, owner wallet, supply, cap and deploying wallet — left blank. It refuses to run until they are filled, then generates the token and dry-runs it. ### 14.2 Extensions outside this standard **Not part of this standard, and nothing here amends it.** These are the options issuers ask a token generator for that §4 to §6 forbid. The wizard generates each one only when asked for by name, because issuers ask for them; a token carrying any of them is **not a ZK13-conforming token**, and it is labelled as such in every place a holder or a reviewer meets it: - the contract is named `NonZK13`, not `ZK13`; - `standard()` answers `extended-fungible/1+…`, never `zk13-fungible/1`, with an `x-` suffix per extension; - the generated source opens with "NOT a ZK13-conforming token" and lists each power and the sections it departs from, before any other line; - the manifest's `standard` reads `NOT CONFORMING`, and its `outsideStandard` lists the same powers (on a conforming token the field is absent, which is what keeps that manifest unchanged); - the explorer form keeps the extensions in their own section behind a plain warning, and a generated result opens with the warning; - the explorer's page for a deployed contract reads the powers off its ABI and shows them above everything else (`outsideStandardPowers` in `contracts/token-extensions.ts`). | Extension | Flag | Departs from | The power it hands the issuer, as the token states it | |---|---|---|---| | Renounce ownership | `--renounceable` | §6.4 | The owner can end ownership in one call, with no second step and no undo; every owner power ends with it, including closing minting. | | approve / transferFrom / allowance | `--allowances` | §4.2, §11 | A wallet the holder approves can move the holder's tokens up to the allowance. `approve` is zero-first. | | burnFrom | `--burn-from` (needs `--allowances`) | §5.5, §4.2 | A wallet the holder approves can destroy the holder's tokens up to the allowance. | | Blocklist / per-account freeze | `--blocklist [--freezer]` | §6.5, §11 | A named key can freeze any account: it can neither send nor receive. Burn stays open to it. | | Fee on transfer | `--transfer-fee BPS [--fee-max BPS] [--fee-recipient]` | §6.2 | Every transfer pays a fee to a wallet the owner chooses, at a rate the owner sets up to a ceiling fixed in the bytecode, at most 2,500 basis points. | | Max wallet / anti-whale | `--max-wallet --max-tx` | §4.4, §11 | Transfers over a per-transaction limit, or past a per-wallet limit, are refused; the owner can lift the limits for good and never tighten them. | **One form is not generated at all.** burnFrom without an allowance — the owner destroying a holder's balance — is confiscation (§5.5, §6.2). It is not offered as an extension, and asking for `--burn-from` without `--allowances` is refused with that reason. A fee above 25% is refused for the same kind of reason: at that rate the "fee" is the token taking the transfer. Every extension's statements keep the base token's guards and its single-`Transfer` rule: a fee is a second `Transfer` to the fee recipient, a `burnFrom` is a `Transfer` to `""`, so summing events still reconstructs every balance (§4.3) and `totalSupply` still moves only through mint and burn. `tests/integration/token-wizard-combinations.integration.test.ts` drives every combination of the ten new switches against a fully featured base, and a seeded spread across all sixteen, through random calls on the VM and checks those invariants after each. ### 14.3 The options re-checked against the current VM Re-checked 2026-10-26. Container v3 added three instructions: `CALL` (a function inside the same contract), `SHA256` and `ISADDR`. None of them is a signature check, a call into another contract, or a write of code, so the five UNBUILDABLE rows stand: permit needs signature verification, flash mint, transfer hooks and a managed access manager need a cross-contract call, and an upgrade needs a code write or a delegate call — the last of which §6.7 would forbid even if it existed. ## Errata — corrected by implementation Everything below was written before the code existed and proved wrong once it did. A specification nobody has implemented is a draft, and these are recorded rather than quietly edited so that anyone who read the earlier version can see what moved. ### Corrected in `ARESLANG_STDLIB.md` - **§7's recommendation — access control as a compiler feature (`fn withdraw() only(owner)`) — is withdrawn.** The document's own boundary rule defeats it: the compiler is code every node runs identically forever and cannot change without a fork, so a library routine placed there makes an access-control policy a **consensus rule**. The day someone wants a different message or a three-key owner, the fix would be a hard fork. §7 objected to a textual prelude on the grounds that "the deployed bytecode differs from the source the author wrote" — but that is about *where* the splice happens. Composition happens **before** compilation, in ordinary application code, and the composed text *is* the contract. - **§5.6's headline change has landed.** `isValidAddress` in `validateArgs` is in the tree; an `address` parameter needs no in-contract guard. The residual is text in a `string` slot. - **§5.2's "roles — needs maps, in flight" is stale.** Maps landed; roles ship as a full `map>`. - **§5.1 still lists `sub(a, b)` as a library routine.** It is refused: `SUBU` is 3 gas, cannot be omitted because `uint - uint` is checked by type, and a wrapper would cost more while teaching that the wrapper is what makes it safe. - **§3 and §0.1 carry two different gas tables**, and §3 is the v1 one — no `MLOAD`, `MSTORE`, `SUBU`, `BALANCE` or `TRANSFER`. `stdlib/gas.ts` is authoritative and is re-measured by the test suite, so a wrong number there fails CI. - **`&&` and `||` DID not short-circuit, and now do.** Writing that limitation down is what got it fixed — see compiler `areslang-1.2.0`. The library's measured cost for `onlyOwnerOrRole` fell from 119 gas to 60 on the owner path as a direct result. ### Corrected in `ZK13_TOKEN_STANDARD.md` - **§6.6's justification is factually wrong about this VM.** The two-statement debit-then-credit does **not** inflate when `from == to`: `MSTORE` writes through, so the credit reads the already-debited value. Measured both ways. The bug appears only when both balances are cached in locals first. **Keep the mandated guard** — it makes that future edit harmless — but the stated reason for it is not the reason. §6.6's hedge about "map semantics still in flight" is resolved: they are sequential. - **§5.4's `empty recipient` rule is unreachable on the record path**, since `validateArgs` checksum-validates every `address` argument before the first opcode. The guard is kept as defence for a future caller path, and is documented as such rather than as live protection. - **§5.3's "set `minter` to `''`" cannot be expressed**, because `""` fails the `address` ABI check. It needs a dedicated zero-argument `closeMinting()`, which is what the reference implementation does. The same applies to cancelling a pending owner. - **§4.3's event set has no event for `proposeOwner`**, which contradicts §6.4's own argument that a two-step handover "leaves a window in which the pending change is visible on chain" — visible in storage, invisible in the log. The reference adds `OwnerProposed`. ### Corrected in `CONTRACT_TEMPLATES.md` - **§2 is stale, and it gated half the document.** "A contract cannot be funded with native STR" is no longer true. Consequently §4.3 vesting, §4.4 escrow, §4.5 multisig custody and §4.7 "DAO treasury — in flight" are all writable today, and all four are shipped and adversarially tested. - **§2's own proposal was mis-scoped.** It claimed the funding clause "unblocks the most of this catalogue". It unblocked **custody**. It did not unblock the **deposit-attribution** class, which is what actually prevents native staking, a token sale, a per-user vault and a tip jar — see below. - **A contract address cannot be funded before it is deployed.** The receive gate answers from the deployed set, so the only pre-funding path is a genesis allocation. --- ## The gaps that remain, named precisely Recorded here because each one blocks a specific, obvious thing a user will try. 1. **Deposit attribution.** A call record carries no value and there is no deposit hook, so a contract cannot learn *who paid it*. Escrow, vesting, multisig and the treasury work because their funds are pooled and governed by roles. Native staking, a token sale, a per-user vault and a tip jar all need to credit a payer, and cannot. This is the single highest-value remaining item for templates. 2. **No domain accessor on the host.** `AresHost` exposes `selfAddress`, `blockTimestampMs`, `blockHeight`, `balanceOf` and `transfer`. A contract cannot ask whether an address holds a proved STR.domain, so a domain-bound NFT — a wNFT — is not writable. The shipped `nft-collection.ares` is an honest plain NFT, and a test asserts its source mentions no domain at all. 3. **No user-defined function calls.** The library is composed source rather than linked code, and the staking accrual is copied verbatim three times behind `ACCRUAL BEGIN/END` markers. That is a real hazard and the template header says so. 4. **No cross-contract calls**, so a general multisig or DAO that acts on another contract is not writable. 5. **No constructor arguments.** Every parameter is a source constant the user edits or a post-deploy setter. `state owner: address = caller;` works because the initializer runs with the authenticated deployer as caller — so no template needs a `claimOwnership` call, and there is no claim race. 6. **Deployment gas is unmeasured.** `applyDeploy` returns no `gasUsed`, so `postMineForContractRecord` skips deploys. Left unmeasured rather than estimated. 7. **No integer-to-string conversion.** The builtins are `len`, `concat`, `balance` and the statement `transfer`, and no opcode renders a number as text. It blocks nothing in this standard and a great deal in the NFT one: a metadata URI cannot be derived as `base + id`, so every token stores its whole URI in state every node keeps forever. Added 2026-09-17 while the sibling standards were being written, because that is when it started costing something. 8. **No hashing opcode.** A contract cannot hash anything, so a Merkle allowlist, a commit-reveal, and any check of the form "the issuer signed this" are all unwritable. An allowlist has to be stored one address at a time, at 220 gas a write. 9. **No aggregate argument type.** Every parameter and every return is one scalar, so there is no batch operation anywhere in the family: n movements are n call records, atomic individually and never together. 10. **The nine templates written on 2026-09-17 are not in the committed test suite at all.** `zk13-nft.ares`, `zk13-multi-token.ares`, `zk13-vault.ares`, `soulbound-badge.ares`, `fixed-supply-token.ares`, `allowlist-token.ares`, `payment-splitter.ares`, `timelock.ares` and `faucet.ares` each compile, and each was deployed and exercised on a real `BlockchainCore` — genesis with proved STR.domains, signed deploy and call records sealed into blocks, value moved, `validateChain()` accepted — but **that run was a script this desk ran once and is not committed**, and the catalogue-wide properties in `template-catalogue.integration.test.ts` do not reach them either: the set it iterates is `TEMPLATES` in `tests/helpers/templates.ts`, which names the seven older files. Registering the nine there and writing a suite each are both changes in `tests/`, which this desk does not own. **Two handoffs, named rather than implied by the word "tested".**