Skip to content

Instantly share code, notes, and snippets.

@jonaprieto
Last active February 24, 2026 14:39
Show Gist options
  • Select an option

  • Save jonaprieto/a5583c394144e032bc02e2ea04a7790e to your computer and use it in GitHub Desktop.

Select an option

Save jonaprieto/a5583c394144e032bc02e2ea04a7790e to your computer and use it in GitHub Desktop.
Deploying RISC Zero Verifier + Protocol Adapter to BNB Smart Chain

Deploying RISC Zero Verifier + Protocol Adapter to BNB Smart Chain

Notes on deploying the Anoma Protocol Adapter (pa-evm) to BNB Smart Chain. This is a living doc — updated as we go.

Things to keep in mind

EVM version: osaka vs cancun

The pa-evm project targets evm_version = "osaka" in its Solidity compiler settings (Solidity 0.8.33). Osaka (also referred to as Fusaka in some contexts) is the upcoming Ethereum upgrade — not yet live on Ethereum mainnet, let alone other chains.

BNB Smart Chain supports Cancun opcodes since the Tycho hard fork (mid-2024). The latest BNB hard fork is Fermi (Jan 2026), which brought Pectra-level features and EVM Super Instructions, but not osaka/Fusaka.

Does this matter for us? Not really. We checked what EVM features the codebase actually uses:

  • ProtocolAdapter.sol uses ReentrancyGuardTransient (OpenZeppelin 5.5.0), which relies on TSTORE/TLOAD — these are Cancun opcodes (EIP-1153), not osaka.
  • RISC Zero contracts (Groth16Verifier, Router, EmergencyStop) only need basic EVM + BN256 precompiles. Nothing fancy.
  • No osaka-specific opcodes (like EOF) are used anywhere in the codebase.

So we just override with FOUNDRY_EVM_VERSION=cancun at deploy time. This is the same thing RISC Zero does when deploying to chains like Avalanche and Linea that don't support the latest EVM version.

RISC Zero verifier availability

RISC Zero has not deployed their verifier contracts on BNB Smart Chain. They support ~17 chains — BNB isn't one of them. We verified this by:

  1. Checking the RISC Zero docs — no BNB listed
  2. Checking their deployment.toml on GitHub — no BNB entry

So we're deploying the RISC Zero verifier stack ourselves, same as we did for Aurora. The pa-evm project already has the RISC Zero v3.0.1 contracts as Soldeer dependencies, and there's a test deployment script (contracts/test/script/DeployRiscZeroContracts.s.sol) that deploys the full stack.

What gets deployed (RISC Zero verifier stack)

Three contracts, in order:

  1. RiscZeroGroth16Verifier — the actual ZK proof verifier. Constructed with ControlID.CONTROL_ROOT and ControlID.BN254_CONTROL_ID (hardcoded constants for RISC Zero v3.0.1).
  2. RiscZeroVerifierEmergencyStop — wraps the verifier with a pause mechanism. A guardian address can emergency-stop all verification.
  3. RiscZeroVerifierRouter — the entry point. The ProtocolAdapter talks to this. It routes proof verification to the right verifier based on a 4-byte selector (0x73c457ba for v3.0.1).

The router address is what we'll later pass to the ProtocolAdapter deployment.

BNB Smart Chain network details

BNB Testnet BNB Mainnet
Chain ID 97 56
RPC (Alchemy) https://bnb-testnet.g.alchemy.com/v2/<KEY> https://bnb-mainnet.g.alchemy.com/v2/<KEY>
Explorer https://testnet.bscscan.com https://bscscan.com
Faucet https://www.bnbchain.org/en/testnet-faucet N/A

Alchemy API key required. BNB supports EIP-1559, so no --legacy flag needed (unlike Aurora).

BNB testnet faucet

The official BNB testnet faucet at https://www.bnbchain.org/en/testnet-faucet requires holding 0.002 BNB on mainnet. Alternatives:


Deployer wallet setup

Reusing the aurora-dev wallet created for Aurora deployments:

Deployer address: 0xcD5679555424B5132E1bAbE1FD965c44BF1dDb7b

Security note: This is a testnet-only dev wallet. For mainnet, use a hardware wallet or multisig.


Deployment log

Step 1: Deploy RISC Zero verifier to BNB Testnet ✅

PR: #479

Dry-run:

just risczero-simulate 0xcD5679555424B5132E1bAbE1FD965c44BF1dDb7b 0xcD5679555424B5132E1bAbE1FD965c44BF1dDb7b bnb-testnet

Actual deployment:

just risczero-deploy aurora-dev 0xcD5679555424B5132E1bAbE1FD965c44BF1dDb7b 0xcD5679555424B5132E1bAbE1FD965c44BF1dDb7b bnb-testnet --sender 0xcD5679555424B5132E1bAbE1FD965c44BF1dDb7b "--password="
Contract Address
RiscZeroGroth16Verifier 0xa052548fdbea6a8574f2a0dB582EA3286A6d9949
RiscZeroVerifierEmergencyStop 0xBbcD45801a3c3B858fbc66674FE7c9f94e33dC72
RiscZeroVerifierRouter 0x7C1B7b8fEB636eA9Ecd32152Bce2744a0EEf39C7

5 transactions total (3 creates + addVerifier + transferOwnership), all in block 92240773.

Total cost: 0.0002616799 BNB

Deployer/admin/guardian: 0xcD5679555424B5132E1bAbE1FD965c44BF1dDb7b

Note: Same addresses as Aurora testnet deployment — deterministic from same deployer nonce.

Step 2: Deploy ProtocolAdapter to BNB Testnet ✅

FOUNDRY_EVM_VERSION=cancun IS_TEST_DEPLOYMENT=true EMERGENCY_STOP_CALLER=0xcD5679555424B5132E1bAbE1FD965c44BF1dDb7b \
  just contracts-deploy aurora-dev bnb-testnet --sender 0xcD5679555424B5132E1bAbE1FD965c44BF1dDb7b "--password="
Contract Address
ProtocolAdapter 0x33d4F0c88ef555E105Ba5e5F1aFbF34d6f650964

Block: 92241607. Cost: 0.0009885864 BNB

Step 3: Verify contracts ⏳

just risczero-verify \
  0xa052548fdbea6a8574f2a0dB582EA3286A6d9949 \
  0xBbcD45801a3c3B858fbc66674FE7c9f94e33dC72 \
  0x7C1B7b8fEB636eA9Ecd32152Bce2744a0EEf39C7 \
  97
FOUNDRY_EVM_VERSION=cancun just contracts-verify-sourcify 0x33d4F0c88ef555E105Ba5e5F1aFbF34d6f650964 97
FOUNDRY_EVM_VERSION=cancun just contracts-verify-etherscan 0x33d4F0c88ef555E105Ba5e5F1aFbF34d6f650964 97
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment