0

I'm using Alchemy API with Hardhat and every time I run the deploy script I get the above error. I am also getting requests to my API every time I run this and the method is eth_accounts, in the request the Params Raw Request the API is getting says this:

{ jsonrpc:"2.0", method:"eth_accounts", params:[ ], id:1 }

The Return Raw Response is:

{ jsonrpc:"2.0", id:1, result:[ ] }

It can't possibly be that my Keys aren't working if I am getting requests and responses to my API. I have tried every type of deploy and getContractFactory function and combination. Does this have to do with Metamask maybe? Is there something with the signer that I am missing?

Here is my hardhat.config:

/** @type import('hardhat/config').HardhatUserConfig */
require("@nomiclabs/hardhat-ethers");
require("@nomicfoundation/hardhat-toolbox");
require("dotenv").config();


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,
      }
    }
};
1
  • I suspect a configuration error in the hardhat.config.js file. Perhaps you need to change the RPC url You can tell more exactly if you provide more data Sep 20 at 4:28

1 Answer 1

0

There are somethings that I think is not correct in hardhat configurations.

  • private keys doesn't starts with 0x
  • the parameter account should be accounts
  • you didn't provided the chainId

Here is the hardhat configurations.

...
networks: {
  sepolia: {
    url: `${API_KEY}`,
    accounts: [PRIVATE_KEY],
    gas: 2100000,
    gasPrice: 8000000000,
    saveDeployments: true,
    chainId: 11155111,
  }
}
...

Try these things and I think the problem will be solved.

Just get your private key and paste it as it is in you .env file, without adding any additional data, and check results.

4
  • I had originally just pasted in my private key without adding that and got an error that there were not enough bytes. It wouldn't even process a transaction until I added the 0x. I did try deploying just now without it again and I am still getting the same error that is on the original question of this post: Factory runner does not support sending transactions.
    – Meltxx
    Sep 20 at 16:27
  • I apologize for not understanding the question well. I noticed that you are not adding the chainId of the sepolia network, try to add this parameter: chainId: 11155111. And I noticed too that are writing account, write accounts: [PRIVATE_KEY] and check the results.
    – Al-Qa'qa'
    Sep 20 at 16:34
  • Wow, I think that actually worked! Thank you! Of course I knew you could add the chainId but Alchemy Docs made it seem unimportant.
    – Meltxx
    Sep 20 at 16:46
  • You are welcome. I will edit the answer to be a correct answer in the future
    – Al-Qa'qa'
    Sep 20 at 16:50

Your Answer

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

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