BIP70/71 issue, RFD



Summary:

In a message to the Bitcoin-development mailing list dated 26th January, 2014, Andreas Schildbach reported an issue with the protobuf format when experimenting with BIP70/71 payment protocol usage in face-to-face payments. Protobufs are not self-delimiting, meaning that if reading from an undelimited stream, one would read endlessly because they don't know how much to read. The current BIP70 implementations probably work because they're reading either from a file or from an HTTP resource which sets the Content-Length header. However, the Content-Length header is optional, and also there are many kinds of streams that don't have this built-in delimiting mechanism. The Java protobuf API solves this by offering delimited I/O, like payment.writeDelimitedTo(os), which writes the size of the message as a varint before writing the data. This leading varint is an incompatible change and would need to be added to the spec. Schildbach encountered this specifically with PaymentMessage and PaymentACK, but it might be a good idea to apply this to all messages if any. NFC NDEF and QR codes are not affected.


Updated on: 2023-06-08T00:47:01.733814+00:00