Date: 2026-09-17 Status: specification, with a conforming reference implementation.
templates/zk13-multi-token.ares implements everything below and compiles on
areslang-1.2.0. It was deployed and exercised on a real BlockchainCore — genesis with proved
STR.domains, signed deploy and call records sealed into blocks, validateChain() accepted
afterwards — and every gas figure here is what the STARW VM charged on that run.
That run is not a committed test. It was a script this desk ran once; the template is not in the suite CI executes, and §12 says exactly what that means and what is owed.
No ZK13 multi-token contract has been deployed on a public network, because no realm has a
published address (docs/INSTALL.md §6).
Naming. A fifth use of the ZK13 family name, after the proof system, the
zk13str_address format, the fungible token standard and the NFT standard. A registry amendment is owed to the naming owner —docs/NAMING.md:136entry (3) should read the ZK13 asset standards family (fungible, NFT, multi-token, vault). This desk may not editNAMING.md. The standard references no proof, no commitment and no nullifier, and a contract conforming to it must not cite ZK13 the proof system as evidence of anything.
Siblings, which this document does not repeat:
ZK13_TOKEN_STANDARD.md (fungible) and
ZK13_NFT_STANDARD.md.
1. What a ZK13 multi-token contract is, and is not#
A ZK13 multi-token contract holds many assets in one contract. Each asset has an id, and each id has its own supply, its own cap, its own metadata and its own display precision. Balances live in one nested map from id to holder to amount, in the contract's own storage.
An id whose cap is 1 is non-fungible, and the cap is what makes that true rather than a
convention: mint refuses the second unit. An id whose cap is 0 is an uncapped fungible balance.
Both live in the same map and produce the same event, which is the whole point of the shape.
It is not:
- a way to put several assets under one governance without saying so. One contract is one set of rules: one owner, one minter, one pause. §5.7 states what that costs.
- a replacement for either sibling standard. A single asset is clearer as a ZK13 token; a collection of one-of-ones with per-token metadata and holder enumeration is clearer as a ZK13 NFT. This is for a catalogue.
- a native ledger, an entry in
TokenType, or anythingLedgerManager.validateprotects.
2. Where the state lives#
In the contract's own storage, committed through Sindri into the chain state root, for the
reasons set out in full at ZK13_TOKEN_STANDARD.md §2.
The nesting order is part of this standard: balances[id][holder], id first. Neither order
makes a holder's whole position enumerable — a map's keys cannot be listed on this VM — so the
choice is made for the reader: every slot belonging to one asset shares one prefix, which is the
order somebody auditing contractStorage walks it in.
3. Who may hold, and who may move#
Identical to ZK13_TOKEN_STANDARD.md §3. Receipt is ungated; acting is
gated by contractCallerGate, which refuses any deploy or call whose actor holds no proved
STR.domain. A balance can therefore exist at an address that can never move it, and the balance
is inert rather than dangerous.
A balance recorded at a contract address can never move again, because a contract cannot be
caller. A conforming contract MUST refuse to == self and cannot detect any other contract
address.
4. The interface#
4.1 Views — every conforming contract must expose all of these#
view fn standard() -> string // "zk13-mt/1"
view fn name() -> string // the CATALOGUE's name, not an asset's
view fn symbol() -> string
view fn typeCount() -> uint // ids are 1..typeCount(), no gaps
view fn exists(id: uint) -> bool
view fn uri(id: uint) -> string
view fn decimals(id: uint) -> uint // display only; §5.6
view fn totalSupply(id: uint) -> uint // circulating; a burn lowers it
view fn maxSupply(id: uint) -> uint // 0 means uncapped for this id
view fn lifetimeIssued(id: uint) -> uint // never falls; what the cap is checked against
view fn typeClosed(id: uint) -> bool // true: this id can never be minted again
view fn balanceOf(account: address, id: uint) -> uint
view fn owner() -> address
view fn minter() -> address // "" when minting is permanently closed
view fn paused() -> boolArgument order on balanceOf is (account, id), matching the common multi-token interface, so
that a client written against it does not silently transpose two arguments of the same type. uint and address are
distinct types in the ABI and validateArgs would refuse the transposition — but only because
the types differ, which is luck rather than design, and the standard does not rely on luck.
lifetimeIssued(id) is required rather than optional for the reason the fungible standard gives:
without it a wallet cannot compute remaining mintable at all. maxSupply(id) - totalSupply(id) is
the obvious formula and it is wrong after any burn.
4.2 Mutating functions#
fn createType(metadataUri: string, cap: uint, decimalsValue: uint) -> uint // minter only
fn mint(id: uint, to: address, amount: uint) -> bool // minter only
fn transfer(id: uint, to: address, amount: uint) -> bool // the holder
fn burn(id: uint, amount: uint) -> bool // the holder's own
fn closeType(id: uint) // owner only, one-way
fn proposeOwner(next: address)
fn acceptOwnership()
fn setPaused(next: bool)
fn setMinter(next: address) // REFUSES once closed
fn closeMinting() // owner only, one-wayid comes first on every mutating function, because it selects which ledger the rest of the
arguments are about. Consistency here is worth more than matching any other chain's ordering.
No approve, no operator, no transferFrom, and no batch anything. The first three are the
fungible standard's §4.2 decision, unchanged: an approval exists so another contract can spend on
a holder's behalf, and there are no cross-contract calls. The fourth is not a decision — see §7.
4.3 Events#
event Transfer(id: uint, from: address, to: address, amount: uint)
event TypeCreated(id: uint, cap: uint, decimals: uint, uri: string)
event TypeClosed(id: uint, lifetimeIssued: uint)
event OwnerProposed(current: address, pending: address)
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 of every id, and there is no second
one: a mint is Transfer(id, "", to, amount), a burn is Transfer(id, from, "", amount). An
indexer summing Transfer per id must arrive at exactly the balances in storage.
There is deliberately no TransferBatch. The common multi-token interface has one because it
has batch calls; this
standard has no batch calls (§7), so a second event shape would describe a movement that cannot
happen and would double-count for anyone summing both.
4.4 Errors#
| String | Raised when |
|---|---|
no such type | id is 0, or above typeCount() |
type closed | mint is called on an id whose typeClosed(id) is true |
insufficient balance | the sender's balance of this id is below amount |
empty recipient | to == "" |
self transfer | to == caller |
self is not payable | to == self |
supply cap | a mint would take lifetimeIssued(id) past maxSupply(id) |
uri too long | the metadata pointer is past the contract's declared bound |
decimals too large | createType is asked for a display exponent past the declared ceiling |
mint closed | a mint or createType is called when minter() is "" |
not minter | a minter-gated function is called by another address |
not owner | an owner-gated function is called by another address |
not the pending owner | acceptOwnership is called by another address |
paused | a mutating function is called while paused |
5. Compliance rules#
5.1 Ids#
Assigned by the contract, in sequence, from 1, never reused and never deleted. There is no id
0: it is what an unwritten uint map entry reads as, so an asset at id 0 would be
indistinguishable from no asset. typeCount() is therefore both the number of assets and the
highest id, and exists(id) is one comparison.
There is no delete. An id created is a permanent addition to the state every node keeps; an issuer who creates a type per order will find the contract stays cheap to CALL — every function is a fixed number of map operations — and the state does not shrink.
5.2 A type's terms are immutable#
uri, maxSupply and decimals for an id are written once by createType and no function
changes any of them. An issuer who can raise a cap after the sale has no cap; an issuer who can
repoint the metadata after the sale has sold something else.
The metadata bound is a policy number the contract enforces because the meter does not: the
VM prices a storage write by the slot name it builds and not by the value it stores, so a 60,000
character URI costs the same gas as a short one while adding 60,000 characters to permanent
state. MAX_STRING_LENGTH (65,535 UTF-16 code units) is the only machine limit.
The common {id} URI template convention works here, and is the recommended shape for a
large catalogue. Substitution is the CLIENT's job in that convention, not the contract's — which
is exactly why it is available on a VM that cannot render an integer as a string (§7). Store the
same template string in every type and let the client substitute; the contract has not computed
anything.
5.3 Supply#
- The cap bounds
lifetimeIssued(id), which never falls. NevertotalSupply(id), which a burn lowers: mint, burn, mint defeats a cap tested against a burnable number, and the issuance is unbounded while the cap never appears to break. - A mint at the cap reverts rather than truncating. A truncated mint gives the minter less than they asked for and tells nobody.
closeType(id)is one-way and closes minting for that id alone. It does not pause anything and takes nothing from a holder: a closed type still transfers and still burns.closeMinting()is one-way and closes the WHOLE catalogue: no new types and no new units of any existing type, ever.setMinterMUST refuse afterwards.
5.4 Transfer#
transfer(id, to, amount) MUST refuse while paused, refuse an id that does not exist, refuse
to == "", to == caller and to == self, check the caller's own balance of that id, and emit
exactly one Transfer. A zero-amount transfer is permitted and still emits: refusing it breaks
batch payers that send a list including zeros.
The debit is uint - uint, which the compiler emits as the checked SUBU: it reverts rather
than producing a negative balance that every later comparison would read as "plenty".
5.5 Burn#
Only the caller's own balance, of one id. There is no authority in a conforming contract by which anyone could burn somebody else's, and inventing one is confiscation.
5.6 Decimals are display only#
decimals(id) is metadata the issuer declared at creation. No arithmetic in the contract
consults it, and a conforming contract must not use it to scale anything — a scaling factor the
issuer chooses per id is a rounding rule nobody can audit. 13 matches the seven native ledgers;
0 is right for a non-fungible id.
5.7 The pause is global, and that must be declared#
One setPaused(true) freezes createType, mint, transfer and burn for every id in the
contract, including ids held by people with no interest in whatever prompted it. It freezes no
view.
A conforming contract MUST NOT pretend otherwise by shipping a per-id pause flag: the owner could set it for every id anyway, so the flag would buy a holder nothing and would read as a limit on a power that is not limited. If assets need independent emergency stops, they need independent contracts. That sentence belongs in the contract's own header, and it is in the reference implementation's.
6. Design against theft#
- No function that writes a balance to an arbitrary value. Every write is a debit or a credit of a checked amount.
- No owner path that moves, freezes or takes a holder's balance of any id. No
setBalance, noadjust, notransferFrom, no per-account freeze. An issuer who needs a transfer restriction needs the allowlist profile of the fungible standard, where the freeze is declared. - No raisable cap, no mutable metadata, no reopenable mint, no reopenable type (§5.2, §5.3).
- No single-step ownership change.
- No reliance on caller-supplied time — nothing in this standard reads a clock at all.
- No unbounded work. Every function is a fixed number of map operations; nothing iterates.
- No mint or burn that skips the event.
- No upgrade path and no proxy. Bytecode is in the address preimage; there is no
setCode.
7. What this standard cannot express on this VM, precisely#
| Feature elsewhere | Status here | Why, exactly |
|---|---|---|
safeBatchTransferFrom, mintBatch, burnBatch, balanceOfBatch | Not expressible | AresLang has no array type. Every parameter and every return is one scalar (runtime/parser.ts: "there is no map value, no map argument and no map return", and no list of any kind). n movements are n call records: n signatures, n nonces, atomic individually and not together. If you need "all of these or none", this contract cannot give it and no arrangement of the code can |
TransferBatch event | Not applicable | Nothing can emit a movement of several ids at once, because nothing can perform one (above) |
onERC1155Received / onERC1155BatchReceived | Not expressible | No callbacks of any kind. A contract recipient cannot refuse a token, so a balance sent to a contract address is stranded with no hook that could have prevented it |
approve / setApprovalForAll / operators | Refused, and unusable if written | No cross-contract calls: nothing could exercise the approval, and a stock of live approvals would appear the day one ships |
A URI computed as base + id inside the contract | Not expressible | No integer-to-string conversion. The {id} template convention (§5.2) is the substitute and it works because the client substitutes |
| Per-id supply enumeration of holders | Not expressible at any price | A map's keys cannot be listed. balanceOf answers for one address; the holder set is reconstructed off chain from Transfer |
| A metadata URI shared by the whole catalogue in one slot | Expressible, and not required | A conforming contract MAY add a contractUri(); the reference implementation stores per-type URIs instead, because the per-type write is where an issuer is already paying |
| Catalogue name, symbol or URI bound as constructor arguments | Not expressible | No constructor arguments. They are source constants the issuer edits, which changes the bytecode and therefore the address — a different catalogue is a different contract. Everything about an individual ID is chosen at createType, after deployment, which is why this shape suffers less from the limit than the sibling standards |
| A per-id pause | Expressible, and refused | §5.7 |
| Royalties, marketplaces, atomic swaps of two ids | Not writable as separate contracts | No cross-contract calls. Writable only inside this contract, and this standard does not define them |
8. Conformance checklist#
- [ ] Every view in §4.1 is present, is
viewin the ABI, and answers while paused. - [ ] Every function in §4.2 is present, with these names and this argument order,
idfirst. - [ ] Ids start at 1, are contract-assigned, sequential, never reused, never deleted.
- [ ]
createTypeis the only writer ofuri,maxSupplyanddecimalsfor an id. - [ ]
mintchecks the cap againstlifetimeIssued(id). - [ ]
closeTypeandcloseMintingare one-way;setMinterrefuses once minting is closed. - [ ]
transferrefuses"",callerandself, and debits the caller's own balance. - [ ]
burndebits the caller's own balance only. - [ ] Exactly one
Transferper movement; no second movement event of any shape. - [ ] No function in the ABI that a reader could mistake for a batch. A fixed-arity helper —
transferTwo(id, toA, amountA, toB, amountB)— is expressible and permitted, and MUST be named for the arity it has rather than for the arity a caller wants. - [ ] Every error string is from §4.4.
- [ ] The header states that the pause is global.
- [ ] The header states the measured gas of every entry point and the limit to declare.
9. Profiles#
- Fungible-only — every type created with
decimalsof 13 and a cap of 0 or a real number. This is an issuer's catalogue of currencies in one contract. - Edition-only — every type created with
decimalsof 0 and a cap of 1: a set of one-of-ones sharing one set of rules. Cheaper per asset than one NFT contract each, and with no per-token enumeration. UseZK13_NFT_STANDARD.mdinstead when holders needtokenOfOwnerByIndexor when each token needs its own metadata AND its own transfer history under one id. - Mixed — the shape a multi-token contract is usually deployed as, and what the reference implementation ships as: fungible currencies and unique items in one catalogue.
A profile is declared in standard() as "zk13-mt/1+editions" and so on. It is a
self-declaration and proves nothing; catalog(address) and the caps are the check.
10. The reference implementation, and what it costs#
MEASURED on areslang-1.2.0, 53-character addresses, a 29-character URI. Gas is a pure function
of the instruction stream, so these are exact for the calls described.
| Call | Gas |
|---|---|
createType | 1,276 |
mint into an uncapped id | 1,336 |
mint into a capped id | 1,460 |
transfer | 904 |
burn | 872 |
closeType | 570 |
proposeOwner | 412 |
acceptOwnership | 612 |
setPaused | 363 |
setMinter | 471 |
closeMinting | 470 |
| gas limit to declare | 15,000 |
Ten times the most expensive entry point, because post-mining covers
min(gasUsed, gasLimit / 10): below that the network absorbs the shortfall on every call,
silently, forever.
Worth noting against the sibling standards: transfer here is 904 gas against the fungible
standard's 835, and the whole difference is the longer slot name a two-level map builds. One
contract holding a hundred assets is not more expensive per movement than a hundred contracts
holding one each — it is 8% more expensive, and one set of rules instead of a hundred.
11. Where this comes from, and where it diverges#
| Prior art | Taken | Left |
|---|---|---|
| The common multi-token interface | The shape: one contract, many ids, balanceOf(account, id), a single transfer event per movement, fungible and non-fungible in one balance map, the {id} URI template | Batch calls and TransferBatch (no arrays), operators and setApprovalForAll (no cross-contract calls), receive hooks (no callbacks), the _uri single-slot convention |
| The common fungible-token interface | Nothing directly; the per-id supply rules come from ZK13_TOKEN_STANDARD.md, which took name/symbol/decimals/totalSupply from it and refused approve/transferFrom | Allowances, for the reason above |
| SPL Token (Solana) | The separation of a MINT from an ACCOUNT, which is what createType and balances[id][holder] are: the terms of an asset live in one place and a holding lives in another, so an asset's cap and decimals are stored once rather than per holder | The account model itself — there are no rent-paying token accounts here, and a holding is a map entry with no owner-of-the-account indirection and no closeAccount. Also the freeze authority: a per-account freeze is confiscation-adjacent and this standard refuses it (§6.2) |
| 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 its divergences are all about who pays. Here the payer question is answered by post-mining and the domain lock, so nothing needed importing | The energy/bandwidth model |
| Sui object model | The idea that a unique asset should be a first-class thing with its own identity rather than a row in a balance table. Where it fits here is cap == 1, which makes an id genuinely unique and enforces it | Ownership as an object field, transfer by moving an object, and the type system that makes it safe. Nothing on this VM has an object; storage is a flat key/value set, which is what lets Sindri commit it as leaves with no ordering of its own |
| The tokenised-vault interface | Out of scope here; see ZK13_VAULT_STANDARD.md | — |
12. What is not built#
| Not built | Where it is discussed |
|---|---|
| Arrays or any aggregate argument type, without which batch operations stay unwritable | §7 — the single highest-value change for this standard |
| Cross-contract calls, without which approvals, marketplaces and swaps stay unwritable | §7 |
| An integer-to-string builtin, without which in-contract URI derivation stays unwritable | §5.2, §7 |
Any committed test over zk13-multi-token.ares | The seven older templates each have an adversarial suite, and the catalogue-wide properties iterate TEMPLATES in tests/helpers/templates.ts — a list of those seven. This one is not in it. What was done instead: it compiles, and it was deployed and exercised on a real BlockchainCore with signed records sealed into blocks and validateChain() accepted — by a script this desk ran once and did not commit, because tests/ and scripts/ are not this desk's to write. Two handoffs: register it in that list, and write a suite. |
| Deployment gas | Unmeasured, not estimated: applyDeploy returns no gasUsed |