A hexadecimal string (e.g., a transaction ID or block hash).
The hex string with reversed byte order.
Bitcoin internally stores many values (like transaction IDs, block hashes, etc.) in little-endian format, even though they are typically represented and communicated externally in big-endian format.
This function is particularly important in the @caravan/transactions because input
UTXOs provided by users often include transaction IDs in big-endian form
(as shown in block explorers or PSBT files), but Bitcoin Core and many raw
protocols internally require them in little-endian.
Reversing the byte order ensures correct internal processing for our @caravan/transactions-package, matching Bitcoin's expectations.
For example:
Big-endian TXID (user-provided): 6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000
Little-endian (used in raw tx): 000000000019d6689c0815e165831e934ff763ae46a2a6c172b3f1b60a8ce26f
This "quirk" is well-documented and explained in:
Reverses the byte order of a hexadecimal string (i.e., flips endianness).