RuntimeError: abort(Error: The contract code couldn't be stored, please check your gas limit.)

The error is presented to implement a contract through the abi and bytecode, the constructor requires two parameters, using the example that you provide here: contract-using-web3.js

The js data:

const Web3 = require(‘web3’);

const Tx = require(‘ethereumjs-tx’).Transaction;
const solc = require(‘solc’);
const fs = require(‘fs’);

const API_URL = process.env.PROVIDER;
const PUBLIC_KEY = process.env.ADDRESS1;
const PRIVATE_KEY = process.env.ADDRESS1_KEY;
const network = process.env.ETHEREUM_NETWORK;

var web3 = new Web3(new Web3.providers.HttpProvider(API_URL));
const express = require(‘express’);
const router = express.Router();

const contract = require(’…/routes/contractFrac’);
const WeCoinRes4 = new web3.eth.Contract(contract.contractABI, contract.contractAddress);

const contractFWCT = require(’…/routes/contractFracFWCT’);
const WeCoinFWCT = new web3.eth.Contract(contractFWCT.contractABI, contractFWCT.contractAddress);

const contractRF = require(’…/routes/contractRecFrac’);
const WeCoinRC = new web3.eth.Contract(contractRF.contractABI, contractRF.contractAddress);

const contractAddress = contractRF.contractAddress;
const contractAbi = contractRF.contractABI;
const contractCode = contractRF.contractCode;
const contractCodeObj = contractRF.contractCodeObj;

async function activos(dirFrac, activoId) {
const reasset = [];
// Creating a signing account from a private key
const signer = web3.eth.accounts.privateKeyToAccount(

const reclamo = new web3.eth.Contract(contractAbi); = contractCodeObj;
//.deploy({data: contractCodeObj, arguments: [ dirFrac, activoId ]})

// = contractCodeObj;
//reclamo.options.arguments = [ dirFrac, activoId ];
//data: contractCode,
const deployTx = reclamo.deploy({
  arguments: [ dirFrac, activoId ]
//const estimategas = await deployTx.estimateGas();

const deployedContract = await deployTx
    from: PUBLIC_KEY,
    gas: 6700000,
    gasPrice: 10000000000,
  .once("transactionHash", (txhash) => {
    console.log(`Mining deployment transaction ...`);

// The contract is now deployed on chain!
console.log(`Contract deployed at ${deployedContract.options.address}`);
console.log(`Add DEMO_CONTRACT to the.env file to store the contract address: ${deployedContract.options.address}`);
  DirFrac: dirFrac,
  Id: activoId,
  from: PUBLIC_KEY,
  deployedContractAddress: deployedContract.options.address,
  deployedContract: deployedContract

return await JSON.stringify(reasset);

module.exports.activos = activos

The error is:
RuntimeError: abort(Error: The contract code couldn’t be stored, please check your gas limit.). Build with -s ASSERTIONS=1 for more info.
at process.abort (/home/alfredo/web3-practice/node_modules/solc/soljson.js:1:13939)

I was going to attach the abi and the bytecode is very large

I have reviewed everything and I do not find the error, I would really appreciate your help.


@Alfredo_Castellano Thanks for reaching out. Have you tried changing the gas parameters before deploying the contract? I see that the abi/bytecode generated. What happens when you raise the gas limit or gas defaults?

Kind regards,
Alex | Infura Support

I did the same by lowering and raising the values and the error persists.

I did several tests and I was reviewing the variables that are defined by console.

@Alfredo_Castellano thank you for that. Is there any chance you can share a copy of your contract/code or public github repo? It would help with running reproduction tests on our end.

Thank you!
Alex | Infura Support | Consensys

const contractRF = require(’…/routes/contractRecFrac’);

const contractAbi = contractRF.contractABI;
const contractCode = contractRF.contractCode;
const contractCodeObj = contractRF.contractCodeObj;

const reclamo = new web3.eth.Contract(contractAbi); = contractCodeObj;

Here the instance of the contract to be implemented is created, I see that well.

Thank you for this! Let me take a look and get back to you

Okay, perfect and thanks to you.

@Alfredo_Castellano Sorry for the delay. Still testing in progress. Thank you for your patience.

Okay I understand, I’m waiting for the results, thanks.

@Alfredo_Castellano I am going to need to ask you a few more private questions about your code, env, etc. Can you please open a support ticket so that we can continue this case 1 on 1 privately? Please go to this link and select customer support for the first drop down box. You can add your first message as the descrption so that I can find you. Thank you for working with me on this.

Kind regards,
Alex | Infura Support

Hello Alex, I already made the support ticket as you indicated, and I sent it.

I wait your instructions.

1 Like