0
require('dotenv').config();
require('@nomicfoundation/hardhat-toolbox');

const API_URL = process.env.API_URL;
const PRIVATE_KEY = process.env.PRIVATE_KEY;
const API_KEY=process.env.API_KEY

console.log("API_URL:", API_URL);
console.log("PRIVATE_KEY:", PRIVATE_KEY);
console.log("API_KEY:", API_KEY);
module.exports = {
  solidity: "0.8.18",
  networks: {
    goerli: {
      url: `https://eth-goerli.g.alchemy.com/v2/iX13YM9rvs66xWAlxXXWY13ottte2${API_KEY}`,
      accounts: [PRIVATE_KEY],
    },
  },
};

when i try to deploy using goerli i am getting error as notdefined Error: could not detect network (event="noNetwork", code=NETWORK_ERROR, version=providers/5.7.2) local deployment is working fine

reason: 'could not detect network', code: 'NETWORK_ERROR',

1 Answer 1

0

The error in your code seems to be in the URL string. You might have a typo or an incorrect value in the URL. Update the URL with the correct value.

url: `https://eth-goerli.alchemyapi.io/v2/${API_KEY}`,

This assumes you're using Alchemy as your Ethereum node provider. Replace ${API_KEY} with the actual API key if you're not using environment variables.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.