Developer Docs

Build on BB84

BB84 is an experimental OP Stack L2 (chain ID 42069000) that eliminates ECDSA from all Layer 2 transactions. Instead of signing, users prove ownership by revealing hash-chain preimages — providing 128-bit post-quantum security against Grover's algorithm.

This document covers everything you need to interact with the network programmatically: the hash-scan CLI, the L1 ↔ L2 bridge flow, and the on-chain contract interfaces.

Quick Start

The fastest path to using BB84 is the BB84 Wallet app. L2 transactions are authorized by revealing hash-chain preimages, not by ECDSA signatures — browser wallets such as MetaMask cannot send transactions on BB84.

1

Get the BB84 Wallet

Install the BB84 Wallet for iPhone or iPad and create your wallet. It manages your one-time addresses (OTAs) and hash chains for you.

2

Deposit USDC or EURC from Ethereum

Use the BB84 app to deposit USDC or EURC from your Ethereum wallet to your L2 address (you only need a little ETH on Ethereum for the L1 gas). The deposit is an L1 transaction on OptimismPortalHash — no ECDSA signing required on L2.

Only USDC and EURC are supported. ETH sent to a name.bb84.eth username is not forwarded — see L1 → L2 Deposits.

3

Explore transactions

View blocks, transaction types, and stealth withdrawal details in the Block Explorer. Hash commitment (COMMIT) and reveal (REVEAL) transactions are decoded inline.

Network parameters for your own tools (JSON-RPC queries, explorers, indexers):

Network Name:  BB84
RPC URL:       https://bb84.com/rpc   # access key required, see below
Chain ID:      42069000
Currency:      ETH   # native gas token only — payments use USDC/EURC
Explorer:      https://bb84.com/explorer
🔑
The RPC endpoint is not open. https://bb84.com/rpc only accepts JSON-RPC POST requests that carry an X-Onyx-Key header; requests without it are rejected with HTTP 403 (Unauthorized). To request access for your project, contact us via the support button. Use the Block Explorer or the status page for public chain data.
4

Use the CLI for full OTA access

hash-scan creates One-Time-Address (OTA) wallets and interacts with the chain without ECDSA signing. The current version is outdated and does not work against the live network — see the note under Installation.

Installing hash-scan

hash-scan is a standalone CLI for BB84. It manages OTA wallets, scans for incoming stealth payments, and submits hash-chain transactions — no Ethereum private key required on L2.

⚠️
Outdated — do not use against the live network. The current hash-scan version and the commands in this section (generate, scan, spend, status, withdraw, propose-output) are not compatible with the current BB84 mainnet: the CLI does not send the X-Onyx-Key header the RPC endpoint requires, and its token withdrawal uses an initiateTokenWithdrawalHash encoding the L2ToL1MessagePasserHash predeploy no longer accepts, so the withdrawal would revert. The examples below are kept for reference until a corrected release is published. Use the BB84 Wallet for payments and withdrawals.

Pre-built binaries

There is currently no official pre-built hash-scan binary. Do not download or run hash-scan binaries from any other source — the official source code lives only in the github.com/Hadamard organization.

Build from source

git clone -b feat/hash-only-l2 https://github.com/Hadamard/OP
cd OP/cmd/hash-scan
go build -o hash-scan .
# Requires Go 1.22+. Only dependency: golang.org/x/crypto

Verify

./hash-scan version
# hash-scan v0.1.0 — BB84 OTA wallet & bridge CLI

generate — Create an OTA Wallet

An OTA (One-Time-Address) wallet contains a spend key and a scan key. For each incoming payment, a fresh stealth address is derived deterministically. Spend keys never leave your machine.

./hash-scan generate \
  --rpc      https://bb84.com/rpc \
  --chain-id 42069000 \
  --wallet   wallet.json

This creates wallet.json with 10 pre-generated OTAs and a 10-step hash chain per OTA. Keep this file safe — it contains your spend keys.

