TapeFoundry Docs
Docs menu

Netlist format

Seven bytes per gate, a flat node space, and a topological constraint. This is the entire encoding.

Byte layout

OffsetSizeFieldMeaning
01 byteop0 = NAND, 1 = LATCH (pass-through)
13 bytesaFirst input node, big-endian
43 bytesbSecond input node, big-endian

Node numbering

Outputs are the last nOut nodes of the sequence. There is no separate output table; the ordering is the contract.

Evaluation

nodes = [0, 1] + inputs
for (op, a, b) in gates:
    x, y = nodes[a], nodes[b]
    nodes.append((1 - (x & y)) if op == 0 else x)

outputs = nodes[-nOut:]

NAND is 1 - (x AND y). LATCH passes x through, which is how a design can hold a value without introducing a new gate type.

A worked example

The first seven bytes of the ADD4 netlist are:

00 000002 000006
op=0 (NAND)   a=2   b=6

Node 2 is the first input, node 6 is the fifth input of a 9-input adder — the low bits of A and B. Its output becomes node 2 + 9 + 0 = 11.

Constraints

Size and cost

A 40-gate shifter is 280 bytes. A 2,118-gate multiplier is 14,826 bytes. The netlist is stored on chain as bytes, so tapeout gas scales with it, and so does the calldata of the tapeout transaction.

Why a flat list

It is the smallest encoding that can be decoded by a contract and re-executed by a browser without a compiler. There is no graph serialisation, no labels, no hierarchy — just gates in evaluation order.