0
votes

I am trying to deploy a contact using below code on rinkeby test net:

    const result = await new web3.eth.Contract(JSON.parse(interface))
        .deploy({data: bytecode, arguments: [100, accounts[0]]})
        .send({gas: 1000000, from: accounts[0]});

Attempting to deploy from acount  0xBE80D3f83530f2Ed1214BE5a7434E0cd32177047
(node:3862) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: The contract code couldn't be stored, please check your gas limit.

When I increase the gas limit to 10000000
I get below error. Not able to understand what is wrong with the deployment

Attempting to deploy from acount  0xBE80D3f83530f2Ed1214BE5a7434E0cd32177047
(node:3870) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: exceeds block gas limit
1
Can you show your contract? That gas limit seems too low. - Marcos Casagrande

1 Answers

0
votes

You're exceeding the gas limit. You may be doing too much work on your constructor, or you're just sending a gas limit that is too low.

Rinkeby gas limit is around 7.4M, so you can try increasing the gas from: 1M to ~7.4M.

If your contract is to big, you can split it into multiple contracts, or as I said before reduce the work being done on the constructor.