I am following this tutorial and writing code to send hbar from my account to another account.
https://docs.hedera.com/hedera/getting-started/transfer-hbar
const sendHbar = await new TransferTransaction()
.addHbarTransfer(myAccountId, Hbar.fromTinybars(-1000)) //Sending account
.addHbarTransfer(newAccountId, Hbar.fromTinybars(1000)) //Receiving account
.execute(client);
let receipt = await sendHbar.getReceipt(client);
However, there is no transaction id in the receipt. How do I get the transaction ID?
The transaction id is generated from the SDK itself. To get the transaction ID of the sendHbar transaction, you can use the getTransactionId method on the transaction object. Here's an example:
const transactionId = sendHbar.transactionId;
console.log("Transaction ID: " + transactionId.toString());
The transaction receipt does not have the transaction id and it's only stored in consensus nodes for only 3 minutes.