One roll a day, and what you may pin

The roll. Each wallet may roll once per UTC day while supply remains, in two steps. commit spends your day, fixes your pins and pays the pin fee. Two blocks later reveal mixes the hash of the block after your commit with your address, your pins and the commit block into a 64-bit seed, the seed determines the ordinary traits: seven layers and five colours. The one-of-one result also depends on the remaining pool and supply when the reveal executes. Anyone may reveal for anyone. This site's keeper does it for you, so you sign once; a commit nobody reveals waits, and you can reveal it from your own wallet. A roll without pins has no mint fee; you pay the network gas of one transaction.

The pins. 12 things can be pinned: the seven layers (background, top, head, eyes, mouth, accessory, hair or hat) and five colours (skin, hair, ground, top, accent). Layers pin to common or uncommon items only; the pinnable skins are the eleven human tones; the fantasy tones are rare or legendary and come only from luck. Every other colour can be pinned. A pin fixes one trait or colour to a common or uncommon item; the first pin costs 0.0005 ETH and each additional pin doubles the total pin fee, up to 1.024 ETH for 12; network gas is extra: 0.0005, 0.001, 0.002 ETH for one, two, three pins. 95 percent of the fee goes to the author, 5 percent to the keeper wallet that pays gas for reveals and the treasury's rolls. Rare and legendary traits cannot be pinned.

The layers. 18 background, 14 top, 8 head, 16 eyes, 17 mouth, 24 accessory, 26 hair. Every item has a tier: common, uncommon, rare, legendary. The weight tables live in the contract; the rarity page lists each item's odds per roll. Skin, hair colour, top colour, ground and accent colour are drawn on top of that. 96,574,525,931,520 combinations before the one of ones.

The one of ones. 50 full drawings sit in a pool. Any roll, pinned or not, takes one with odds of pool left over tokens left: about 1 in 200 on the first roll, better as the end nears, so on average the whole pool is rolled by the last token. A one of one keeps the pinned background and ground colour and replaces every other pin; the pin fee is not returned. The contract removes a rolled one from the pool; each exists once. See what is left.

The treasury. The author's wallet gets one free roll a day too, with the same luck as everyone. Anyone may trigger it; the keeper does.

The image. A sprite is 32 by 32 pixels of roles, not colours: outline, fill, shade, light, a second fill, white. The token's palette turns roles into colours, so one hair sprite serves every hair colour. Layers composite bottom to top, a rim light lands where a fill sits right of an outline, and the result is one SVG of rects returned as a data: URI by the contract. This site shows the images; it does not hold them.

The seed, in full. The hash of the block after your commit does not exist when your commit is mined, so nobody, you included, can pick a commit block for a known result. The reveal is allowed only from two blocks after the commit, when that hash exists, and only while the chain still serves it, 256 blocks; past that anyone may call renew, which moves the commit to the current block and starts the two-block wait again, so an existing commitment can be recovered without using a missing hash. Always finish your pending roll before starting another, even after midnight UTC. A direct new commit can overwrite the previous one and permanently consume a supply reservation; this site checks for a pending roll before asking you to send. The token number is not in the seed, so ordinary traits do not depend on reveal order. One-of-one allocation does depend on reveal order, because earlier reveals change the remaining pool and supply. The first contract of this collection (two faces) had weaker rules; the repository documents them.

The end. Supply stops at 10,000, counting commits not yet revealed. The image rules can change for faces not yet rolled until the author locks them; a rolled face keeps its renderer forever.

Build it yourself

The generator is in the repository, in TypeScript and in Solidity, with a test that keeps the two byte for byte equal. The draw:

u64 mix(u64 x):
  x += 0x9e3779b97f4a7c15
  x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9
  x = (x ^ (x >> 27)) * 0x94d049bb133111eb
  return x ^ (x >> 31)

seed = keccak(blockhash(commitBlock + 1), wallet, pins, commitBlock) as u64
draw(i) = mix(seed + i) mod 10000
for slot in 0..6: item[slot] = walk(WEIGHTS[slot], draw(slot)), or the pin
skin = walk(SKIN_WEIGHTS, draw(7)), or the pin; hair colour, top colour, ground, accent = draw(8..11) mod count, or their pins
lucky = draw(12) < pool size * 10000 / tokens left; one = pool[draw(13) mod pool size]

Everything here is CC0. If you build on it, write to me.

Back to the roll. Every collection: onenft.click.