The execute() method submits a transaction to a Hedera network. This method will create the transaction ID from the client operator account ID, sign with the client operator private key, and pick a node from the defined network on the client to submit the transaction to. The transaction is also automatically signed with the client operator account private key. You do not need to manually sign transactions if this key is the required key on any given transaction. Once you submit the transaction, the response will include the following:
The transaction ID of the transaction
The node ID of the node the transaction was submitted to
The transaction hash
Transaction Signing Requirements
Please refer to the specific transaction type and defined key structure of the account, topic, token, file, or smart contract to understand the signing requirements
Method
Type
Description
execute(<client>)
Client
Sign with the client operator and submit to a Hedera network
execute(<client, timeout>)
Client, Duration
The duration of times the client will try to submit the transaction upon the network being busy
executeWithSigner(<signer>)
Sign the transaction with a local wallet. This feature is available in the Hedera JavaScript SDK only. >=v2.11.0
<transactionResponse>.transactionId
TransactionId
Returns the transaction ID of the transaction
<transactionResponse>.nodeId
AccountId
Returns the node ID of the node that processed the transaction
Whether getReceipt() or getRecord() will throw an exception if the receipt status is not SUCCESS
<transactionResponse>.getValidateStatus
boolean
Return whether getReceipt() or getRecord() will throw an exception if the receipt status is not SUCCESS
//Create the transactionAccountCreateTransaction transaction =newAccountCreateTransaction().setKey(newPublicKey).setInitialBalance(newHbar(1000));//Sign with client operator private key and submit the transaction to a Hedera networkTransactionResponse txResponse =transaction.execute(client);//Get the transaction IDTransactionId transactionId =txResponse.transactionId;//Get the account ID of the node that processed the transactionAccountId nodeId =txResponse.nodeId;//Get the transaction hashbyte [] transactionHash =txResponse.transactionHash;System.out.println("The transaction ID is "+transactionId);System.out.println("The transaction hash is "+transactionHash);System.out.println("The node ID is "+nodeId);//v2.0.0
//Create the transactionconsttransaction=newAccountCreateTransaction().setKey(newPublicKey).setInitialBalance(newHbar(1000));//Sign with client operator private key and submit the transaction to a Hedera networkconsttxResponse=awaittransaction.execute(client);//Get the transaction IDconsttransactionId=txResponse.transactionId;//Get the account ID of the node that processed the transactionconstnodeId=txResponse.nodeId;//Get the transaction hashconsttransactionHash=txResponse.transactionHash;console.log("The transaction ID is "+transactionId);console.log("The transaction hash is "+transactionHash);console.log("The node ID is "+nodeId);//v2.0.0
//Create the transactiontransaction :=hedera.NewAccountCreateTransaction().SetKey(publicKey).SetInitialBalance(hedera.NewHbar(1000))//Sign with client operator private key and submit the transaction to a Hedera networktxResponse, err :=transaction.Execute(client)if err != nil {panic(err)}//Get the transaction IDtransactionId :=txResponse.TransactionID//Get the account ID of the node that processed the transactiontransactionNodeId :=txResponse.NodeID//Get the transaction hashtransactionHash :=txResponse.Hashfmt.Printf("The transaction id is %v\n", transactionId)fmt.Printf("The transaction hash is %v\n", transactionHash)fmt.Printf("The node id is %v\n", transactionNodeId)//v2.0.0