The below code throws "Transaction Oversize" error
const contractBytecode = fs.readFileSync("TestToken_sol_TestToken.bin");
const fileCreateTx = new FileCreateTransaction()
.setContents(contractBytecode)
.setKeys([operatorKey])
.freezeWith(client);
const fileCreateSign = await fileCreateTx.sign(operatorKey);
const fileCreateSubmit = await fileCreateSign.execute(client);
const fileCreateRx = await fileCreateSubmit.getReceipt(client);
const bytecodeFileId = fileCreateRx.fileId;
console.log(`- The bytecode file ID is: ${bytecodeFileId} \n`);
But trying out solution provided here, I ran into this new error "ContractCreateFlow is not a constructor" :
const contractInstantiateTx = new ContractCreateFlow()
.setGas(100000)
.setBytecode(contractBytecode)
const contractInstantiateSubmit = await contractInstantiateTx.execute(client);
const contractInstantiateRx = await contractInstantiateSubmit.getReceipt(client);
const contractId = contractInstantiateRx.contractId;
const contractAddress = contractId.toSolidityAddress();
console.log(`- The smart contract ID is: ${contractId} \n`);
console.log(`- The smart contract ID in Solidity format is: ${contractAddress} \n`);
Please see this answer: Getting error "Transaction Oversize" while creating a smart contract in Hedera blockchain You may need to import the
ContractCreateFlow()
module into your program from the SDK. Check the SDK version you're using asContractCreateFlow()
was introduced in v2.14 of the JS SDK.As an alternative, see this example if you wish to use FileCreate, FileAppend, and Contract create modules:
If you don't use
ContractCreateFlow()
, you first create an empty file, then append content (by chunks), and then create the contract - as shown by the code above.