run_script
Execute Solidity deployment and interaction scripts on zkSync using Foundry, with flexible key management for signing transactions.
Instructions
Run a forge script targeting zkSync (forge script --zksync)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectPath | Yes | Absolute path to the foundry project directory | |
| profile | No | Foundry profile to use (maps to FOUNDRY_PROFILE env var). Selects a [profile.<name>] section from foundry.toml, e.g. 'zksync', 'ci', 'production'. | |
| scriptPath | Yes | Path to the Solidity script file, e.g. script/Deploy.s.sol | |
| rpcUrl | No | RPC URL to fork from or broadcast to | |
| sender | No | Address to use as msg.sender for the script simulation (--sender). Useful for dry-run without a signing key. | |
| broadcast | No | If true, passes --broadcast to actually send transactions on-chain | |
| slow | No | If true, sends transactions sequentially (--slow). Required on ZK chains which do not support transaction batching. | |
| privateKey | No | Raw private key for signing. Only use for local development with well-known test keys (e.g. anvil-zksync accounts). For production, use 'account' (named keystore) or hardware wallets instead. | |
| account | No | Named keystore account from ~/.foundry/keystores (recommended for production). Create one with: cast wallet import <name> --interactive | |
| keystore | No | Path to an encrypted keystore JSON file | |
| passwordFile | No | Path to a file containing the keystore password | |
| keystorePassword | No | Keystore password (prefer passwordFile to keep it out of process args) | |
| unlocked | No | Use eth_sendTransaction with --from address (no local signing). For nodes that manage keys natively. | |
| from | No | Sender address, used with --unlocked or hardware wallets. Maps to --from for cast/deploy, --sender for forge script. | |
| ledger | No | Sign with a Ledger hardware wallet | |
| trezor | No | Sign with a Trezor hardware wallet | |
| aws | No | Sign with AWS KMS (requires AWS_KMS_KEY_ID env var) | |
| gcp | No | Sign with Google Cloud KMS (requires GCP_PROJECT_ID, GCP_LOCATION, GCP_KEY_RING, GCP_KEY_NAME, GCP_KEY_VERSION env vars) | |
| extraArgs | No | Additional CLI flags, each as a separate array element, e.g. ['--verify', '--etherscan-api-key', 'abc'] |