Return-Path: Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id D272DC003B for ; Mon, 27 Apr 2020 20:11:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id C1AC385E91 for ; Mon, 27 Apr 2020 20:11:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Noy8MGtVINuE for ; Mon, 27 Apr 2020 20:11:55 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-qk1-f180.google.com (mail-qk1-f180.google.com [209.85.222.180]) by fraxinus.osuosl.org (Postfix) with ESMTPS id BF6C1857CE for ; Mon, 27 Apr 2020 20:11:55 +0000 (UTC) Received: by mail-qk1-f180.google.com with SMTP id 20so19426339qkl.10 for ; Mon, 27 Apr 2020 13:11:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=jAD01V0yoS1/LUgpMPtFBck+GLBhpXJuX2NqmaJfmQQ=; b=U/X3Z+GvMn0an9l/nlrXck2XfoRIuqcPYyi6+mkiaISFWd1S1g4z25NGsQUpFvJANC md851wubbjir7Se4j/wYoHwgM4b/0Lw7OgWMfpnmGDHLg3jjgNdUADZZhzV6cLdc9c7I q6MHRGe9gXL5BdKhFlUgmc90DFNWROFDGoRCS6Qb/oyPj+Mfx0TxurOAhn5Lz6kznYIH zMA3TnsCfhGuQF7fpHgmrquJBaYmCRYZ/kGKTHECXPC6jhH+ne+jrOxggVkGiZW9bxWA YKr8evfzv3KSJJb9XCqbe22QtTociX4Ohn7lCnyub3HMbatLzJ3FTxGRkhczVovf3XKQ gOFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=jAD01V0yoS1/LUgpMPtFBck+GLBhpXJuX2NqmaJfmQQ=; b=ChkkA3uzC8iFr1/v8LSr7OChv6FWpyF9h8JMRl8sTJvn+ILWYH+anAZXyjXAwtvPCR /OeG+AsfNaLdR0eoqktFs7/j3WjxIjSeoUL3U9PkeTaHAygKzoO4W4NQUsN+WmZLrOmO HJAWHbl/0nSvMFnyZnbQsXxzZK+4VjxpkVTlzijOhh6FdvU4kMC75esvNX4U64iqLAqN 9o3RfJ3ix+hBLZxo+25ecaPhMJlBtNeIs8NEmbtg/O8Z7ths0tC25kgLPD8POjrBmh94 EmRzGwmIWncOwp3/EfY7XxaIXinyUxy07iFWzj09bAoo/L4GSo2qkJHAkIMdyFDqpt3L /fHg== X-Gm-Message-State: AGi0Pub0sY56Lwlm2ISSr/QJJGiLclVjucSX3Imw0FTnbWnCg5oBn3tV OZzCcFWosNBmmE20Pb1X2aXIhwULrf9JTBOIDHfUPpZa X-Google-Smtp-Source: APiQypL5rqwfTqxhlZpZv7BHt7B/ni3LJBfUI0/upZF4pHtXB7jqzXceOIllqd3Uh61VnRKnF0PvhrN++BsPia9m1cs= X-Received: by 2002:a05:620a:1649:: with SMTP id c9mr24504194qko.396.1588018314344; Mon, 27 Apr 2020 13:11:54 -0700 (PDT) MIME-Version: 1.0 From: Riccardo Casatta Date: Mon, 27 Apr 2020 22:11:43 +0200 Message-ID: To: Bitcoin Protocol Discussion Content-Type: multipart/alternative; boundary="00000000000086007c05a44b5397" X-Mailman-Approved-At: Mon, 27 Apr 2020 20:44:23 +0000 Subject: [bitcoin-dev] PSBT in QR codes X-BeenThere: bitcoin-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Bitcoin Protocol Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2020 20:11:56 -0000 --00000000000086007c05a44b5397 Content-Type: text/plain; charset="UTF-8" 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 --00000000000086007c05a44b5397 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi all,

there is some discussion happening [1] abou= t 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, h= owever practical limitation are much lower and a PSBT could grow bigger any= way. so the issue is that a PSBT does not fit in 1 QR code.

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

There are proposals suggestin= g alphanumeric mode for QR codes and a header (like message 1 of n) to allow data recon= struction. Main argument for this choices are:
* use of built-in standar= d scanner
* data is copypasteable
* not a big loose in efficiency co= mparing to binary with a proper encoding
* industrial QR=C2=A0code 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 availa= ble mode in QR code specification called "structured append" (page 55 [2]). Corresponding counter-points are= :
* since= data need to be=C2=A0reconstructed, I would avoid built-in scanner and manual appendin= g 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 bi= nary and if we want to be more efficient we need to introduce a new specifi= c encoding
* I don't have a strong counter-point on industrial scanner, ho= wever if they use \r to signal end of transmission they don't support w= ell binary at all, why they don't send how many bytes they read?
<= br>
There are so= me doubts about support of structured append in QR code libraries which is = not widely supported. While this is true I verified the widely diffused zxi= ng library on Android and Luca Vaccaro verified the Apple built-in scanner,= and both this libraries=C2=A0let'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://git= hub.com/cryptoadvance/specter-diy/issues/57
[2] https= ://www.swisseduc.ch/informatik/theoretische_informatik/qr_codes/docs/qr_sta= ndard.pdf


--
Riccardo Casatta - @RCasatta
=
--00000000000086007c05a44b5397--