I have run into the above error trying to deploy my contract. Running npx hardhat scripts/deploy.js. Here is the deploy.js:

async function main() {

    const Test1 = await ethers.getContractFactory("Test1");
    // Start deployment, returning a promise that resolves to a contract object
    const test1 = await Test1.deploy()
    await test1.waitForDeployment()
    console.log("Contract deployed to address:", test1.address)
    .then(() => process.exit(0))
    .catch((error) => {

Here is my hardhat.config:

/** @type import('hardhat/config').HardhatUserConfig */

const { API_KEY, PRIVATE_KEY } = process.env;

module.exports = {
  solidity: "0.8.19",
    defaultNetwork: "sepolia",
    networks: {
      sepolia: {
        url: `${API_KEY}`,
        account: [`0x${PRIVATE_KEY}`],
        gas: 2100000,
        gasPrice: 8000000000,
        saveDeployments: true,

Also, I am 100% sure that my keys are working because this index.js script:

async function main() {
  const latestBlock = await ethers.provider.getBlock("latest");
  console.log("The latest block number is", latestBlock);


returned this without issue:

The latest block number is Block {
  provider: HardhatEthersProvider {
    _hardhatProvider: LazyInitializationProviderAdapter {
      _providerFactory: [AsyncFunction (anonymous)],
      _emitter: [EventEmitter],
      _initializingPromise: [Promise],
      provider: [BackwardsCompatibilityProviderAdapter]
    _networkName: 'sepolia',
    _blockListeners: [],
    _transactionHashListeners: Map(0) {},
    _eventListeners: []
  number: 4317743,
  hash: '0x958fcc2623779ccf65955ce0c9a6942610911428d604c0aad9a1409cad3f36d5',
  timestamp: 1695094548,
  parentHash: '0x6e92e3f483ac89882a72ae39c5691b8ebda83272fc2ea88841cd60abd49215bc',
  nonce: '0x0000000000000000',
  difficulty: 0n,
  gasLimit: 30000000n,
  gasUsed: 24226851n,
  miner: '0xF29Ff96aaEa6C9A1fBa851f74737f3c069d4f1a9',
  extraData: '0xd883010c00846765746888676f312e32302e34856c696e7578',
  baseFeePerGas: 21n

and I am seeing this reflected in my API.

I am seeing transactions on my API long after I try to run the deploy script but it doesn't seem to have actually done anything. THAT transaction method on my API is called eth_accounts and they are empty.

  • Kindly recheck your PRIVATE_KEY env or give a try to change test1 = await Test1.deploy() to test1 = await ethers.deployContract('Test1'). Just guess
    – CT95
    Sep 19, 2023 at 10:25
  • Unfortunately test1 = await ethers.deployContract('Test1') did not work. I'm still getting the same error.
    – Meltxx
    Sep 19, 2023 at 19:02

1 Answer 1


Your hardhat.config.js:

accounts: [`0x${PRIVATE_KEY}`],

plural 'accounts', not singular 'account'

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.