Block
如何從塊的原始十六進制數據確定 TXID?另外,coinbase 交易是什麼?
The coinbase TXID is this: b1fea52486ce0c62bb442b530a3f0132b826c74e473d1f2c220bfa78111c5082 and the second TXID is: f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16, but how can we extrapolate this from this hex data?
交易 ID (TXID) 由交易數據的雙 SHA256 雜湊確定,但以little-endian表示。
例如coinbase交易的交易數據為:
01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0704ffff001d0102ffffffff0100f2052a01000000434104d46c4968bde02899d2aa0963367c7a6ce34eec332b32e42e5f3407e052d64ac625da6f0718e7b302140434bd725706957c092db53805b821a85b23a7ac61725bac00000000
使用 SHA256 對其進行兩次雜湊處理。
SHA256(SHA256(tx_data)) = 82501c1178fa0b222c1f3d474ec726b832013f0a532b44bb620cce8624a5feb1
將字節反轉為小端:
b1fea52486ce0c62bb442b530a3f0132b826c74e473d1f2c220bfa78111c5082
區塊中包含的每筆交易也是如此。