I am trying to deploy very large number of contracts (more than 300 thousands) with automine option at Ganache GUI .. Is it possible to do such experiments ? when i want to deploy such huge number of contracts, then i am facing following error;

Error: Returned values aren't valid, did it run Out of Gas? You might also see this error if you are not using the correct ABI for the contract you are retrieving data from, requesting data from a block number that does not exist, or querying a node which is not fully synced.
    at ABICoder.decodeParameters (C:\Users\aa\node_modules\web3-eth-abi\src\index.js:226:15)
    at extractingParams (C:\Users\aa\Desktop\temp\deploy - NewfromsFuzz.js:185:42)
    at main (C:\Users\aa\Desktop\temp\deploy - NewfromsFuzz.js:334:7)
    at Object.<anonymous> (C:\Users\aa\Desktop\temp\deploy - NewfromsFuzz.js:381:3)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
(node:14280) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:14280) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

UPDATE: here is my code

async function finalDeploy(r){

  for(i=0; i<constructorParams.length; i++) {

    const options = {
      data: '0x' + myBin[r]+constructorParams[i],
      gas: 5000000,
  const signed = await web3.eth.accounts.signTransaction(options, privateKey1);
  const receipt = await web3.eth.sendSignedTransaction(signed.rawTransaction);
  console.log("Contract: " +r+" is deployed at  " +receipt.contractAddress);



note: above code is valid to deploy 500+ smart contracts

UPDATE 2: Also it should be noted that i have only one contract and one ABI. but i am just trying to deploy that contract with millions different values for its constructor. That's why I am saying i want to deploy millions contract. For every contract, in my each constructorParams there is value like 0x00ff0040f5020000000000000000001d00000000000002ff37ff4a1f00000b00. this value is encoded for my following constructor (and for every contract this is the same constructor) ...

  constructor(address _wallet) public payable {
        totalSupply = 6;
        owner = _wallet;

As pointed out in comments that there may be some wrong value for your constructor. To answer this point; if i try my above code to deploy my contract with first 500 different values for constructor, then there is no problem.. but if i try the same code with 600 or above values, then at least first 500 values should deploy 500 contracts, but i have received above mentioned error without deploying even a single contract.

  • You don't seriously expect anyone to explain a given error without you posting the code which has triggered this error, do you? Commented Dec 30, 2019 at 12:46
  • oh... sorry .. forget to write code here.. see my update..
    – Amir Ali
    Commented Dec 30, 2019 at 12:53
  • The Returned values aren't valid, did it run Out of Gas? error typically indicates that the abi-encoded data was not encoded correctly. Commented Dec 30, 2019 at 12:59
  • In "normal transactions" (i.e., function calls), it typically indicates that the encoded function (the value of the data field) does not exist in the target contract (pointed by the to field). It can also indicate that the encoded parameters (again - part of the data field) mismatch with what the contract's function expects to receive. In contract-deployment transactions (as seems to be your case), I am not quite sure what it means, but I'd take the liberty to guess that this (the value of the data field) is not a valid contract byte-code. Commented Dec 30, 2019 at 12:59
  • then why my code works for 500+ contracts... ?
    – Amir Ali
    Commented Dec 30, 2019 at 13:05


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.