PSBT (BIP-174, Partially Signed Bitcoin Transaction) Ordering of keys

2

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).

Bjarne

Posted 2019-03-18T09:54:06.647

Reputation: 752

Answers

3

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.

Andrew Chow

Posted 2019-03-18T09:54:06.647

Reputation: 40 910