Unable to deploy smart contract to BNBChain mainnet

Unable to deploy smart contract to mainnet
According to gas-report on hardhat it take arround 0.02ETH and wallet ETH is 0.079150594937047879’’

Here is the error:
Error: insufficient funds for intrinsic transaction cost [ See: Error Codes ] (error={“name”:“ProviderError”,“_stack”:“ProviderError: HttpProviderError\n at HttpProvider.request (/Users/gtccomputer/Dev/kube/bitcoinx/dex/node_modules/hardhat/src/internal/core/providers/http.ts:83:19)\n at LocalAccountsProvider.request (/Users/gtccomputer/Dev/kube/bitcoinx/dex/node_modules/hardhat/src/internal/core/providers/accounts.ts:181:36)\n at processTicksAndRejections (node:internal/process/task_queues:95:5)\n at EthersProviderWrapper.send (/Users/gtccomputer/Dev/kube/bitcoinx/dex/node_modules/@nomiclabs/hardhat-ethers/src/internal/ethers-provider-wrapper.ts:13:20)”,“code”:-32000,“_isProviderError”:true}, method=“sendTransaction”, transaction=undefined, code=INSUFFICIENT_FUNDS, version=providers/5.7.2)
at Logger.makeError (/Users/gtccomputer/Dev/kube/bitcoinx/dex/node_modules/@ethersproject/logger/src.ts/index.ts:269:28)
at Logger.throwError (/Users/gtccomputer/Dev/kube/bitcoinx/dex/node_modules/@ethersproject/logger/src.ts/index.ts:281:20)
at checkError (/Users/gtccomputer/Dev/kube/bitcoinx/dex/node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:98:16)
at /Users/gtccomputer/Dev/kube/bitcoinx/dex/node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:265:24
at processTicksAndRejections (node:internal/process/task_queues:95:5) {
reason: ‘insufficient funds for intrinsic transaction cost’,
code: ‘INSUFFICIENT_FUNDS’,
error: ProviderError: HttpProviderError
at HttpProvider.request (/Users/gtccomputer/Dev/kube/bitcoinx/dex/node_modules/hardhat/src/internal/core/providers/http.ts:83:19)
at LocalAccountsProvider.request (/Users/gtccomputer/Dev/kube/bitcoinx/dex/node_modules/hardhat/src/internal/core/providers/accounts.ts:181:36)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at EthersProviderWrapper.send (/Users/gtccomputer/Dev/kube/bitcoinx/dex/node_modules/@nomiclabs/hardhat-ethers/src/internal/ethers-provider-wrapper.ts:13:20),
method: ‘sendTransaction’,
transaction: undefined
}

Codebase: GitHub - bitcoinxnetwork/dex
Anyone can tell me the problem,

1 Like

Can you share the smart contract deployed on BNBChain testnet?

1 Like

How is the link to smart contract : GitHub - bitcoinxnetwork/dex

I think the problem might come from BNBchain.
const provider = waffle.provider;
const block = await provider.getBlock()
console.log(owner.address);
const balance = await provider.getBalance(owner.address);
console.log(‘Owner ETH’, ethers.utils.formatEther(balance));

BitcoinXSmartRouter = await ethers.getContractFactory('BitcoinXSmartRouter', owner);

const deployTx = BitcoinXSmartRouter.getDeployTransaction(owner.address);
const estimatedGas = await BitcoinXSmartRouter.signer.estimateGas(deployTx);
const gasPrice = await BitcoinXSmartRouter.signer.getGasPrice();

const deploymentPriceWei = gasPrice.mul(estimatedGas);
const deploymentPriceBNB = ethers.utils.formatEther(deploymentPriceWei);

console.log('Gas Price in ETH:', deploymentPriceBNB);

The estimatedGas is 0.012623925 ETH and I have 0.078 ETH in the wallet

I think the reason may be that the “intrinsic transaction cost” is calculated as gasLimit*gasPrice. If I am right the default gasLimit is 20M. It happened to me once, try to check it.

1 Like

@tmind Thank for your comment. I have found the problem & fixed it by changing gasPrice: 3000000000 in hardhat config file.

@STdevK Thank for your comment. I have found the problem & fixed it by changing gasPrice: 3000000000 in hardhat config file.

1 Like