Insufficient funds for intrinsic transaction cost?

Hello,

Im deploying my smart contract to main net and I've loaded my ethereum account with 0.0303
ETH but I get this error:

viktor@debian:~/openzeppelin-contracts-4.5.0$ npx hardhat run --network mainnet scripts/deploy.js
Deploying Box...
Error: insufficient funds for intrinsic transaction cost (error={"name":"ProviderError","code":-32000,"_isProviderError":true}, method="sendTransaction", transaction=undefined, code=INSUFFICIENT_FUNDS, version=providers/5.5.3)
    at Logger.makeError (/home/viktor/openzeppelin-contracts-4.5.0/node_modules/@ethersproject/logger/src.ts/index.ts:225:28)
    at Logger.throwError (/home/viktor/openzeppelin-contracts-4.5.0/node_modules/@ethersproject/logger/src.ts/index.ts:237:20)
    at checkError (/home/viktor/openzeppelin-contracts-4.5.0/node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:53:16)
    at /home/viktor/openzeppelin-contracts-4.5.0/node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:215:24
    at processTicksAndRejections (internal/process/task_queues.js:97:5) {
  reason: 'insufficient funds for intrinsic transaction cost',
  code: 'INSUFFICIENT_FUNDS',
  error: ProviderError: insufficient funds for gas * price + value
      at HttpProvider.request (/home/viktor/openzeppelin-contracts-4.5.0/node_modules/hardhat/src/internal/core/providers/http.ts:49:19)
      at HDWalletProvider.request (/home/viktor/openzeppelin-contracts-4.5.0/node_modules/hardhat/src/internal/core/providers/accounts.ts:182:36)
      at processTicksAndRejections (internal/process/task_queues.js:97:5)
      at EthersProviderWrapper.send (/home/viktor/openzeppelin-contracts-4.5.0/node_modules/@nomiclabs/hardhat-ethers/src/internal/ethers-provider-wrapper.ts:13:20),
  method: 'sendTransaction',
  transaction: undefined
}
npm ERR! code 1
npm ERR! path /home/viktor/openzeppelin-contracts-4.5.0
npm ERR! command failed
npm ERR! command sh -c hardhat "run" "--network" "mainnet" "scripts/deploy.js"

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/viktor/.npm/_logs/2022-02-15T21_13_13_034Z-debug.log

This is my deploy script:

// scripts/deploy.js
async function main () {
    // We get the contract to deploy
    const Box = await ethers.getContractFactory('SpaceRace');
    console.log('Deploying Box...');
    const box = await Box.deploy();
    await box.deployed();
    console.log('Box deployed to:', box.address);
  }
  
  main()
    .then(() => process.exit(0))
    .catch(error => {
      console.error(error);
      process.exit(1);
    });

Can you help me to define the transaction cost to a lower level so that my account has enough ?

Thank you very much,
Viktor

:1234: Code to reproduce


:computer: Environment

Hi, welcome to the community! :wave:

If you do not want to provide more eth, just want to use 0.03 eth to deploy a contract, maybe you can try to provide a lower gas, but if you do like so, I think your contract will be pending for a long time.

yeah but how do I tell the code to lower the gas I might ask?
I've tried to add to const box in my deploy.js file: const box = await Box.deploy({ gasLimit: 20287350, gasPrice: 252873500}); but its still pending.. no errors so far.. dno how long it will take

after 24 hours I gave up.. how much is the transaction fee? 400$?? any suggestions?

any help would be much appreciated ty

the correct answer was 600$ :smiley:

1 Like