These methods allow you to build a transaction that requires further processing before it is submitted to a Hedera network. After you freeze the transaction you can use .sign(privateKey) to sign the transaction with multiple keys or convert the transaction to bytes for further processing.
Method
Type
Description
freeze()
Freeze this transaction from further modification to prepare for signing or serialization. You will need to set the node account ID (setNodeAccountId()) and transaction ID (setTransactionId()).
freezeWith(<client>)
Client
Freeze this transaction from further modification to prepare for signing or serialization. Will use the 'Client', if available, to generate a default Transaction ID and select 1/3 nodes to prepare this transaction for.
freezeWithSigner(<signer>)
Freeze the transaction with a local wallet. Local wallet available in Hedera JavaScript SDK only. >=v2.11.0
Java
//Create an unsigned transaction
AccountCreateTransaction transaction = new AccountCreateTransaction()
.setKey(newPublicKey)
.setInitialBalance(Hbar.fromTinybars(1000));
//Freeze the transaction for signing
//The transaction cannot be modified after this point
AccountCreateTransaction freezeTransaction = transaction.freezeWith(client);
System.out.println(freezeTransaction);
//v2.0.0
JavaScript
//Create an unsigned transaction
const transaction = new AccountCreateTransaction()
.setKey(newPublicKey)
.setInitialBalance(Hbar.fromTinybars(1000));
//Freeze the transaction for signing
//The transaction cannot be modified after this point
const freezeTransaction = transaction.freezeWith(client);
console.log(freezeTransaction);
//v2.0.5
Go
//Create an unsigned transaction
transaction := hedera.NewAccountCreateTransaction().
SetKey(newKey.PublicKey()).
SetInitialBalance(hedera.NewHbar(1000))
//Freeze the transaction for signing
//The transaction cannot be modified after this point
freezeTransaction, err := transaction.FreezeWith(client)
if err != nil {
panic(err)
}
println(freezeTransaction.String())
//v2.0.0
Freeze this transaction from further modification to prepare for signing or serialization. You will need to set the node account ID (setNodeAccountId()) and transaction ID (setTransactionId()).
build(<client>)
Client
Freeze this transaction from further modification to prepare for signing or serialization. Will use the 'Client', if available, to generate a default Transaction ID and select 1/3 nodes to prepare this transaction for.
Java
//Create an unsigned transaction
AccountCreateTransaction transaction = new AccountCreateTransaction()
.setKey(newPublicKey)
.setInitialBalance(Hbar.fromTinybars(1000));
//Freeze the transaction for signing
//The transaction cannot be modified after this point
AccountCreateTransaction unsignedTransaction = transaction.build(client);
System.out.println(unsignedTransaction);
//v1.3.2
JavaScript
//Create an unsigned transaction
const transaction = new AccountCreateTransaction()
.setKey(newPublicKey)
.setInitialBalance(Hbar.fromTinybars(1000));
//Freeze the transaction for signing
//The transaction cannot be modified after this point
const unsignedTransaction = transaction.build(client);
System.out.println(unsignedTransaction);
//v1.4.4