What is a transaction hash in Ethereum?

Answer

A transaction hash (txHash or txID) is a unique 32-byte (64 hex character) identifier for every transaction on the Ethereum blockchain, derived by hashing the transaction's contents. Example: 0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060. It serves as: (1) Transaction identifier — uniquely identifies a transaction across the entire blockchain history; (2) Receipt lookup key — used to fetch the transaction receipt (status, gas used, events emitted, block number) from any node; (3) Status tracking — wallets and DApps monitor the txHash to determine when a transaction is mined and confirmed. The txHash is generated before mining — the sender hashes the signed transaction data. After submission, the transaction is pending in the mempool until a validator includes it in a block. Etherscan lookup: https://etherscan.io/tx/0x5c504... shows the full transaction details. In ethers.js: const tx = await contract.transfer(to, amount); console.log(tx.hash); await tx.wait() // waits for confirmation.