2

Given a signed Ripple transaction, how do I calculate the txid?

3

The transaction ID is calculated by prepending the bytes 0x54, 0x58, 0x4e, 0x00 to the signed transaction and then taking the SHA512Half of this input.

Example for a signed transaction, bytes are represented as hex strings:

txBlob = "120000228000000024000000026140000000017d64b86840000000000013887321032c03bf7001689bebbb90e79c42deb99bf71be31f7460c1ce66a244635417b35a7446304402205ec87865bb0da66d71d0700ee2dfb901b458da4d32f43a51cf22f331273022d9022013dcb672d61eb53d28cd0c4069a0d12c03c70efc304d65b3665d8ba76c3477288114985d8d3734809d8be363675897ae4a711f1be06483144a3031789de7672be61cb3a5d200ecee0b8e462f"

inserting the prefix yields

txid = SHA512Half("54584E00120000228000000024000000026140000000017d64b86840000000000013887321032c03bf7001689bebbb90e79c42deb99bf71be31f7460c1ce66a244635417b35a7446304402205ec87865bb0da66d71d0700ee2dfb901b458da4d32f43a51cf22f331273022d9022013dcb672d61eb53d28cd0c4069a0d12c03c70efc304d65b3665d8ba76c3477288114985d8d3734809d8be363675897ae4a711f1be06483144a3031789de7672be61cb3a5d200ecee0b8e462f")

txid = "7ca5f7064a4054f0f0687431f5bac32798e06e51b51539687140ac6b5e82f9c7"

SHA512Half is the first 32 bytes of the SHA512 output.

The example transaction above can be found here:

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.