Polygon Mumbai – Is zkSync Usable in Polygon Mumbai Testnet?

hardhatpolygontestnetszksync

I am setting up a project using zkSync and I am seeing that, in the hardhat.config.ts file, the supported network is zkSyncTestnet.

hardhat.config.ts

import "@matterlabs/hardhat-zksync-deploy";
    import "@matterlabs/hardhat-zksync-solc";
    
    module.exports = {
      zksolc: {
        version: "1.3.1",
        compilerSource: "binary",
        settings: {},
      },
      defaultNetwork: "zkSyncTestnet",
    
      networks: {
        zkSyncTestnet: {
          url: "https://zksync2-testnet.zksync.dev",
          ethNetwork: "goerli", // Can also be the RPC URL of the network (e.g. `https://goerli.infura.io/v3/<API_KEY>`)
          zksync: true,
        },
      },
      solidity: {
        version: "0.8.17",
      },
    };

Is it possible to use Polygon Mumbai for this?

Best Answer

Actually, yes you can have a project configured for zkSync and other blockchains. You just have to include the attribute zksync: true or zksync: false to all the networks in your project.

This is how your config would be for both zkSync and Polygon Mumbai:

import { HardhatUserConfig } from "hardhat/config";

import "@matterlabs/hardhat-zksync-deploy";
import "@matterlabs/hardhat-zksync-solc";

const config: HardhatUserConfig = {
  zksolc: {
    version: "1.3.1",
    compilerSource: "binary",
    settings: {},
  },
  defaultNetwork: "zkSyncTestnet", //could be any of the networks below
  networks: {
    hardhat: {
      zksync: false,
    },
    mumbai:{
      url: 'https://your-polygon-mumbai-endpoint.com/abcdef12345',
      zksync: false,
    },
    zkSyncTestnet: {
      url: "https://zksync2-testnet.zksync.dev",
      ethNetwork: "goerli",  // or a Goerli RPC endpoint 
      zksync: true,
    },
  },
  solidity: {
    version: "0.8.17",
  },
Related Topic