When serializing a PSBT (BIP-174, Partially Signed Bitcoin Transaction), I cannot find any information if the keys should be ordered when serializing the PSBT?

Under the "Test Vectors" section for the BIP-174 in the last example it is only mentioned that:

A combiner which orders keys lexicographically must produce the following PSBT[...]

But it does nowhere say that it is mandatory to order the keys. What is expected?

I am implementing test cases for a PSBT library and would like to know this to decide if I should compare the serialized PSBTs (where ordering does matter) or the objects themselves (regardless of ordering of keys).

1 Answer 1


There is no mandatory ordering. If you assume your parser is correct, then it is fine to compare the objects themselves. However, to be sure everything is correct, I would suggest that you compare the serialized PSBTs themselves.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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