Currently, my strategy involves creating a Transaction object (e.g., TransferTransaction) that is configured to meet the necessary requirements, including specifying the required signatures. Next, I freeze the transaction and add any local signatures, and serialize it to allow users to add their own signatures and interrogate the transaction properties.
Once all signatures have been added to the transaction, I execute it. However, if the signatures are not added within the transactionValidDuration, the network returns TRANSACTION_EXPIRED
.
const transferTransaction = new TransferTransaction()
.addHbarTransfer(senderAccountId, new Hbar(1))
.addHbarTransfer(receiverAccountId, new Hbar(-1))
.setNodeAccountIds(nodeId);
//Freeze the transaction from further modifications
const transaction = await transferTransaction.freezeWith(client);
const signature1 = privateKeySigner1.signTransaction(transaction);
//Signer two signs the transaction with their private key
const signature2 = privateKeySigner2.signTransaction(transaction);
//Signer three signs the transaction with their private key
const signature3 = privateKeySigner3.signTransaction(transaction);
const signedTransaction = transaction.addSignature(publicKey1, signature1).addSignature(publicKey2, signature2).addSignature(publicKey3, signature3);
I am curious if there is an accepted pattern for gathering signatures that allows for a longer time frame than the default 180 seconds.