hedera-hashgraph

Why I get INSUFFICIENT_GAS when I try to deploy a smart contract on Hedera?


When attempting to deploy a smart contract to the Smart Contract service, I encountered this error.

ReceiptStatusError: receipt for transaction 0.0.2842103@1679057101.807352731 contained error status INSUFFICIENT_GAS.

What should I do to solve this ?

Thanks !


Solution

  • INSUFFICIENT_GAS indicates that your gas limit for the transaction is too low so the transaction run out of gas before it's done with the execution. So you can increase the gas limit to avoid the problem.

    const contractExecTx = await new ContractExecuteTransaction()
        .setContractId(contractId)
        .setGas(100000) << Increase your gas limit here
        .setFunction(
          "function",
          new ContractFunctionParameters().addString(message)
        );