2

I have exported a testnet transaction into a .txn file:

{
    "hex": "45505446ff0002000000000101c6be24d86ab1ae5b54e7e7905b...",
    "complete": false,
    "final": false
}

However, as explained in this article, a raw transaction string starts with version number and:

The version number is four bytes long and is expressed as a hexadecimal value in little endian format.

There are two version types. Version 01 indicates that there is no relative time lock. Version 02 indicates that there may be a relative time lock.

So this hex is not a qualified raw transaction encoding, due to the prefix

45505446ff00

The version number comes after this prefix:

02000000

So I was wondering, what is the function of this prefix that Electrum adds to the raw transaction string? And is it always the same length? Because I need to automatically splice it off in order to get a valid raw transaction string.

2

It stands for:

45505446 - EPTF - Electrum Partial Transaction Format
ff - Separator
00 - EPTF Version - This is currently always 0.

You can verify this quickly by running a python interpreter.

Python 3.6.7 (default, Oct 22 2018, 11:32:17)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> b'EPTF\xff'.hex()
'45505446ff'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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