Transaction id generation

What type of topic is this?
Discussion | Support

I want to create a transaction id for the given transaction, i am getting 3f41f7df29fe43812ac704e4c09c9bc4fd08944f35cdbe4eb6a626bc140dc0af
but the actual tx id is f8d31957b423a58d4f380f484ebee7894ae7019a6bbac98d7fdf2de0255c54d5

below is the code
class Transaction {
constructor(from, to, optionalField, amount, fee, memo, createdAtTime) {
this.from = from;
this.to = to;
this.optionalField = optionalField; // This could be null or undefined in JavaScript
this.amount = amount;
this.fee = fee;
this.memo = memo;
this.createdAtTime = createdAtTime;
}

// Hashing logic remains the same
hash() {
const transactionData = ${this.from}:${this.to}:${this.optionalField}:${this.amount}:${this.fee}:${this.memo}:${this.createdAtTime};
return crypto.createHash(‘sha256’).update(transactionData).digest(‘hex’);
}
}

// Example usage:

const from = “47867f2cfb85094275c847435fa10cad54a813eba7e6a9bc3538aa2f537f1d73”;
const to = “a1c60efca988c411cd7bc5e481364b9c94caebb24c00e01db269e3a0541ee498”;
const amount = 10;
const fee = 10000;
const memo = "1743238593302000000;
const createdAtTime = 1743238593302000000;
const optionalField = null;

// Create a new transaction
const transaction = new Transaction(from, to, optionalField, amount, fee, memo, createdAtTime);

// Get the transaction hash
const transactionHash = transaction.hash();

// Output the hash
console.log(“Transaction Hash:”, transactionHash);