⚠️
Never commit wallet.json to git. The file contains unencrypted spend keys. Encryption support is on the roadmap.

Wallet file format

{
  "chain":   42069000,
  "otas": [
    {
      "ota_addr":      "0xabcd...",    // stealth address for this OTA slot
      "spend_sk":      "0x1234...",    // SHA-256 chain seed
      "chain_depth":   10,             // remaining spend steps
      "withdraw_count":0              // number of withdrawals initiated
    },
    ...
  ]
}

scan — Find Incoming Payments

Scan the chain for stealth payments directed to your OTA wallet. The scanner checks each OTA address for incoming deposit transactions and hash commitments.

./hash-scan scan \
  --rpc    https://bb84.com/rpc \
  --wallet wallet.json

Output example:

OTA 0  0xabcd...  balance: 25.00 USDC  chain: 10/10  commits: 0
OTA 1  0xef12...  balance: 0.00 EURC  chain: 10/10  commits: 0

spend — Send USDC or EURC

Spend USDC or EURC from a token OTA (created with generate --token <L2 token>) by revealing the next hash-chain preimage. Each spend consumes one chain step. The transaction is a HashRevealTx (0x7F) on L2.

./hash-scan spend \
  --rpc    https://bb84.com/rpc \
  --wallet wallet.json \
  --ota    0xYourOTAAddress \
  --to     0xRecipientAddress \
  --token-amount 5000000   # raw units: 5 USDC (6 decimals)
ℹ️
No gas needed. Every hash transaction on BB84 is gas-free, including merchant payments. The chain depth decrements on each spend — once depleted, generate a new OTA slot.

Under the hood

A spend submits two transactions in sequence:

  1. HashCommitTx (0x7C) — commits the hash of the preimage
  2. HashRevealTx (0x7F) — reveals the preimage, executing the transfer

The two-step commit/reveal prevents front-running of preimage revelation.

status — Check Balance and Chain Depth

./hash-scan status \
  --rpc    https://bb84.com/rpc \
  --wallet wallet.json

Output:

Chain ID:  42069000
OTAs:      10 total, 2 with balance

  #0  0xabcd...  25.00 USDC  chain 8/10 (2 spends used)
  #1  0xef12...  10.00 EURC  chain 10/10
  ...

withdraw — Bridge USDC/EURC to L1

Withdrawals are a multi-step process taking at least 7 days end-to-end (proof maturity delay). You need an Ethereum EOA with ETH for gas.

⚠️
Do not run these steps with the current version. Its token withdrawal call reverts on the live predeploy (see the note above). Withdraw USDC/EURC with the BB84 Wallet instead.

Step 1 — Initiate withdrawal on L2

./hash-scan withdraw initiate \
  --rpc       https://bb84.com/rpc \
  --wallet    wallet.json \
  --ota       0xYourOTAAddress \
  --l2-token  0x50590EE131EdC98a7213c91Ae82e3e8987B9b5eE \
  --l1-token  0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 \
  --token-amount 5000000 \
  --l1-target 0xYourL1Address

This submits a HashRevealTx calling initiateWithdrawalHash on the L2ToL1MessagePasserHash predeploy. Note the L2 block number in the output.

Step 2 — Propose output root

The auto-proposer runs every 10 minutes, but you can also propose manually for a specific block:

./hash-scan propose-output \
  --l2-rpc  https://bb84.com/rpc \
  --factory 0xd9714767f876e2f709ab4d0398c66667a3a0de5b

# Then submit with cast:
cast send 0xd9714767... "create(uint32,bytes32,bytes)" \
  1000 <OutputRoot> <ExtraData> \
  --private-key $PROPOSER_KEY --rpc-url $L1_RPC

Step 3 — Prove the withdrawal on L1

