The transaction calls a function of the given smart contract instance, giving it functionParameters as its input. The call can use at maximum the given amount of gas – the paying account will not be charged for any unspent gas.
If this function results in data being stored, an amount of gas is calculated that reflects this storage burden.
The amount of gas used, as well as other attributes of the transaction, e.g. size, and number of signatures to be verified, determine the fee for the transaction – which is charged to the paying account.
Transaction Signing Requirements
The key of the transaction fee-paying account
Transaction Fees
Please see the transaction and query fees table for the base transaction fee
Which function to call and the parameters to pass to the function.
Required
setGas(<gas>)
long
The maximum amount of gas to use for the call.
Required
setPayableAmount(<amount>)
Hbar
Number of hbars sent (the function must be payable if this is nonzero)
Optional
//Create the transactionContractCreateTransaction transaction =newContractExecuteTransaction().setContractId(newContractId).setGas(100_000_000).setFunction("set_message",newContractFunctionParameters().addString("hello from hedera again!"))//Sign with the client operator private key to pay for the transaction and submit the query to a Hedera networkTransactionResponse txResponse =transaction.execute(client);//Request the receipt of the transactionTransactionReceipt receipt =txResponse.getReceipt(client);//Get the transaction consensus statusStatus transactionStatus =receipt.status;System.out.println("The transaction consensus status is "+transactionStatus);//v2.0.0
//Create the transactionconsttransaction=newContractExecuteTransaction().setContractId(newContractId).setGas(100_000_000).setFunction("set_message",newContractFunctionParameters().addString("hello from hedera again!"))//Sign with the client operator private key to pay for the transaction and submit the query to a Hedera networkconsttxResponse=awaittransaction.execute(client);//Request the receipt of the transactionconstreceipt=awaittxResponse.getReceipt(client);//Get the transaction consensus statusconsttransactionStatus=receipt.status;console.log("The transaction consensus status is "+transactionStatus);//v2.0.0
//Create the transactiontransaction, err := hedera.NewContractExecuteTransaction().SetContractID(newContractID).SetGas(100000000).SetFunction("setMessage", contractFunctionParams)//Sign with the client operator private key to pay for the transaction and submit the query to a Hedera networktxResponse, err := transaction.Execute(client)if err !=nil {panic(err)}//Request the receipt of the transactionreceipt, err := txResponse.GetReceipt(client)if err !=nil {panic(err)}//Get the transaction consensus statustransactionStatus := receipt.Statusfmt.Printf("The transaction consensus status %v\n", transactionStatus)//v2.0.0