Skip to content
artsunami
HelpFormat

Generative art (code-driven)

Publish a single deterministic p5.js / Three.js / vanilla-JS script. Each token's hash is generated on-chain at mint time and rendered in a sandboxed iframe by every marketplace.

How it works

At mint time, the contract computes hash = keccak256(abi.encodePacked(blockhash(n-1), block.timestamp, tokenId, msg.sender, address(this))). That hash is the token's identity - your script reads tokenData.hash as a global, seeds its random number generator from it, and renders unique art for that specific mint. Same hash → same image, every time.

Hosting the script

The script is always pasted, and the contract stores it in ~24 KB SSTORE2 chunks - one transaction per chunk - then locks it. There is no IPFS option and no pin to keep alive: the artwork is reproducible from chain data alone. Marketplaces iframe a generator URL like /gen/[chain]/[contract]/[tokenId] which loads the script and runs it deterministically.

Finalizing

Until you call finalize(), you can update the script (fix bugs, polish parameters). After finalize(), the script is locked - no one, not even you, can change it. Collectors usually want this called before serious bidding starts.

Need a personalised answer?

Nami lives at the top of the Help center. It knows every topic in this center and can walk you through your specific collection, wallet or transaction.