./hash-scan withdraw prove \
  --l2-rpc      https://bb84.com/rpc \
  --l1-rpc      $L1_RPC \
  --factory     0xd9714767f876e2f709ab4d0398c66667a3a0de5b \
  --portal      0x83226921d6afb31f706b7840bca12655396f136c \
  --wallet      wallet.json \
  --ota         0 \
  --private-key $L1_KEY

This constructs the Merkle proof for the withdrawal and calls proveWithdrawalTransactionHash on OptimismPortalHash.

Step 4 — Wait for maturity delay

After proving, wait 7 days for the proofMaturityDelaySeconds.

Step 5 — Finalize on L1

./hash-scan withdraw finalize \
  --l2-rpc      https://bb84.com/rpc \
  --l1-rpc      $L1_RPC \
  --portal      0x83226921d6afb31f706b7840bca12655396f136c \
  --wallet      wallet.json \
  --ota         0 \
  --private-key $L1_KEY

The USDC/EURC is released from OptimismPortalHash to --l1-target.

L1 → L2 Deposits

BB84 uses a custom OptimismPortalHash contract on Ethereum. The BB84 hardfork disables direct L2 ECDSA transactions, so the only way to fund an L2 address is via a deposit transaction from L1.

Supported assets

BB84 supports USDC and EURC (6 decimals each). ETH is only needed on Ethereum to pay L1 gas for deposits and withdrawals.

AssetL1 token (Ethereum)L2 token (BB84)
USDC0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB480x50590EE131EdC98a7213c91Ae82e3e8987B9b5eE
EURC0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c0x47dbBf8233cd91C16360bDb69e325f771FD9A667

Deposit to an OTA

Approve the portal, then call depositWithStealthToken. The deposit is included on L2 within minutes.

# 1. allow the portal to pull 25 USDC
cast send 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 "approve(address,uint256)" \
  0x83226921d6afb31f706b7840bca12655396f136c 25000000 \
  --private-key $L1_KEY --rpc-url $L1_RPC

# 2. bridge it to the OTA
cast send 0x83226921d6afb31f706b7840bca12655396f136c \
  "depositWithStealthToken(address,bytes32,uint32,bytes32,uint64,address,address,uint256)" \
  <ota_addr> <ota_commitment> <chain_length> <ephemeral_r> 500000 \
  0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 0x50590EE131EdC98a7213c91Ae82e3e8987B9b5eE 25000000 \
  --private-key $L1_KEY --rpc-url $L1_RPC
ℹ️
hash-scan fund-token --ota <ota_addr> --amount 25000000 --portal 0x83226921d6afb31f706b7840bca12655396f136c prints both calldatas with the OTA's commitment, chain length and a fresh ephemeral_r filled in.

Deposit to a username

Any Ethereum wallet can send USDC or EURC directly to name.bb84.eth; it is forwarded to the owner's OTA within about 5–15 minutes. Send only USDC or EURC — ETH and other tokens sent to these addresses are not forwarded.

L2 → L1 Withdrawals

Withdrawals follow the standard OP Stack fault-proof flow, adapted for hash-chain authentication.

StepActionChainDelay
1Call initiateWithdrawalHash on L2ToL1MessagePasserHashL2—
2Submit output root to DisputeGameFactory (game type 1000)L1auto-proposer ~10 min
3Call proveWithdrawalTransactionHash on OptimismPortalHashL1after step 2
4Wait proofMaturityDelaySeconds—7 days
5Call finalizeWithdrawalTransactionHashL1after step 4

initiateWithdrawalHash parameters

The L2 predeploy is at 0x4200000000000000000000000000000000000043. The function signature:

function initiateWithdrawalHash(
  bytes32  l2Commitment,      // hash commitment of the preimage
  bytes32  withdrawNullifier, // unique nonce preventing replay
  address  l1Target,          // Ethereum address to receive the funds
  uint256  gasLimit,          // L1 execution gas limit
  bytes    extraData          // optional calldata for l1Target
)

Output root format

The output root committed to DisputeGameFactory is:

