public inbox for bitcoindev@googlegroups.com
 help / color / mirror / Atom feed
* [bitcoin-dev] PSBT in QR codes
@ 2020-04-27 20:11 Riccardo Casatta
  2020-04-28  1:47 ` Christopher Allen
  0 siblings, 1 reply; 2+ messages in thread
From: Riccardo Casatta @ 2020-04-27 20:11 UTC (permalink / raw)
  To: Bitcoin Protocol Discussion

[-- Attachment #1: Type: text/plain, Size: 2496 bytes --]

Hi all,

there is some discussion happening [1] about how to encode a PSBT in QR
codes.

According to the specification (page 15 [2]) a version 40 QR code could
contain up to 3706 bytes of data, however practical limitation are much
lower and a PSBT could grow bigger anyway. so the issue is that a PSBT does
not fit in 1 QR code.

There are proposals suggesting animated QR codes but I don't think it's a
good idea for the following reasons:
* they are not easy to print
* it's not clear, by a human look, how much data it's being transferred,
thus allowing more space for attacks
* old hardware may have resource constraint and not being able to scan

There are proposals suggesting alphanumeric mode for QR codes and a header
(like message 1 of n) to allow data reconstruction. Main argument for this
choices are:
* use of built-in standard scanner
* data is copypasteable
* not a big loose in efficiency comparing to binary with a proper encoding
* industrial QR code scanner put a \r at the end of transmission (making
binary mode difficult to handle with timeouts or similar)

I don't think alphanumeric with custom headers it's a good idea and I think
we should use binary encoding and using the already available mode in QR
code specification called "structured append" (page 55 [2]). Corresponding
counter-points are:
* since data need to be reconstructed, I would avoid built-in scanner and
manual appending of strings anyway.
* we can keep the already used base64 for copypaste
* the best of the encoding we already have, bech32, is 10% less efficient
than binary and if we want to be more efficient we need to introduce a new
specific encoding
* I don't have a strong counter-point on industrial scanner, however if
they use \r to signal end of transmission they don't support well binary at
all, why they don't send how many bytes they read?

There are some doubts about support of structured append in QR code
libraries which is not widely supported. While this is true I verified the
widely diffused zxing library on Android and Luca Vaccaro verified the
Apple built-in scanner, and both this libraries let's you access to the
scanned raw bytes, allowing to parse the structured append header.
For reference, structured append allows to chain up to 16 qr codes, and
contains 1 byte of parity.

[1] https://github.com/cryptoadvance/specter-diy/issues/57
[2]
https://www.swisseduc.ch/informatik/theoretische_informatik/qr_codes/docs/qr_standard.pdf


--
Riccardo Casatta - @RCasatta

[-- Attachment #2: Type: text/html, Size: 3909 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [bitcoin-dev] PSBT in QR codes
  2020-04-27 20:11 [bitcoin-dev] PSBT in QR codes Riccardo Casatta
@ 2020-04-28  1:47 ` Christopher Allen
  0 siblings, 0 replies; 2+ messages in thread
From: Christopher Allen @ 2020-04-28  1:47 UTC (permalink / raw)
  To: Riccardo Casatta, Bitcoin Protocol Discussion

[-- Attachment #1: Type: text/plain, Size: 670 bytes --]

On Mon, Apr 27, 2020 at 1:44 PM Riccardo Casatta via bitcoin-dev <
bitcoin-dev@lists.linuxfoundation.org> wrote:

>
> [1] https://github.com/cryptoadvance/specter-diy/issues/57
>

So that we don't overwhelm the specter-diy maintainers with topics outside
the scope of their project, we are slowly moving the discussion on this
topic to:

        https://github.com/BlockchainCommons/AirgappedSigning/issues/4.

This is also the repository where I hope we can share examples, prototypes,
etc. until we have some consensus among these wallet developers for a
common QR code compatible format for PSBT to submit as an official BIP.

— Christopher Allen

[-- Attachment #2: Type: text/html, Size: 1270 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-28  1:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-27 20:11 [bitcoin-dev] PSBT in QR codes Riccardo Casatta
2020-04-28  1:47 ` Christopher Allen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox