Deploying Contracts
Add your deployer wallet's private key
Create a new wallet keystore to securely store your deployer account’s private key.
cast wallet import myKeystore --interactive
Enter your wallet’s private key when prompted and provide a password to encrypt it.
Get ETH in the deployer account
The deployer account requires ETH to deploy a smart contract.
- Testnet: Claim ETH via a faucet, or
bridge ETH from Sepolia.
- Mainnet: Use a bridge to transfer ETH to Abstract mainnet.
Deploy your smart contract
Run the following command to deploy your smart contracts:
forge create src/Counter.sol:Counter \
--account myKeystore \
--rpc-url https://api.testnet.abs.xyz \
--chain 11124 \
--zksync \
--verify \
--verifier etherscan \
--verifier-url https://api-sepolia.abscan.org/api \
--etherscan-api-key TACK2D1RGYX9U7MC31SZWWQ7FCWRYQ96AD
Note: Replace the contract path and Etherscan API key with your own.
If successful, the output should look similar to the following:
Deployer: 0x9C073184e74Af6D10DF575e724DC4712D98976aC
Deployed to: 0x85717893A18F255285AB48d7bE245ddcD047dEAE
Transaction hash: 0x2a4c7c32f26b078d080836b247db3e6c7d0216458a834cfb8362a2ac84e68d9f
Providing Constructor Arguments
If your smart contract has a constructor with arguments, provide the arguments in the order they are defined in the constructor following the --constructor-args
flag.
forge create src/Counter.sol:Counter \
--account myKeystore \
--rpc-url https://api.testnet.abs.xyz \
--chain 11124 \
--zksync \
--constructor-args 1000000000000000000 0x9C073184e74Af6D10DF575e724DC4712D98976aC \
--verify \
--verifier etherscan \
--verifier-url https://api-sepolia.abscan.org/api \
--etherscan-api-key TACK2D1RGYX9U7MC31SZWWQ7FCWRYQ96AD
Note: Replace the contract path, constructor arguments, and Abscan API key with your own.