Skip to content

contracts:deploy

Deploy a contract from raw creation bytecode. Binds the predicted address to . Mirror an existing deployment with --mirror-chain / --mirror-address (fetches the original creation bytecode from Etherscan).

Supports runtime fields inside smart blocks. Use explicit @helper! expressions or captured outputs; other fields are evaluated at build time.

contracts:deploy <variable> [bytecode]
NameTypeEvaluationDescription
variablevariableBuild timeVariable to bind the deployed contract address to
[bytecode]bytesRuntime in smart blocksCreation bytecode (runtime values require --create3). Constructor args are appended automatically when --constructor is set. Omit when using --mirror-chain / --mirror-address to mirror an existing deployment.
NameTypeEvaluationDescription
--mirror-chainchainBuild timeChain (id or viem name like optimism) to fetch the creation bytecode from (Etherscan V2). Defaults to the current chain when only --mirror-address is set. Requires --mirror-address.
--mirror-addressaddressBuild timeAddress of an existing deployment to mirror. The original creation bytecode (with constructor args already appended) is fetched from Etherscan and used as the init code for this deployment.
--constructorstringBuild timeConstructor signature like constructor(uint256,address). Requires --constructor-args. Mutually exclusive with --mirror-address.
--constructor-argsarrayRuntime in smart blocksConstructor arguments as an array literal, e.g. [100e18 @me true]. Requires --constructor; runtime inputs require --create3.
--create2bytes32Build timeSalt for CREATE2 deployment. Defaults to the Arachnid deterministic deployer; override factory with --via.
--create3bytes32Build timeSalt for CREATE3 deployment. Defaults to the CreateX factory; override with --via.
--viaaddressBuild timeOverride the default factory address used by --create2 / --create3.
--fromaddressBuild timeDeprecated: run the command inside switch --as <address> ( … ). Sender address. Defaults to the acting account. For plain CREATE this is also the prediction deployer.
--valuenumberRuntime in smart blocksETH to send with the deployment (in wei)
--gasnumberBuild timeGas limit
--max-fee-per-gasnumberBuild timeMax fee per gas (EIP-1559)
--max-priority-fee-per-gasnumberBuild timeMax priority fee per gas (EIP-1559)
--noncenumberBuild timeTransaction nonce override. For plain CREATE deployments it also pins the predicted contract address.
load contracts
# Plain CREATE deployment from raw bytecode
contracts:deploy $addr 0x6080604052348015600f57600080fd5b50603f80601d6000396000f3fe
# Deploy with constructor arguments
contracts:deploy $token 0x6080604052348015600f57600080fd5b50603f80601d6000396000f3fe --constructor "constructor(string,string,uint8)" --constructor-args ["My Token" "MTK" 18]
# CREATE2 via the Arachnid deterministic deployer (default)
contracts:deploy $vault 0x6080604052348015600f57600080fd5b50603f80601d6000396000f3fe --create2 0x0000000000000000000000000000000000000000000000000000000000000001
# CREATE2 via a custom factory (must accept salt || initCode calldata)
contracts:deploy $vault2 0x6080604052348015600f57600080fd5b50603f80601d6000396000f3fe --create2 0x0000000000000000000000000000000000000000000000000000000000000001 --via 0x4e59b44847b379578588920ca78fbf26c0b4956c
# CREATE3 via the CreateX factory (default)
contracts:deploy $proxy 0x6080604052348015600f57600080fd5b50603f80601d6000396000f3fe --create3 0x0000000000000000000000000000000000000000000000000000000000000002 --constructor "constructor(address)" --constructor-args [@me]
# Mirror an existing deployment from another chain — fetches the
# original creation bytecode (with constructor args already baked in)
# from Etherscan and replays it byte-for-byte on the current chain.
contracts:deploy $clone --mirror-chain 1 --mirror-address 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
# Same flow, deterministically pinned to a CREATE2 address so the
# clone lands at the same address on every chain that runs this script.
contracts:deploy $clone2 --mirror-chain 1 --mirror-address 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 --create2 0x0000000000000000000000000000000000000000000000000000000000000003
# Use the bound address in subsequent calls
exec $token "transfer(address,uint256)" @me 1e18
  • CREATE (default): the EVM derives the address from (sender, nonce). The sender is the acting account: the connected one, or the account of an enclosing switch --as <address> ( … ) or sim:fork --as <address>. The command uses an internal per-script nonce counter so multiple deploys in the same script chain correctly.
  • CREATE2 (--create2 <salt>): tx is sent to a CREATE2 factory with calldata salt(32) || initCode. The default factory is the Arachnid deterministic deployer at 0x4e59b44847b379578588920ca78fbf26c0b4956c. The predicted address depends on (factory, salt, initCode) only, so the sender does not affect it.
  • CREATE3 (--create3 <salt>): tx calls deployCreate3(bytes32,bytes) on a CreateX-compatible factory (default 0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed). The deployed address depends only on (factory, salt), not on the bytecode. Permissioned salts (first 20 bytes equal the sender, or zero-prefixed with 0x01 in byte 20) are rejected so client-side prediction stays deterministic.
  • Mirror (--mirror-address <addr> [--mirror-chain <id>]): fetches the original creation bytecode of an existing deployment from Etherscan V2's getcontractcreation endpoint and uses it as the init code for this deployment. The fetched bytecode already includes the original ABI-encoded constructor arguments, so --constructor / --constructor-args are not allowed in this mode. Combine with --create2 / --create3 to pin the cloned contract to a deterministic address. Needs access to Etherscan: the terminal has it through the EVMcrispr API, the CLI reads VITE_ETHERSCAN_API_KEY.
  • --from is deprecated: to deploy from another account, run the command inside switch --as <address> ( … ). The address prediction follows.
  • A command and all of its options must be written on a single line — EVML has no \ line continuation.
  • A deploy action is a CREATE transaction (no to field) when neither --create2 nor --create3 is set. Such actions cannot be executed inside a batch (...) block via EIP-5792 wallet batching — use --create2 or --create3 if you need to batch deployments together with other calls.
  • @contracts:next — predict the next CREATE address for an account
  • exec — call a contract function on the deployed address
  • send — send a pre-encoded transaction or value transfer to an existing address