0

the contract has 0 error's i am trying to deploy it trough injected web3 after i have full filled the constructor amounts and trying to deploy it i get this error

creation of RATCOIN errored: [ethjs-query] while formatting outputs from RPC '{"value":{"code":-32603"data":{"code":-32000"message":"exceeds block gas limit"}}}'

Error Code

here is the smart contract it dont have any error in it when i have it on optimization 200 Link To Smart Contract

2
  • 1
    What network do you deploy it to and what are your constructor params?
    – Richard
    Jan 20 at 20:13
  • bsc you mean like this? constructor(uint16 _deadBlocks, uint16 _buyliq, uint16 _buymarket, uint16 _sellliq, uint16 _sellmarket, address payable _marketing, uint256 _supply, uint256 _numTokens, uint256 _maxWallet, uint256 _maxBuy, uint256 _maxSell ) {
    – joel
    Jan 23 at 0:11

1 Answer 1

0
  • First, check if your transaction's setup(gas/gas limit) is ok (see this).

  • If everything is okay, the most probable issue might be the size of your contract. I suggest first take a look at this to get familiar with contract deployment's gas calculation.

  • Now, note that each block has a limited size(currently it is 15 million gas). This means that you cannot send transactions with more than this size. Which means that there is a limit for gas, too. (See these links: 1, 2, 3)

  • After reading aforementioned links, I suggest (if it is possible for you (which seems to be a MUST TO DO)), minimize your solidity code as much as possible. Removing extra codes, results in less bytecodes, which means you will not exceed the gas limit. Be warned that decreasing the volume of your code should not result in decreasing the security and functionality of your code.

I hope this helps you.

3
  • could it be possible that its failing on the gas because i am trying to deploy it on the testnet ? because i wanne test the contract before publish it on themain net
    – joel
    Jan 20 at 19:44
  • No. You can deploy your contract in testnets as long as you have test ETH in your wallet. Jan 20 at 19:48
  • The problem might be the size of your contract. I will explain it in my answer. Jan 20 at 19:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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