This page assumes you already have a Hardhat project setup. If you don’t, follow the steps in the Getting Started guide to create a new project.

1

Install hardhat-zksync

Abstract uses the ZKsync VM, which expects different bytecode than the Ethereum Virtual Machine (EVM). The hardhat-zksync library includes several plugins to help you compile, deploy and verify smart contracts for the Zksync VM on Abstract.

Install the @matter-labs/hardhat-zksync package:

npm install -D @matterlabs/hardhat-zksync
2

Update Hardhat configuration

Modify your hardhat.config.ts file to include the following options:

import { HardhatUserConfig } from "hardhat/config";
import "@matterlabs/hardhat-zksync";

const config: HardhatUserConfig = {
  zksolc: {
    version: "latest",
    settings: {
      // find all available options in the official documentation
      // https://docs.zksync.io/build/tooling/hardhat/hardhat-zksync-solc#configuration
    },
  },
  defaultNetwork: "abstractTestnet",
  networks: {
    abstractTestnet: {
      url: "https://api.testnet.abs.xyz",
      ethNetwork: "sepolia",
      zksync: true,
      chainId: 11124,
    },
    abstractMainnet: {
      url: "https://api.mainnet.abs.xyz",
      ethNetwork: "mainnet",
      zksync: true,
      chainId: 2741,
    },
  },
  solidity: {
    version: "0.8.24",
  },
};

export default config;
3

Run Hardhat commands

Provide the --network flag to specify the Abstract network you want to use.

# e.g. Compile the network using the zksolc compiler
npx hardhat compile --network abstractTestnet