Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

201
Vistas
"TypeError : Cannot read property 'address' of undefined" i receive this error after lunch the deploy in the testnet, but in localhost works

i receive this error TypeError : Cannot read property 'address' of undefined after lunched npx hardhat run scripts/deploy.js --network goerli, but the same command in localhost works well, why?

hardhat.config.js

require('dotenv').config();
require("@nomiclabs/hardhat-ethers");

const { API_URL, PRIVATE_KEY } = process.env;

module.exports = {
  solidity: '0.8.4',
  defaultNetwork: "goerli",
  networks: {
    hardhat: {},
    goerli: {
      url: API_URL,
      accounts: [`0x${PRIVATE_KEY}`]
    }
  },
};

deploy.js

the error seems to be here, but i don't get why lunching npx hardhat run scripts/deploy.js works well and with goerly (or other testnet not)

if i write console.log(accounts[0].address); console.log(accounts[1].address); , i get the log only of the first one!

const { ethers } = require("hardhat");

const main = async () => {
  let accounts;
  accounts = await ethers.getSigners();
  const OWNERS = [
    accounts[0].address,
    accounts[1].address,
    accounts[2].address
  ]
  const NUM_CONFIRMATIONS = 2

  const MultiSig = await ethers.getContractFactory("MultiSig");
  const multiInstance = await MultiSig.deploy(OWNERS, NUM_CONFIRMATIONS);

  const TestContract = await ethers.getContractFactory("TestContract");
  const testContract = await TestContract.deploy("msg");

  await multiInstance.deployed();
  await testContract.deployed();

  console.log('multisig contract address: ', multiInstance.address);
  console.log('test contract address: ', testContract.address);
};

const runMain = async () => {
  try {
    await main();
    process.exit(0);
  } catch (error) {
    console.error(error);
    process.exit(1);
  }
};

runMain();
about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

maybe i got it, i added only 1 private key, i have to add more in the "accounts"array

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda