battlechain

Deploy and verify smart contracts on BattleChain L2 with Safe Harbor agreements and attack-mode workflows.

1|Updated Sep 4, 2025
One-click install
npx skills add https://github.com/FuzzysTodd/The-Nexus-Protocol-Token-DAO --skill battlechain-fuzzystodd
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: battlechain
Source: https://github.com/FuzzysTodd/The-Nexus-Protocol-Token-DAO/tree/main/skills/battlechain
Command: npx skills add https://github.com/FuzzysTodd/The-Nexus-Protocol-Token-DAO --skill battlechain-fuzzystodd

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Deploying audited smart contracts directly to mainnet skips a critical battle-testing phase where real funds are at stake. This Skill guides developers through BattleChain, a ZKSync-based L2 that inserts a live-fire testing stage between testnet and mainnet, where whitehats legally attack contracts under Safe Harbor agreements for bounties. ## Core Features & Use Cases - Deterministic Deployment: Use battlechain-lib helpers (bcDeployCreate, bcDeployCreate2, bcDeployCreate3) to deploy contracts via CreateX or BattleChainDeployer across 190+ EVM chains. - Safe Harbor Agreements: Create and adopt Safe Harbor agreements with correct scope and URI per chain, then request attack mode to enter the battle-testing phase. - Contract Verification: Verify contracts on BattleChain's custom block explorer API using forge verify-contract or the bundled justfile targets (bc-verify, bc-deploy-verify). - Use Case: A DeFi team finishes their audit, deploys their vault contracts to BattleChain testnet (chain 627), creates a Safe Harbor agreement, gets attack mode approved via the permissionless MockRegistryModerator, and lets whitehats probe the contracts before promoting to mainnet. ## Quick Start Install cyfrin/battlechain-lib with forge, then ask the assistant to deploy my Foundry contract to BattleChain testnet and create a Safe Harbor agreement for it.

Frequently Asked Questions about battlechain

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I deploy a smart contract to BattleChain with Foundry?▼

Install cyfrin/battlechain-lib with forge install, add the remapping to foundry.toml, and inherit BCScript or BCDeploy in your script. Run forge script with --skip-simulation and optionally -g 300 to avoid gas estimation errors on BattleChain.

What is a Safe Harbor agreement on BattleChain?▼

A Safe Harbor agreement is an on-chain legal framework that lets whitehats attack your deployed contracts for bounties without legal risk. Use defaultAgreementDetails and createAndAdoptAgreement from battlechain-lib to create one with the correct scope and URI per chain.

How do I verify contracts on the BattleChain block explorer?▼

Run forge verify-contract with --chain-id 627, --verifier-url pointing to the block explorer API, --verifier custom, and any non-empty API key string. The battlechain-lib justfile also provides bc-verify and bc-verify-broadcast targets.

Why does my BattleChain deployment fail with a gas_limit error?▼

The AnyTxType(2) missing gas_limit error means your contract exceeds the 24,576-byte EVM size limit, so gas estimation fails. Check sizes with forge build --sizes, then split the contract, raise optimizer runs, or compile with --via-ir.

Can I approve my own attack mode request on BattleChain?▼

On testnet (chain 627), yes: the permissionless MockRegistryModerator at 0x3DdA228A38b4d7438bBF5D5137c8D1090DcaF6bF lets anyone call approveAttack. On mainnet (chain 626), approval is a controlled DAO action by the Registry Moderator.

Does battlechain-lib work on chains other than BattleChain?▼

Yes, deployment helpers and agreement creation work on 190+ EVM chains via CreateX at 0xba5Ed. Only requestAttackMode is BattleChain-specific and reverts with BCSafeHarbor__NotBattleChain on other chains.