const PolicyClosed, PolicyLicensed, PolicyOpen
Policies.
Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.
Package core is the platform's immutable ledger (design §2.5.2): every collection, its official grc721 token and roya...
Package core is the platform's immutable ledger (design §2.5.2): every collection, its official grc721 token and royalty, its provenance (commit–reveal v2), the engine registry, fees and the admin timelock.
What core guarantees, whoever holds the admin key:
core imports no mutable realm: minters and engines are known only by package path and interface value.
Policies.
How a collection's creator was allowed to use the engine (collection JSON "access", CollectionCreated.access).
1const (
2 OpFeeCreate = "fee.create" // ugnot, <= CreateFeeCap
3 OpFeePrimary = "fee.primary" // bps, <= ProtocolFeeCapBps
4 OpFeeSecondary = "fee.secondary" // bps, <= ProtocolFeeCapBps
5 OpFeeEngine = "fee.engine" // bps, <= EngineFeeCapBps: platform cap on engine-author fees
6 OpTreasury = "treasury" // address
7 OpBeacon = "beacon" // address, or "" to disable new beacon launches
8 OpMinterAdd = "minter.add" // realm pkgpath
9 OpMinterDeprecate = "minter.deprecate" // realm pkgpath: no new collections
10 OpEngineReview = "engine.review" // engine id: reviewed badge (UI only)
11 OpAdminTransfer = "admin.transfer" // address; the new admin must AcceptAdmin
12 OpRandomnessAdd = "randomness.add" // registered provider path: creators may launch with it
13 OpRandomnessDepr = "randomness.deprecate" // provider path: no new launches; running ones finish
14 OpListingDeposit = "listing.deposit" // ugnot, <= ListingDepositCap: market deposit return for new listings
15 OpEngineDeprecate = "engine.deprecate" // engine id: no new collections (proven re-wrap or squat, ENG-M1)
16 OpPayeeDeny = "payee.deny" // realm pkgpath: refused as payee/treasury from now on (I-18: no op removes)
17)Ops and their argument formats.
1const (
2 ProtocolFeeCapBps = 500 // 5% of any sale
3 RoyaltyCapBps = 1000 // 10% (RA M-3)
4 CreateFeeCap = 1_000_000_000 // 1,000 GNOT in ugnot
5 MaxPayees = 4
6 MaxSupplyCap = 10_000
7 MaxMintPerTx = 10 // hypothesis: measure n=10 gas/deposit on Onyx
8 MaxReserveBps = 1000 // creator reserve <= 10% of supply
9 MaxSaleBlocks = 732_000 // ~30 days
10 RevealWindowMin = 1_017 // ~1 hour
11 RevealWindowMax = 170_000 // ~7 days
12 BeaconGraceBlocks = 254 // beacon may reveal first in the window's last ~15 min (< RevealWindowMin, so the creator always gets to go first)
13 TimelockBlocks = 48_800 // ~48 hours
14 MaxPauseBlocks = 195_000 // ~8 days: pause budget per scope and window
15 PauseWindowBlocks = 732_000 // ~30 days (SA-L2)
16 EngineFeeCapBps = engine.MaxFeeBps // 5%: hard cap of an engine author's fee (platform cap <= this)
17 ProviderWaitBlocks = 24_400 // ~24 h: Finalize waits this long after the deadline (or the round's binding) for a provider's round before falling back (CV-M1)
18 ListingDepositCap = 5_000_000 // 5 GNOT: hard cap of the market's listing deposit return (op listing.deposit, CV-L2)
19
20 MaxNameLen = 64
21 MaxDescriptionLen = 1024
22 MaxParamsLen = 1024
23 MinSecretLen = 32
24 MaxSecretLen = 256
25 MaxPageSize = 50
26
27 // Engine registry (ENG-M1, I-14).
28 ReservationTTLBlocks = 170_000 // ~7 days: a fingerprint reservation is usable this long
29 UnclaimedHoldBlocks = 24_400 // ~1 day: an unclaimed record stops blocking the same art after this
30 MinReserveSaltLen = 32
31 MaxReserveSaltLen = 256
32
33 // MaxDeniedPayees bounds the payee.deny entries (each payee check
34 // looks the address up once; the bound only caps admin-made growth).
35 MaxDeniedPayees = 64
36)Hard limits. They are constants on purpose: nobody, admin included, can raise them after deploy (block counts assume ~3.54 s blocks, RA M-1).
Provenance badges (design §4.3).
Engine statuses (EngineStatus, engine JSON "status").
CoreVersion tells indexers and frontends which core they read (M-26).
AbortLaunch returns a launched collection to Draft while nothing has been minted — the way out when a beacon never commits. A commitment whose secret was revealed is burned for this collection; unrevealed ones (the beacon's deterministic one included) may be committed again (SA-L1).
1func ApprovalNonces(cid, tid string, owner, operator address) (tokenNonce, operatorNonce int64)ApprovalNonces returns the token's approval nonce and the (owner, operator) approval-for-all nonce. Approvals made directly through Token(cid).RealmTeller by a realm acting for itself do not bump them.
Every Approve of a token and every SetApprovalForAll of an (owner, operator) pair bumps a nonce. A market pins the nonces at listing time, so revoking an approval kills a listing for good: approving again later starts a new nonce and never revives the old listing (SA-L3).
Argument order follows grc721 with the collection first (K-1, Onbloc option A): Approve(cid, to, tid), TransferFrom(cid, from, to, tid).
BeaconCommit is the beacon's commitment, before any token exists.
Burn is owner-only. The supply gate uses nextTID, so a burn never reopens a slot (I-5).
ClaimEngine proves the manifest author controls that address. Unclaimed engines cannot back a collection.
CloseMint materializes Closed once the sale window has passed. Anyone may call it; reveals and Finalize work without it.
Collection is the collection record as JSON.
CollectionTraitTypes is the collection's trait list as JSON ["…"].
CollectionsByEngine pages the collections created on engine id, in creation order (M-18). The count is the engine JSON's "collections".
CreateCollection stores a Draft collection and returns its id. Nobody can mint a Draft, so a creator can configure phases across several messages without a race (OA B2).
CreateRefusal is why CreateCollection would refuse creator on engine id with params now, as core's own text, or "" when the engine gates pass: unknown engine, create paused, unclaimed/deprecated/superseded, the policy, a used-up licence, params of another creator. The engine's own ValidateParams and the spec's other fields are not judged here.
DeniedPayees pages the deny set as JSON: [{path, address, source}].
DeprecateEngine stops new collections; existing ones keep rendering.
DistributeRoyalties pushes the whole sub-treasury balance to the royalty payees. Permissionless and never paused (I-2); market/v1 calls it after every sale. Returns the amount distributed. The sub-realm banker spend is verified by spike/subtoken, core and market tests on gno v1.7.0.
Engine is the record as JSON.
EngineFee is the engine-author share of cid's sales: the author and the bps a sale pays now (0 when the creator is the author). mint/v1 and market/v1 pay safe.BpsOf(amount, bps) to author.
EngineManifest is the typed read for other realms (gallery).
EnginePolicy is engine id's policy: "closed", "licensed" or "open".
EngineStatus is "unclaimed", "unverified", "reviewed", "deprecated" or "superseded".
EngineTraits returns a core-owned copy of the engine's traits for seed, checked against TraitTypes(params).
EnginesByFingerprint pages every record with fingerprint fp, in path order (the deploy check's squat scan).
ExecuteOp applies a proposed op once its timelock has passed. The delay is judged at execution, so an op proposed during bootstrap still waits the full timelock if a collection appeared in the meantime.
FairLaunch is true only for a Final, consistent collection whose map no single party could choose: launched with the beacon and finalized with both secrets or with the beacon's alone (after the creator stayed silent). Creator-only collections (no beacon: the creator alone knew the only secret and could steer the last mint, SA-M2) and fallbacks are not fair launches, even when VerifyProvenance is true.
FeeConfig is the typed fee view minters and markets settle with.
Fees is the fee configuration and its hard caps as JSON.
Finalize is permissionless and never paused (I-2): immediately once every expected secret is revealed, otherwise after revealDeadline (fallback). For a provider collection it first binds or consumes the provider's round (settleProvider) and falls back only when the provider failed to deliver.
FulfillRandomness takes the bound round's value from the provider as the beacon secret and finalizes (2/2 after the creator, beacon-only when it stayed silent). Permissionless and never paused (I-2); works before and after the deadline while the collection is Closed.
GrantLicence lets holder create up to maxCollections (1.. MaxLicenceCollections) collections with engine id while its policy is "licensed". feeBps is LicenceFeeDefault (-1, the manifest fee) or 0..EngineFeeCapBps: the engine-author fee of the holder's collections, snapshotted at their creation (a sale still pays at most the platform cap). Granting again to a holder updates maxCollections (not below the used count) and feeBps and keeps the used count. Claimed author only; not on a deprecated or superseded engine. A grant does not change the policy.
Info is the typed collection view for other realms.
IsDeniedPayee reports whether addr is in the payee deny set (static platform realms, approved minters, payee.deny). Core's own addresses and a collection's sub-addresses and engine adapter are refused as well (assertSpendable) but are not listed here.
Launch freezes the configuration (I-6): sale window, reveal window and the creator's commitment. The sale must start in the future so a beacon can commit before the first mint.
Licence is holder's licence on engine id as JSON {engine, holder, maxCollections, used, feeBps, grantedHeight}, or null.
Licences pages engine id's licences in holder-address order.
Licensed reports whether holder holds a licence on engine id with room for another collection (whatever the current policy).
ListingDeposit is the deposit return (ugnot) market/v1 pins into a new listing (CV-L2); 0..ListingDepositCap, admin op listing.deposit.
MintTo mints n tokens during the sale. The minter has already checked phase, price, allowlist and wallet cap; core re-checks only what it owns: state, supply and the beacon commitment (I-5). The lifetime counter of I-9 is the grc721 balance itself (mintedBy).
MintedBy is addr's lifetime count of sale mints in cid (OA B3, I-9), reserves excluded. Exact until the collection is Final, -1 afterwards (derived from the locked grc721 balance; see mintedBy).
MintedTotal counts every token ever minted, burned ones included (OA B4).
Name and Symbol are the collection's grc721 name and symbol (K-1: the grc721 read set a wallet needs, keyed by collection).
ParamsTaken is the cid of the first collection created with engine id and exactly these params, or "" (always "" for empty params).
Pause stops new activity in one scope for the rest of its budget (at most MaxPauseBlocks per PauseWindowBlocks). It never blocks exits (I-2) and cannot be renewed while it runs (SA-L2).
PauseBudget is the scope's pause record as JSON: {until, used, windowStart, windowEnd, left}.
Paused reports whether scope ("create", "mint", "trade") is paused now.
PendingOps pages the timelock queue as JSON (M-25): [{id, op, arg, proposed, earliest}].
PrimaryFeeBps is the protocol fee on cid's primary sale: the fee at Launch, or the current one if the admin lowered it since (SA-I5: a fee cannot rise during a sale).
PrimaryPayees returns a copy of the frozen primary-sale split.
Provenance is the whole record as JSON; secrets and salt stay "" until revealed / final.
RandomnessProviders lists registered providers (by path) as JSON: [{id, name, active, registeredHeight}]. Registration is open, so only "active" ones (admin-approved) can be chosen at Launch.
RegisterEngine stores the calling realm's engine (I-16: the manifest, default params and one sample render with its traits, in the engine's own registration transaction). The record is immutable afterwards except for the claim/deprecate/review/superseded flags, the collection count and the access policy (access.gno: every engine starts closed).
salt is "" or the salt of a ReserveFingerprint commitment made by the manifest author (ENG-M1 rule 2). Fingerprint rules (I-14), with signer = OriginCaller:
RegisterRandomnessProvider stores the calling realm's provider. It is inert until the admin approves it (randomness.add, timelocked).
Render stays minimal in the immutable realm; the browsable gallery is the private, re-deployable gallery realm (design §2.5.7).
RenderWith renders any registered engine for arbitrary params and seed as a data URI — Studio previews and the Verify button. For a media engine it is the card.
1func RenderWithInput(id, params, seed string, mintHeight, lastMove, moves, h int64, firstOwner address) stringRenderWithInput is RenderWith for a full Input, so living engines can be verified off chain and against their TS twins (M-24). CollectionID and TokenID are "0" and Salt "" as in every studio render; firstOwner is passed through as Input.FirstOwner ("" = none).
RequestRandomness binds a provider-backed collection whose creator stayed silent to the provider's next unknowable round (a creator's reveal binds it itself). Permissionless and never paused (I-2); after the deadline the first Finalize binds instead.
Reservation is the reservation of author for commitHex as JSON {author, commit, height, validFrom, expires, active}, or null.
ReservationCommit is the commitment ReserveFingerprint takes: sha256("art|fpres|v1|" + chainID + "|" + fp + "|" + author + "|" + salt).
ReserveFingerprint records a commitment to register an engine whose art is not public yet (ENG-M1 rule 2):
1commit = ReservationCommit(chainId, fingerprint, author, salt)
with salt 32..256 bytes. The caller (a wallet) is the author; the reservation is usable from the next block for ReservationTTLBlocks by a RegisterEngine(…, salt) signed by that author with that Manifest.Author. The commitment reveals nothing, so it cannot be front-run.
ReserveTo mints the creator's reserve before the sale starts. Reserve mints feed the entropy like any mint, appear in Provenance, and do not count toward wallet caps.
ReservedFingerprints is the in-source table as JSON [{name, fingerprint, author}].
RevokeLicence removes holder's licence on engine id. Collections already created under it are not affected. Claimed author only (also on a deprecated or superseded engine).
Royalty publishes the read-only royalty view (EIP-2981 RoyaltyInfo).
Salt is cid's final salt (hex), "" before Final (M-5: the upload adapter and other readers no longer parse Provenance JSON).
SetEnginePolicy sets who may create collections with engine id: "closed", "licensed" or "open". The claimed manifest author only; refused for a deprecated or superseded engine (it backs no new collection anyway).
SetPayees changes the royalty split after Final. The primary-sale split is frozen with the sale (I-6); the royalty receiver stays the collection's sub-treasury, so third-party markets are unaffected. Royalties earned so far are first paid to the current payees (SA-I4).
Token publishes the collection's official *grc721.Token. Its exported methods are reads or teller factories that need the caller's live realm; the ledger itself is never published.
TokenCard is the token's checked SVG as a data URI: the art of an SVG engine, the card of a media engine, or the placeholder (gnoweb and SVG-only clients).
TokenMediaInfo describes what TokenURI returns without the payload: {"source":"placeholder"|"svg"|"card"|"data"|"ipfs","mime","sha256","uri","bytes"} (uri only for ipfs; bytes = the file size for data, else 0).
TokenMetadata is OpenSea-style metadata JSON. "image" is TokenURI written without escaping (it only ever holds data-URI / ipfs characters, M-4); "image_mime" and "image_sha256" describe a checked media file.
TokenMoves is the transfer counter market/v1 pins in a listing (H-2).
TokenSeed is "" until the collection is Final: no read path can leak the rarity map early.
TokenState is {mintHeight, lastMoveHeight, moves, firstOwner} as JSON.
TokenTraitList is the typed form of TokenTraits for other realms (a copy).
TokenTraits is [{"trait_type":…,"value":…}] JSON.
TokenURI is the token's art (I-15). Before Final every token shows core's neutral placeholder, never engine output (design §4.2). Then: an SVG engine's checked Render as an SVG data URI; a media engine's checked Media as a raster/SVG data URI or its ipfs:// CIDv1 URI, or — when the Media is empty or fails engine.CheckMedia — the checked card.
TransferCreator starts a two-step handover (RA M-11).
Unpause ends a pause early and gives the unused blocks back to the budget.
VerifyEngine re-renders the sample and compares it with the fingerprint stored at registration.
VerifyProvenance recomputes every commitment and the salt from public data. True only for a Final collection whose record is consistent.
Version is CoreVersion (M-26).
1type RandomnessProvider interface {
2 // Name is a short label for UIs, e.g. "drand quicknet".
3 Name() string
4 // Target is the round a request made in the current block is bound
5 // to. Its value must be unknowable to anyone at this block (a round
6 // published strictly in the future). Read-only.
7 Target() int64
8 // Randomness is round's verified value as 64 lowercase hex characters
9 // (32 bytes), or "" while it is not available. Read-only.
10 Randomness(round int64) string
11}Pluggable randomness sources (beacon v2).
A collection launched with useBeacon picks its second entropy source at Launch (LaunchSpec.BeaconSource, frozen by I-6):
Before any provider is approved (randomness.add) a keeper must run that requests in the grace period for silent creators and fulfills bound rounds as soon as they are published (README "Randomness keeper").
A provider realm registers itself (its id is its package path, as for engines) and is usable only after the admin approves it through the timelocked op randomness.add; randomness.deprecate stops new launches, running collections finish with it. So a drand provider plugs in without a core redeploy. Its methods are declared in its own realm, so core calling them runs the provider with the provider's authority (interrealm v2 borrow rule #1): it cannot write core state, and with no cur it cannot call a core mutator.
Order with a provider (same guarantees as the committed beacon, SA-M1; CV-M1: the outcome never depends on who calls, or when):
A provider that panics aborts the calling transaction (a realm-boundary panic cannot be recovered); if an approved provider breaks, the admin deprecates it and, after the wait, Finalize stops calling it.