Is web3auth support zksync? - invalid network error

i trying to connect web3auth to zksync

but it is throwing an error, how can i fix this?

Error: Invalid network, net_version is: 361257328

the code is below

const zksyncChainConfig: CustomChainConfig = {
  chainNamespace: CHAIN_NAMESPACES.EIP155,
  chainId: "300",
  rpcTarget: "https://sepolia.era.zksync.dev",
  displayName: "zkSync Sepolia",
  blockExplorerUrl: "https://sepolia-era.zksync.network/",
  ticker: "ETH",
  tickerName: "Ethereum",
  logo: "https://cryptologos.cc/logos/ethereum-eth-logo.png",
  isTestnet: true,
}

const privateKeyProvider = new EthereumPrivateKeyProvider({
  config: { chainConfig: zksyncChainConfig },
})

const web3auth = new Web3Auth({
  clientId,
  web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_DEVNET,
  privateKeyProvider: privateKeyProvider,
})

is the network supported?

@ho1 Welcome Aboard!

The chainID should be in hex format 0x12c

You can get the chain details for Sepolia zksync here : https://chainlist.org/chain/300

yes it is working after I change it to use hex

however, when i try another chain (Japan Open Chain) , i meet the same issue

const jocChainConfig = {
  chainNamespace: CHAIN_NAMESPACES.EIP155,
  chainId: "0x2761",
  rpcTarget: "https://rpc-1.testnet.japanopenchain.org:8545",
  displayName: "Japan Open Chain Testnet",
  blockExplorerUrl: "https://explorer.testnet.japanopenchain.org/",
  ticker: "JOCT",
  tickerName: "Japan Open Chain Testnet",
  isTestnet: true,
}

with the following error code

Error: Invalid network, net_version is: 361257328

There is some issue with the chain details then that you need to check.

thanks i will verify it with the chain, why the net_version returns wrong value

the code that throws the error
web3auth-web/packages/providers/ethereum-mpc-provider/src/providers/signingProviders/EthereumSigningProvider.ts at d840f150d76cebb6c54dc29bda7efaac668df66f · Web3Auth/web3auth-web (github.com)

The error Invalid network, net_version is: … typically occurs when the network configuration is not set correctly.

  1. Check the Network Configuration:

Ensure that the network configuration is set correctly i.e. chainId and the rpcTarget

  1. Verify the RPC Endpoint:

Double-check that the RPC endpoint is correct and accessible.

Do check here About Japan Open Chain specifications | Japan Open Chain

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.