GL1X · GenesisL1 explorer

GL1X docs · Dapps

CIPNFT: encrypted NFTs

CIPNFT (Cryptographic Information Protocol NFT, cipnft.com, source at github.com/GenesisL1/cipnft) turns knowledge and intellectual property into NFTs whose content is encrypted in the minter's browser and stored, as ciphertext, in the contract itself. The owner can always decrypt a token with their wallet key; a minter may also give a token a view key, a secret anyone can be given to read it without owning it.

GL1X has a CIPNFT dapp: it lists the tokens from the contract's state and opens a token's content with its view key, in the browser. The view key and the plaintext never reach the explorer.

PartWhere
Contract0x05e4F1929947bE93a853F2de155fc1d6137f8446 on GenesisL1 (chain id 29)
In the explorer/dapps/cipnft (the tokens), /dapps/cipnft/{id} (a token, its view key box)
APIGET /api/cipnft, GET /api/cipnft/tokens, GET /api/cipnft/tokens/{id}
SettingGL1X_CIPNFT_CONTRACT (the contract; off: no CIPNFT dapp)

In the explorer #

The tokens (/dapps/cipnft, CIPNFT in the Dapps menu): every minted token, newest first, with its public title, number, owner, encryption mode (classic or post-quantum), the size of its content, whether it is on sale and at what price, and the first bytes of its ciphertext. On sale keeps the tokens listed on the CIPNFT marketplace; Token # opens one by number.

A token (/dapps/cipnft/{id}):

  • Open the content: paste the view key and press Decrypt. The content appears below, formatted when it is JSON, with Copy and Save; the three checks that passed are listed under it. A wrong key says so; a token whose minter enabled no view key says that only its owner can decrypt it.
  • On chain: owner, encryption mode, content and envelope sizes, the data-key commitment (dekHash), the terms version accepted at mint, the listing, and links to the token's NFT page (transfers) and the marketplace.
  • Ciphertext: the encrypted content exactly as stored, to copy or inspect.

The page keeps nothing: the key field is not saved, not autocompleted, and cleared with the page; nothing is written to the browser's storage.

How a token is encrypted #

The scheme is CIPNFT's own (cipnft.js and cipnft.sol of its repository), built on libsodium primitives and specified in its whitepaper:

PartWhat it is
DEKa random 32-byte data key, one per token
metaCiphernonce (24 bytes) ‖ XChaCha20-Poly1305 (IETF) of the UTF-8 content (at most 64 KiB) under the DEK, tag included; associated data abi.encodePacked(uint256 chainId, address contract), 52 bytes, so a ciphertext cannot be replayed to another chain or contract
ownerEncDEKthe DEK sealed to the owner. Classic: an 80-byte libsodium sealed box to the owner's X25519 key. Post-quantum: ML-KEM-768 (a 1,088-byte KEM ciphertext, a nonce and the DEK wrapped with XChaCha20-Poly1305 under the shared key: 1,160 bytes)
viewWrapoptional: nonce (24) ‖ XChaCha20-Poly1305 of the DEK (72 bytes in all), no associated data, under BLAKE2b-256(UTF-8 view key) (libsodium crypto_generichash, 32 bytes, unkeyed)
dekHashkeccak256(DEK): the contract's commitment to the data key

A sale re-wraps the DEK to the buyer: the seller delivers the new envelope, the buyer checks it against dekHash, and only then is the token transferred and the escrowed payment released (the marketplace's two-step finalize). The ciphertext never changes.

Decrypting with a view key #

In the page, with @noble/ciphers and @noble/hashes (dependency-free JavaScript, MIT):

  1. key = BLAKE2b-256(view key). A key pasted with surrounding spaces or a line break is tried as typed, then trimmed.
  2. DEK = XChaCha20-Poly1305-open(key, viewWrap). A wrong key fails the Poly1305 tag: This view key does not open the token.
  3. keccak256(DEK) = dekHash, the commitment stored at mint. A key that opens the wrap but gives another data key is refused.
  4. content = XChaCha20-Poly1305-open(DEK, metaCipher, AAD) with the chain id and the contract as associated data. A token minted before the minter's wallet reported its chain has no associated data; the page then opens it without and says so. A content that fails its tag was altered.

The explorer's code was checked against libsodium itself: test vectors made with PyNaCl 1.5.0 (crypto_aead_xchacha20poly1305_ietf, BLAKE2b) and Keccak-256 decrypt to their plaintexts, and wrong keys, missing wraps, a wrong commitment and an altered ciphertext each give their own error.

How the tokens are found #

The contract has no total supply and does not enumerate its tokens, so GL1X asks ownerOf for ids from 1 upward, a hundred per JSON-RPC batch, past the highest id its own index has seen in the contract's transfers, until 64 ids in a row are not minted. Burned tokens are holes and are skipped. Each page then reads getTokenCard for its tokens in one batch, and a token page reads getTokenCard, getTokenData, ownerOf and getEraseState. The list is kept for a minute, pages and tokens for 30 seconds.

API #

curl -s https://YOUR-DOMAIN/api/cipnft                       # the contract, token count, listings, fees, the scheme
curl -s 'https://YOUR-DOMAIN/api/cipnft/tokens?page=1&limit=24' # newest first; listed=1 for tokens on sale
curl -s https://YOUR-DOMAIN/api/cipnft/tokens/1              # one token with its ciphertext and view-key wrap

A token answers with token_id, title, owner, enc_mode (classic or pqc), listed, price_wei and price (L1), cipher_bytes, plaintext_bytes, owner_envelope_bytes, dek_hash, tos_version, erase (an erase in progress), meta_cipher, view_key (whether a view key was enabled) and view_wrap (or null), associated_data (the 52 bytes of AAD) and encryption, the scheme in words. A token that is not minted answers 404 cipnft_token_not_found; with the dapp off, 404 cipnft_disabled.

Agents reach these routes with the MCP tool api_request (see MCP). Decryption stays on the agent's side: a view key is a secret, and the explorer neither asks for one nor accepts one.

Settings #

SettingDefaultWhat it does
GL1X_CIPNFT_CONTRACT0x05e4F1929947bE93a853F2de155fc1d6137f8446the CIPNFT contract the dapp reads; off turns the dapp off

The reads go to GL1X_EVM_LIVE_RPC, as every other page read does.

CIPNFT itself (the contract and its dapp at cipnft.com) is a separate project under the MIT License; GL1X implements its published decryption scheme and does not include its code.

GL1X is a live explorer of the GenesisL1 blockchain. Turn on JavaScript for search, charts and interactive views.