TapeFoundry Docs
Docs menu

Tapeout and claim

The exact calldata, the value rule, and what the processor and registry each verify.

tapeout(bytes netlist, uint32 nIn, uint32 nOut)

Selector 0x7bd3ac1d. The arguments are ABI-encoded with the dynamic bytes in the tail:

0x7bd3ac1d
  word 0  0x60            offset to netlist
  word 1  nIn             inputs
  word 2  nOut            outputs
  word 3  length          netlist byte length
  tail    netlist bytes, right-padded to 32 bytes

For a 46-gate adder the calldata is 970 characters: 4 selector bytes, four head words, and 704 bytes of padded netlist.

The value rule

msg.value must equal the tapeout fee exactly — 0.0002 BNB. The processor does not refund a surplus and does not accept a shortfall. The frontend sends the value as a hex string; wallets that receive a decimal string may reformat it incorrectly.

What the processor does

  1. Decodes the netlist and counts its gates.
  2. Burns that many NAND tokens from msg.sender.
  3. Mints an ERC-721 to msg.sender.
  4. Stores the netlist bytes and (nIn, nOut, gates) under the new id.

No drawing id is passed. The processor does not know which design a netlist is supposed to be — that check happens later, at claim.

claim(uint16 epoch, uint8 drawingId, address cpu, uint256 circuitId)

Selector 0x3067781e. The registry:

  1. Reads the circuit's netlist from cpu.
  2. Hashes it with keccak256.
  3. Compares the hash with the drawing registered for (epoch, drawingId).
  4. Increments the drawing's minted counter and writes the edition.
ConditionResult
Hash does not match the drawingRevert
Drawing is at its capRevert
Circuit already claimedRevert
Caller is not the circuit ownerRevert

Ordering

Edition numbers follow transaction order within a block. Two claims in the same block are ordered by their position in the block, not by gas price beyond that.

Why claim is separate

It is the only step that needs the drawing registry, and the registry is per-epoch. Keeping it separate lets a circuit exist without a number — for example if a tapeout succeeds and the claim is skipped — without corrupting the count for the drawing.