Hedera
Search…
Create an unsigned transaction
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.
V2
V1
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.
Java
1
//Create an unsigned transaction
2
AccountCreateTransaction transaction = new AccountCreateTransaction()
3
.setKey(newPublicKey)
4
.setInitialBalance(Hbar.fromTinybars(1000));
5
6
//Freeze the transaction for signing
7
//The transaction cannot be modified after this point
8
AccountCreateTransaction freezeTransaction = transaction.freezeWith(client);
9
10
System.out.println(freezeTransaction);
11
12
//v2.0.0
Copied!
JavaScript
1
//Create an unsigned transaction
2
const transaction = new AccountCreateTransaction()
3
.setKey(newPublicKey)
4
.setInitialBalance(Hbar.fromTinybars(1000));
5
6
//Freeze the transaction for signing
7
//The transaction cannot be modified after this point
8
const freezeTransaction = transaction.freezeWith(client);
9
10
console.log(freezeTransaction);
11
12
//v2.0.5
Copied!
Go
1
//Create an unsigned transaction
2
transaction := hedera.NewAccountCreateTransaction().
3
SetKey(newKey.PublicKey()).
4
SetInitialBalance(hedera.NewHbar(1000))
5
6
//Freeze the transaction for signing
7
//The transaction cannot be modified after this point
8
freezeTransaction, err := transaction.FreezeWith(client)
9
if err != nil {
10
panic(err)
11
}
12
13
println(freezeTransaction.String())
14
15
//v2.0.0
Copied!

Sample Output:

crypto_create_account { auto_renew_period { seconds: 7776000 } initial_balance: 1000 key { ed25519: "\272g\374\310f\354\274\273bU\256\v\032$e\311\021p\216*L\332\277Y\343\230\277PUmy\373" } receive_record_threshold: 9223372036854775807 send_record_threshold: 9223372036854775807 node_account_i_d { account_num: 6 realm_num: 0 shard_num: 0 } transaction_fee: 100000000 transaction_i_d { account_i_d { account_num: 9401 realm_num: 0 shard_num: 0 } transaction_valid_start { nanos: 469101387 seconds: 1604559135 } } transaction_valid_duration { seconds: 120 } }
Type
Description
build()
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
1
//Create an unsigned transaction
2
AccountCreateTransaction transaction = new AccountCreateTransaction()
3
.setKey(newPublicKey)
4
.setInitialBalance(Hbar.fromTinybars(1000));
5
6
//Freeze the transaction for signing
7
//The transaction cannot be modified after this point
8
AccountCreateTransaction unsignedTransaction = transaction.build(client);
9
10
System.out.println(unsignedTransaction);
11
12
//v1.3.2
Copied!
JavaScript
1
//Create an unsigned transaction
2
const transaction = new AccountCreateTransaction()
3
.setKey(newPublicKey)
4
.setInitialBalance(Hbar.fromTinybars(1000));
5
6
//Freeze the transaction for signing
7
//The transaction cannot be modified after this point
8
const unsignedTransaction = transaction.build(client);
9
10
System.out.println(unsignedTransaction);
11
12
//v1.4.4
Copied!

Last modified 6d ago
Copy link
Contents