outputRoot = keccak256(
  version        // bytes32(0)
  ‖ stateRoot    // L2 block stateRoot
  ‖ storageRoot  // L2ToL1MessagePasserHash storage root
  ‖ blockHash    // L2 block hash
)

Use hash-scan propose-output to compute this automatically from the L2 RPC.

Transaction Types

BB84 introduces two new EIP-2718 transaction types alongside the standard OP Stack deposit type:

TypeHexNameDescription
COMMIT 0x7C HashCommitTx Commits keccak256(preimage) to a nullifier tree slot. Required before revealing.
REVEAL 0x7F HashRevealTx Reveals the preimage, executing the encoded L2 action (transfer, withdrawal, etc.).
DEPOSIT 0x7E DepositTx Standard OP Stack deposit transaction derived from OptimismPortalHash events on L1.

Why two steps?

The commit/reveal pattern prevents front-running: a sequencer cannot steal a withdrawal by racing to reveal the preimage because the commitment is already included before the preimage is known.

HashRevealTx calldata encoding

For a withdrawal initiation, the reveal calldata encodes the initiateWithdrawalHash ABI call:

// selector: keccak256("initiateWithdrawalHash(bytes32,bytes32,address,uint256,bytes)")[:4]
0x4cc0963c
  l2Commitment       // bytes32
  withdrawNullifier  // bytes32
  l1Target           // address (right-padded to 32 bytes)
  gasLimit           // uint256
  extraData offset   // uint256 (= 0xa0)
  extraData length   // uint256
  extraData bytes    // padded to 32-byte boundary

Contract Addresses

L1 (Ethereum)

L2 Predeploys (chainId 42069000)

ℹ️
Click any address to copy it. All L2 predeploys are fixed at the addresses above across all OP Stack chains using the BB84 hardfork.

Network Parameters

ParameterValue
Chain ID42069000
L2 Block Time2 seconds
L1 (Ethereum) Chain ID1
Proof Maturity Delay7 days
Dispute Game Finality Delay7 days
Output Proposal Interval~10 minutes (auto-proposer)
Sequencer Drift600 seconds
Channel Timeout300 seconds
Max Sequencer Drift600 seconds
Game Type (HashOutputOracle)1000
Currency SymbolETH (native gas token; payments use USDC/EURC)
RPChttps://bb84.com/rpc (POST only, X-Onyx-Key header required — access)
Block Explorerhttps://bb84.com/explorer

Hardfork activation

ForkActivation
RegolithGenesis (t=0)
CanyonGenesis (t=0)
DeltaGenesis (t=0)
EcotoneGenesis (t=0)
FjordGenesis (t=0)
GraniteGenesis (t=0)
HoloceneGenesis (t=0)
BB84 (ECDSA-free)Genesis (t=0)

FAQ

What is BB84?

BB84 is an experimental OP Stack Layer 2 rollup on Ethereum mainnet (chain ID 42069000). It removes ECDSA from every L2 transaction: transfers are authorized by revealing hash-chain pre-images instead of elliptic-curve signatures.

Why is BB84 considered post-quantum secure?

A large quantum computer running Shor's algorithm could derive private keys from ECDSA public keys. BB84 authorizes L2 transactions with hash commitments only, and hash functions are not broken by Shor's algorithm. Deposits from Ethereum still start from your regular L1 wallet.

Which assets can I use on BB84?

USDC and EURC. You can bridge them between Ethereum and BB84 and send them to usernames such as name.bb84.eth or to one-time addresses.

How long does a withdrawal to Ethereum take?

At least 7 days. After a withdrawal is proven on Ethereum, the proof maturity delay of 7 days must pass before it can be finalized. Deposits from Ethereum arrive within minutes.

How do I get started?

Install the BB84 Wallet for iOS, create your keys and deposit USDC or EURC from Ethereum. Developers can connect their app to the wallet via bb84.com/developers.

Impressum·Privacy·Terms