Tapebox

Documentation

Tapebox docs

Tapebox is a free fork of X Layer mainnet running the real TapeOut contracts. You build digital logic circuits out of NAND and LATCH transistors, “tape them out” on chain as NFTs, and run them — all with free tokens that never touch mainnet. This page is the tour: what each part does and how it fits together.

What is Tapebox#

Making a real chip means taping out: sending a finished design to a fab. It is expensive and gated. Tapebox makes that same idea a cheap, permissionless primitive — a circuit you tape out here is a real on-chain transaction that mints an NFT, for a fraction of a cent.

Two ways it runs, shown by the badge in the top-right of the header:

  • fork · 196 — a real fork of X Layer (chain 196). Tape-outs are genuine on-chain transactions against the TapeOut contracts. This is what a local tapebox up gives you.
  • mock — the hosted demo with no fork configured. The same rules run in an in-browser sandbox, so everyone gets a private, zero-setup playground. Your state lives in your browser.
Either way, nothing here touches mainnet and sandbox tokens are worth nothing. Break things freely.

The sandbox, page by page#

The header links across the top are the whole app. Here is what each one is for:

The header also shows your current balances (NAND · LATCH · OKB) and your wallet. On the hosted site that wallet is a burner generated in your browser, so you never need MetaMask — though you can connect OKX Wallet or MetaMask from the menu if you want.

Core concepts#

Four ideas and you have the whole model:

  • Transistors. NAND and LATCH are the raw material — ERC-1155 tokens you hold in your wallet. A circuit spends them, like real silicon: one NAND per gate, one LATCH per latch.
  • The tape-out. Pressing Tape out sends one transaction that burns those transistors plus a 0.0013 OKB fee and mints your circuit as an NFT with an on-chain id.
  • Running it. eval() reads the outputs for a set of inputs. step() advances one clock beat (for circuits with latches). Both are free read calls — no tokens, no fee.
  • Everything is logged. Faucet drips, tape-outs and beats all show up in the Explorer.

Writing circuits (TNL)#

Circuits are written in a tiny text netlist language, one statement per line. There are only four keywords:

input a b          # declare named inputs
nand y a b         # a NAND gate named y, from wires a and b
latch q d          # a latch: each beat, q takes the value of d
output y           # declare an output

Everything is built from NAND, because NAND alone can make every logic gate. For example, XOR is four NANDs:

input a b
nand n1 a b
nand n2 a n1
nand n3 b n1
nand y  n2 n3
output y

The diagram redraws as you type. Click any input to flip it and watch the signal move through the gates; the Truth table tab shows every input combination at once.

Memory and clocks. A plain latch q d copies d into q every beat. Add an enable — latch q d en — and q only updates when en is 1. Any feedback loop must pass through a latch (combinational loops are rejected). Use step() to clock these one beat at a time and watch the state evolve.

Pick a ready-made circuit from the dropdown at the top-right of the Netlist panel (half adder, XOR, a latch, and more) to see working examples.

Your first chip in 60 seconds#

  1. Open the Faucet and click Get test transistors. Your balances jump to 1000 NAND, 100 LATCH and 100 OKB.
  2. Go to the Playground and type a netlist (or keep the preset). Watch the diagram and the Cost line.
  3. On the Run on sandbox tab, press Tape out on the sandbox. Your NAND and LATCH tick down and a transaction hash appears — your circuit is now an NFT.
  4. Toggle the inputs and press eval() to read the outputs on chain (it checks against the diagram), or step() to run a beat and fill the beat log.
  5. Open the Explorer to see your tape-out in the feed.

Faucet & wallet#

The Faucet funds your current wallet with 1000 NAND, 100 LATCH and 100 OKB (OKB covers the tape-out fee). There is a per-address rate limit; when you hit it, the button shows a live countdown until your next drip is available.

Your wallet is a burner stored only in this browser. Need a clean slate? Hit New burner on the faucet page for a fresh address with its own allowance. You can also connect a real injected wallet (OKX Wallet / MetaMask) from the header menu — on a fork, the app checks it is pointed at chain 196 before letting you send.

Explorer#

The Explorer is the activity feed for the whole sandbox: every faucet drip, tape-out and beat. It is interactive:

  • Click a chip to open its detail — its netlist and a live eval/step panel, so you can re-run any circuit without leaving the page.
  • Click a transaction hash to copy it.

Reports#

Reports renders the JSON that tapebox test produces — truth tables and beat sequences with pass/fail, the same output your CI posts. Drop in a report (there is a sample to try) to see how a passing or failing run looks.

From your own code#

Everything the site does is in the published CLI and library. Run your own fork with free tokens and point your project at it:

npm i -g @zevbuilds/tapebox     # or: npx @zevbuilds/tapebox <cmd>
tapebox up                      # local fork on :8545, dev accounts funded
tapebox fund 0xYourAddress      # 100 OKB, +1000 NAND, +100 LATCH

Tape out straight from code against the real Circuits contract:

import { DEFAULT_CPU, circuitsAbi } from '@tapebox/shared';
// tapeout(netlist, inputs, outputs), paying the 0.0013 OKB fee
await wallet.writeContract({
  address: DEFAULT_CPU.circuits, abi: circuitsAbi, functionName: 'tapeout',
  args: ['0x00000002000003', 2, 1], value: 1_300_000_000_000_000n,
});

Put truth tables and beat sequences in tapebox.config.ts and run tapebox test. The same command runs in CI on every pull request, and Reports renders its output:

# .github/workflows/chips.yml
- run: npx @zevbuilds/tapebox test --junit results.xml

Good to know#

  • Your work is saved. The playground keeps your netlist and toggled inputs in this browser, so a refresh — or leaving the page and coming back — picks up exactly where you left off.
  • eval() vs step(). Use eval() for combinational circuits; use step() when there are latches and you want to advance the clock one beat at a time.
  • Reading the on-chain format. A netlist is a list of records: a NAND is 7 bytes (00 then two 3-byte wire numbers), a latch is 4 bytes (01 then its input wire). Wires 0 and 1 are constant 0 and 1, inputs start at wire 2, each record drives the next wire, and the outputs are the last wires. The playground lays this out for you.
  • Nothing is real money. Sandbox tokens have no value and nothing touches mainnet.

Ready? Grab tokens from the Faucet and build something in the Playground.