<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jon Layton on Medium]]></title>
        <description><![CDATA[Stories by Jon Layton on Medium]]></description>
        <link>https://medium.com/@jon_l?source=rss-d59d8f059b93------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*u_ZwO4pklH-k4ijDrBk6kA.jpeg</url>
            <title>Stories by Jon Layton on Medium</title>
            <link>https://medium.com/@jon_l?source=rss-d59d8f059b93------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 21:54:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jon_l/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A Concept Blockchain]]></title>
            <link>https://medium.com/@jon_l/dream-blockchain-7040ad34eb42?source=rss-d59d8f059b93------2</link>
            <guid isPermaLink="false">https://medium.com/p/7040ad34eb42</guid>
            <category><![CDATA[cryptography]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[bitcoin]]></category>
            <dc:creator><![CDATA[Jon Layton]]></dc:creator>
            <pubDate>Thu, 03 Jan 2019 21:18:08 GMT</pubDate>
            <atom:updated>2019-11-18T09:44:54.162Z</atom:updated>
            <content:encoded><![CDATA[<p>Ideas for a Modernized, Transparent, Proof-of-Work Blockchain</p><p>Base: Latest Bitcoin Core implementation</p><p>SHA256 -&gt; SHA3 universally (opcodes included)</p><p>Corrected Merkle Tree Implementation:<br><a href="https://media.rsk.co/the-design-of-bitcoin-merkle-trees-reduces-the-security-of-spv-clients/">https://media.rsk.co/the-design-of-bitcoin-merkle-trees-reduces-the-security-of-spv-clients/</a></p><p>LWMA1 Difficulty Adjustment:<br><a href="https://github.com/zawy12/difficulty-algorithms/issues/3#issuecomment-442129791">https://github.com/zawy12/difficulty-algorithms/issues/3#issuecomment-442129791</a></p><p><strong>Block Header Improvements:<br></strong>- Change `nVersion` to a `int16_t` bit sequence, saving 16 bits<br>- Remove `nBits` from block header, saving 32 bits (`uint32_t`)<br>- BIP34 active from Genesis / initial `nVersion` (with legacy-encoding patch applied: <a href="https://github.com/bitcoin/bitcoin/pull/14633)">https://github.com/bitcoin/bitcoin/pull/14633)</a><br>- BIP34 height in coinbase `nLockTime` (instead of input script: <a href="https://bitcoin.stackexchange.com/questions/75987/why-was-bip34-block-v2-height-in-coinbase-not-implemented-via-the-coinbase-tx)">https://bitcoin.stackexchange.com/questions/75987/why-was-bip34-block-v2-height-in-coinbase-not-implemented-via-the-coinbase-tx)</a><br>- 64 bit `nNonce`, adding 32 bits (less frequent recalculation of Merkle Root)</p><p><strong>Opcode Improvements:<br></strong> - Remove `OP_SHA1`<br>- Use 12 `OP_NOP`s: `OP_NOP0`-`OP_NOP11`<br>- (Keep `OP_CHECKLOCKTIMEVERIFY` and `OP_CHECKSEQUENCEVERIFY`)<br>- Use 4 `OP_RESERVED`s: `OP_RESERVED0`-`OP_RESERVED3`<br>- Remove `OP_PUSHDATA2` and `OP_PUSHDATA4`<br>- (Keep `OP_PUSHDATA`)</p><p><strong>No SegWit!<br></strong> - Strict enforcement of 1MB blocks<br>- Malleability should be prevented at all costs:<br> - Minimal-size encoding (`CheckMinimalPush`, `IsPushOnly`, etc)<br> - ECDSA canonicalization (`IsValidSignatureEncoding`, enforce low-S, strict DER)</p><p><strong>No Checkpointing!<br></strong> - Nodes can always add their own checkpoints if desired; the reference implementation shouldn’t have any</p><p><strong>No DNS Seeds / Peers!<br></strong> - Nodes should explicitly select their initial peers; the reference implementation shouldn’t have defaults</p><p>Genesis message should be a newspaper article from the day-of; Genesis block should be mined same day</p><p>Completion should be announced loudly &lt;= 3 hours before initial code is released, for ‘fair-start’</p><p><strong>(No alert key)</strong></p><p>Name?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7040ad34eb42" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Songshop Part 1 — Crypto for Artists]]></title>
            <link>https://medium.com/@jon_l/songshop-crypto-for-artists-7accdaae175a?source=rss-d59d8f059b93------2</link>
            <guid isPermaLink="false">https://medium.com/p/7accdaae175a</guid>
            <category><![CDATA[songshop]]></category>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[lightning]]></category>
            <category><![CDATA[bitcoin-private]]></category>
            <category><![CDATA[future-of-technology]]></category>
            <dc:creator><![CDATA[Jon Layton]]></dc:creator>
            <pubDate>Tue, 16 Oct 2018 20:52:13 GMT</pubDate>
            <atom:updated>2019-01-01T23:18:04.617Z</atom:updated>
            <content:encoded><![CDATA[<h3>Songshop Part 1 — Crypto for Artists</h3><p>The possibility of creating and selling one’s own creations has always been completely enticing, to the world. With the internet, Bitcoin, and a web of other related cryptocurrencies, it is now a real option.</p><p>I am excited to present a new pair of ways we can pay for files online. These allow any Bitcoin-style blockchain to have an address-watching backend that stores lightweight transaction receipts and responds by serving files.</p><p>The first setup features / requires a <strong>lightning node </strong>running <a href="https://github.com/ElementsProject/lightning-charge">lightning-charge</a>. It is a Node.js application that simply serves a folder of files. It places the <a href="https://github.com/ElementsProject/paypercall">paypercall</a> middleware in front of a directory listing middleware to intercept requests to each file. Payments are executed without any external credentials, and the user interacts with only his wallet and the browser:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/855/1*t5Q2GDgGCrNIPCkWvkz6TA.png" /><figcaption>Demo repo: https://github.com/ch4ot1c/songshop-lightning</figcaption></figure><p><a href="http://songshop-lightning.jonl.io/buy"><strong>songshop-lightning.jonl.io/buy</strong></a></p><p>It uses my <a href="https://github.com/ElementsProject/lightning-charge">lightning charge</a> invoice server at <a href="http://lightning.jonl.io/">lightning.jonl.io</a>. Feel free to open a channel :)</p><p>This could also be done with their <a href="https://github.com/ElementsProject/paypercall/blob/master/src/reverse-proxy.js">reverse-proxy example</a>, in front of an Apache directory listing, or even a customized shop.The implementation I have chosen is pure Node.js, serving a local directory at routes. You can also use <a href="https://github.com/indexzero/http-server">http-server</a> to do the same sort of thing.</p><p>You get an invoice upon choosing a file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*srvkmGlCB5b7nTlKHSc9jg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/833/1*AMglKh24RAUkCe7t70g8jA.png" /></figure><p>You then pay the invoice with your lightning wallet of choice (Eclair, C-Lightning). When successful, all the user (or client code) has to do is take the X-Token-Headerand add it to the URL query string asX-Token, like so:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AtxNQMJXN_UUwZ8fcbje6Q.png" /></figure><p>and the download begins.</p><p>If visited a second time, a duplicate won’t be served:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U_BpIt2AgqVzGIvxR-7C4g.png" /></figure><p>This is a simple way to sell files from any host that can run Node.js.</p><p>The second approach uses <strong>on-chain</strong> transactions instead: Pay a listed amount to an address listed on a trusted artist’s website, and the response is a file. This file is delivered two ways — by browser session, and by email. As for privacy, (this is my favorite part) you only need to input your email and your (sending) crypto address! For simplicity, only p2pkh transactions are supported for now (addresses begins with a 1 in BTC).</p><p>I haven’t seen a platform that does 1-product, 1-address yet, and am genuinely optimistic about its effectiveness as a simple representation of a <strong>‘vending machine’</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/861/0*mVhEvv09wKqGkLTu.png" /><figcaption>Demo repo: <a href="https://github.com/ch4ot1c/songshop-btcp">https://github.com/ch4ot1c/songshop-btcp</a></figcaption></figure><p><a href="http://songshop-btcp.jonl.io/store-demo"><strong>songshop-btcp.jonl.io/store-demo</strong></a></p><p>The implementation above uses Bitcoin Private as an example. It therefore uses its bitcore-lib-btcp driver. This is easily swappable for most currencies (<a href="https://github.com/bitpay/bitcore-lib">see here</a>). There are plans in store to make this watch-only HD wallet even simpler and more robust, but <a href="https://github.com/bitcoin/bitcoin/issues/14449">complications with Bitcoin Core’s curennt daemo</a>n have made this a challenge thus far. Therefore, I wrapped it (using Bitcore) so we could get started. Main goals included emailing and instant-downloading upon both zero and n-confirmations.</p><p>Upon payment, you will (should) receive a copy the corresponding guitar note, played by yours truly. Enjoy!</p><p>This is a great step in the world of peer-to-peer payments, enabling people to have absolute control over the distribution of their media.</p><p>I will continue adding to and refining these implementations, but this initial code is enough to get anyone started on selling their digital creations. Artists and content creators are welcome to comment asking for setup help or features; hopefully you find this to be valuable and useful.</p><p>No payments discussion would be complete without <a href="https://github.com/btcpayserver/btcpayserver-doc">BTCPayServer</a>, which is one of the premier projects in the space. It supports multiple coins at a time, and handles all address types. I hope to add <a href="https://jwt.io/introduction/">JWT link</a> sales to their platform as well, enabling these sorts of convenient digital downloads.</p><p><strong>As a note:</strong> One alternative model allows a user permission to re-download the file as many times as they like once they’ve bought it, as long as they sign with the original purchasing address/key. This could be easily added as an option in the on-chain example.</p><p>Thanks for reading!</p><p>Coming Next — Enhancements, Ethereum options, Z address opportunities, and more stupid-simple self-hosted crypto payment platforms ❤</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7accdaae175a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Paypercall — Making Bitcoin’s Lightning Network Useable]]></title>
            <link>https://medium.com/@jon_l/the-most-important-repo-in-bitcoin-852705caacc7?source=rss-d59d8f059b93------2</link>
            <guid isPermaLink="false">https://medium.com/p/852705caacc7</guid>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[self-hosted]]></category>
            <category><![CDATA[lightning-network]]></category>
            <category><![CDATA[https]]></category>
            <dc:creator><![CDATA[Jon Layton]]></dc:creator>
            <pubDate>Sat, 06 Oct 2018 00:00:32 GMT</pubDate>
            <atom:updated>2019-01-01T23:22:07.841Z</atom:updated>
            <content:encoded><![CDATA[<h3>Paypercall — Making Bitcoin’s Lightning Network Useable</h3><p>The <strong>Paypercall</strong> repository is the most promising path to “adoption” thus far.</p><p>This repository lets you add Lightning Network payment invoicing to a normal HTTP user experience: <a href="https://github.com/ElementsProject/paypercall">https://github.com/ElementsProject/paypercall</a></p><p>Satoshi even had this desire in his whitepaper — but the feature was <a href="https://bitcointalk.org/index.php?topic=9334.0">removed</a> as part of layer one:</p><blockquote>It can already be used for pay-to-send e-mail. ... If someone famous is getting more e-mail than they can read, but would still like to have a way for fans to contact them, they could set up Bitcoin and give out the IP address on their website. “Send X bitcoins to my priority hotline at this IP and I’ll read the message personally.”</blockquote><p>Interestingly, this is the premise for <a href="https://earn.com/">earn.com</a> (originally 21.co): On-chain payments to a convenient web-based location. For example, <a href="https://earn.com/jon_l">earn.com/jon_l</a>. Coinbase acquired them last year. Back when I originally heard about this, it was young tech. An on-chain, receive-only system. Now it has become their passive cash cow. It is wildly centralized though, and offers little room for users to leverage domains they own.</p><p><strong>These original constraints are both superseded by the new possibilities of Layer 2 (Lightning Nodes). It is now reasonable to do Pay-to-IP, but simply for convenience — not as a base layer feature.</strong></p><p>Check out the rest of Satoshi’s quotes about micropayments:</p><p><a href="https://satoshi.nakamotoinstitute.org/quotes/micropayments/">https://satoshi.nakamotoinstitute.org/quotes/micropayments/</a></p><p>He insisted that this will be possible, depending mostly on the infrastructure of the future. As of mid-2018, I think we’ve finally encountered the bridge! It is a simple connector between HTTP servers and Bitcoin.</p><h3>How it works</h3><p>Everyone is familiar with browsing the web of domains (and therefore IPs), and crypto heads are now all familiar with ideas of wallets and smart-contracts.</p><p>In terms of ownership, and even centralization, people are quickly realizing the rules — <strong>You only own keys you own and haven’t compromised.</strong> Fortunately for Bitcoin users, this is a first principal. For “normal” users though, who think in terms of domains (DNS / TCP-IP), there is trouble ahead. Web browsers like Google Chrome introduce a lot of vectors for spying, and possibility of ISP and DNS-driven attacks make the world of “websites” actually significantly less reliable than a pure cryptographic protocol (see historical uptime / successful attacks).</p><p>However, regardless of security woes, most users on the internet understand websites as the primary navigational entity. So they aren’t / can’t be wrong — but the two worlds must be merged! <strong>PayPerCall</strong> allows us to do this.</p><p>Serving a webpage is the same as serving any other web resource — an HTTPS request for the resource is made at the site &amp; route (https://test.com/hi), offering a slew of initial information, including the client’s configuration. The “target resource” — actually a file, which is exposed by a server (at a “route”), which is assigned to an IP/port, which is assigned to a domain — then replies with the resource. When we click around many pages per day, this is what happens behind the scenes.</p><p>The internet today is as free as it ever will be. We wander around with only our time as a cost, and our mind as a looking glass.</p><p><strong>Now, anyone can add a paywall in front of any resource they own.</strong></p><p>This is simple to do with Paypercall. It uses <a href="https://github.com/ElementsProject/lightning">C-Lightning</a>, which is one of the implementations of the Lightning Network.</p><p>In the initial request/response, at <a href="https://test.com/song1">https://test.com/song1</a>, here is the response:</p><pre>(Visit <a href="https://test.com/song1">https://test.com/song1</a>)<br><br>HTTP/1.1 <strong>402 Payment Required</strong><br>Content-Type: application/vnd.lightning.bolt11<br>X-Token: lmbdmJeoSQ0ZCB5egtnph.af1eupleFBVuhN2vrbRuDLTlsnnUPYRzDWdL5HtWykY<br><br>lnbc8925560p1pdfh7n2pp54g5avyupe70l988h30u0hy8agpj2z7qsveu7ejhys97j98rgez0...</pre><p>We then interpret the lnbcrt... (‘Lightning Network BitCoin’) ...8925560p... (8925560 picoBTC), probably automatically with our lightning-friendly Bitcoin wallet, such as <a href="https://github.com/LN-Zap/zap-desktop">Zap</a> or <a href="https://github.com/ACINQ/eclair-wallet">Eclair</a>. Now we’re ready to pay, and then submit the second &amp; final request:</p><pre>GET <a href="https://test.com/song1">https://test.com/song1</a> \<br>Header: &#39;X-Token: lmbdmJeoSQ0ZCB5egtnph.af1eupleFBVuhN2vrbRuDLTlsnnUPYRzDWdL5HtWykY&#39;<br>Body: (Anything the endpoint might originally expect for processing)<br><br>HTTP/1.1 200 OK<br>Content-Type: application/json<br><br>{&quot;success&quot;:true,&quot;data&quot;:&quot;hooray&quot;}</pre><p>Boom. This also works in smart-contract-driven realtime — a significant improvement over the on-chain analog where you would have to await one or more new blocks to be mined (many minutes).</p><p>The best part is that this can be self-hosted. Nobody is in control of your digital assets, and whichever you specify are for-sale.</p><p>Welcome to the future! 🔮</p><p>To get started, fetch the repo: <a href="https://github.com/ElementsProject/paypercall">https://github.com/ElementsProject/paypercall</a></p><p>To get a C-Lightning node set up on a Raspberry Pi, see <a href="https://medium.com/@meeDamian">https://medium.com/@meeDamian</a>’s fantastic guides</p><p><strong>Notes:</strong></p><p>To read about the original removal of Pay-To-IP, see <a href="https://bitcointalk.org/index.php?topic=9334.0">https://bitcointalk.org/index.php?topic=9334.0</a></p><p>For more info about interpreting the Lightning invoice, see <a href="https://github.com/lightningnetwork/lightning-rfc/blob/master/11-payment-encoding.md#human-readable-part">https://github.com/lightningnetwork/lightning-rfc/blob/master/11-payment-encoding.md#human-readable-part</a></p><p>I will have a followup post with concrete examples (both on-chain and off-chain) this week — stay tuned!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=852705caacc7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Curriculum — Fast Track to Bitcoin]]></title>
            <link>https://medium.com/@jon_l/education-ideas-35b23ca0fd5b?source=rss-d59d8f059b93------2</link>
            <guid isPermaLink="false">https://medium.com/p/35b23ca0fd5b</guid>
            <category><![CDATA[education]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Jon Layton]]></dc:creator>
            <pubDate>Tue, 24 Jul 2018 14:43:12 GMT</pubDate>
            <atom:updated>2019-11-18T09:57:52.110Z</atom:updated>
            <content:encoded><![CDATA[<h3>Learning Track to Bitcoin</h3><p>A concept for an Applied Computer Science curriculum.<br>No age or time constraints.</p><p>Phonics + Letters + Words + Numbers</p><p>English Vocabulary + Reading Aptitude<br>Arithmetic++ (<a href="http://www.vedicmaths.org/">http://www.vedicmaths.org</a>) + Binary</p><p>Pre-Algebra + Geometry</p><p>BASIC Programming + Robotics Programming</p><p>Algebra</p><p>Digital Logic<br>Statistics</p><p>Git<br>Frontend Web Development + Design<br>Networks</p><p>Data Structures + Algorithms<br>Unix Programming + Cryptography Basics</p><p>Programming Languages + Design Patterns<br>Applied Projects</p><p>Trigonometry + Complex Analysis</p><p>Calculus<br>Linear Algebra + Differential Equations</p><p>Cryptography</p><p><strong>Bitcoin!</strong></p><p>Machine Learning<br>Advanced Statistical Modeling</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=35b23ca0fd5b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[QR Codes and Digital Real Estate]]></title>
            <link>https://medium.com/@jon_l/qr-codes-and-digital-real-estate-cc8f29fe8c4f?source=rss-d59d8f059b93------2</link>
            <guid isPermaLink="false">https://medium.com/p/cc8f29fe8c4f</guid>
            <category><![CDATA[qr-code]]></category>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[lightning-network]]></category>
            <dc:creator><![CDATA[Jon Layton]]></dc:creator>
            <pubDate>Thu, 14 Jun 2018 16:00:30 GMT</pubDate>
            <atom:updated>2018-10-05T15:29:33.852Z</atom:updated>
            <content:encoded><![CDATA[<p>Let’s consider an application like <a href="https://satoshis.place/"><strong>satoshis.place</strong></a>. Shoutout to <a href="http://twitter.com/LightningK0ala">@LightningK0ala</a> for his creation 😍! Possibly the coolest LApp to-date!</p><p>- 1 million pixels, 16 colors, 1 sat / px cost</p><p><strong>So then I got to thinking, what can we learn or invent here?</strong></p><p>- First: is there any incentive to cooperate (“live and let live”)? At some point, you cannot help but run over old art. If you’re rich enough, what would you do? Would you play? How destructive are you? Very, and rich? Go ahead. Classic.</p><p>- You could, due to the exacting nature of a pixel wall, present an address via a denser encoding — hex — but <strong>based on the color indices</strong>, L-&gt;R, 0-&gt;15, as the numerals. This would only require any “obvious” start and end sequence...</p><p>This sounds alot like a QR code and its “eyes”, which densely and with up to 30% error correction (resistance-to-random-pixels) presents data such as:</p><p>- A message.<br>- An email address.<br>- A private key with no money in it.<br>- A private key with money in it.<br>- A shielded address for your favorite zk-snarks-enabled privacy coin.<br>- A standard bitcoin address.<br> <br>A QR code, for <a href="https://satoshis.place/">satoshis.place</a>, serves as both a pixel-dense and therefore cost-dense representation of textual data.<br> <br>Let’s consider an address encoded as a QR and its resilience — “hopefully the address doesn’t get corrupted!”:</p><ol><li>When reinterpreted as base58check, it will be easy to verify whether corrupt; the <a href="https://en.bitcoin.it/wiki/Base58Check_encoding#Creating_a_Base58Check_string">4 checksum bytes</a> at the end must reflect the rest of the data.</li><li>The <a href="https://en.wikiversity.org/wiki/Reed%E2%80%93Solomon_codes_for_coders#QR_code_structure">QR code</a> has Reed-Solomon error-correction, serving as an added defense layer built just for 2D applications like this. These both hold, safely preventing erroneous sends, unless the QR datagram gets completely <strong>changed 🤔</strong>…</li></ol><p>Maxing out the error correction at 30% (using a level-H QR code) <strong>creates the highest cost for a user to overwrite your datagram, per pixel</strong>. There is a minimum cost of width² satoshis associated with placing any QR code, as the initial artist.</p><p>Let’s consider a user’s options are P2PKH as base58check, or the newer P2WPKH as bech32.</p><p>From Wuille and Maxwell’s discussion in <a href="https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#motivation">BIP-0173</a> —</p><blockquote>Base58 needs a lot of space in QR codes, as it cannot use the alphanumeric mode.</blockquote><p>And as for the length changes —</p><blockquote>…addresses are always between 14 and 74 characters long… Version 0 witness addresses are always 42 or 62 characters, but implementations MUST allow the use of any version.</blockquote><p>I made a few examples with <strong>pyqrcode</strong>, because it handles “mode” selection properly:</p><pre>import pyqrcode</pre><pre>pyqrcode<strong>.</strong>create(&#39;bc1qcwwpcpxc46dqxx6jej88xe4xwufe5j8xkp0uk6&#39;.upper(), error<strong>=</strong>&#39;H&#39;, mode<strong>=</strong>&#39;alphanumeric&#39;).svg(&#39;qr_h_bech32.svg&#39;)</pre><pre>pyqrcode.create(&#39;bitcoin:195UZWyU794SP8QJ33bLfEL4dcGusTMURa&#39;, error=&#39;H&#39;, mode=&#39;binary&#39;).svg(&#39;qr_h_base58check.svg&#39;)</pre><pre>pyqrcode<strong>.</strong>create(&#39;bc1qcwwpcpxc46dqxx6jej88xe4xwufe5j8xkp0uk6&#39;.upper(), error<strong>=</strong>&#39;L&#39;, mode<strong>=</strong>&#39;alphanumeric&#39;).svg(&#39;qr_l_bech32.svg&#39;)</pre><pre>pyqrcode.create(&#39;bitcoin:195UZWyU794SP8QJ33bLfEL4dcGusTMURa&#39;, error=&#39;L&#39;, mode=&#39;binary&#39;).svg(&#39;qr_l_base58check.svg&#39;)</pre><p>Here is the corresponding Google Charts API (replace the &lt;text&gt;):</p><blockquote>https://chart.googleapis.com/chart?cht=qr&amp;chs=&lt;width&gt;x&lt;height&gt;&amp;chld=&lt;L,H&gt;|0&amp;chl=&lt;address-text-as-utf-8&gt;</blockquote><p>And here are the results:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/45/1*Te-mW3itrY201m84Ru5loA.png" /><figcaption>qr_h_base58check</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/41/1*S8UJ8kAaWymPM-LemL6cTg.png" /><figcaption>qr_h_bech32</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/37/1*KZO7q_NPyGwZANjdtjm0Gw.png" /><figcaption>qr_l_base58check</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/33/1*K_QI-EdbHh1yGVyzxfI7RQ.png" /><figcaption>qr_l_bech32</figcaption></figure><p><strong>So what improved?</strong></p><p>bech32-p2wpkh: 25x25=625px, vs base58check-p2pkh: 29x29=841px.</p><p>625 vs 841 satoshis. Not bad, a <strong>25.68%</strong> improvement.</p><p>According to <a href="https://developers.google.com/chart/infographics/docs/qr_codes#qr-code-details-optional-reading">Google’s QR reference</a>,</p><ul><li>Version 1 has 21 rows and 21 columns, and can encode up to 25 alphanumeric characters</li><li>Version 2 has 25 rows and 25 columns, and can encode up to 47 alphanumeric characters</li><li>Version 3 has 29 rows and 29 columns, and can encode up to 77 alphanumeric characters</li></ul><p><strong>BIP-0173 has reduced a Version 3 to a Version 2 QR code!</strong> 🎉 (Remember that for the base58check example, it is interpreted in the binary mode, not alphanumeric, and ends up Version 3). Both V2 and V3 have a “fourth eye” in the bottom right corner; BTC addresses can’t be fit into V1 😢 (but a URL with their location could… but I digress).</p><p>So even at lowest error correction, the eye and 25x25 is our constraint for both base58check with SLIP-0044 and bech32. Even if the HRP (bc1)+ SLIP (bitcoin:) prefixes are removed from each, the fourth eye is still there:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/37/1*yzHXAklxbsRn4gCJt0qMpA.png" /><figcaption>base58check_l_noslip</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/33/1*t85yxZgIGSupCbLQlA270Q.png" /><figcaption>bech32_l_nohrp</figcaption></figure><p>So, indeed, <strong>bech32</strong> in alphanumeric mode is optimal! Now which error-correction level do we select?</p><p>The idea would be to post this QR to the artboard as a Really Big Graphic, paying for the oversized version because of the marginal guarantees of resilience (more pixels for an antagonist to overwrite). Placing it at the smallest size (pixel-for-pixel), however, is the most cost-efficient way to do so, but this means low error-correction, and therefore low durability. Using bech32 is the no-brainer, but selecting a resilience is tougher — it depends on how long you care about your artwork (or data) being on the board. These cost functions could be studied further.</p><p>The “eyes” (squares in the corners) could even be corrupted — and as long as you believe they were ever there, they could be repaired manually before scanning (e.g. decoding).</p><p>So, if you plan to upload text to <a href="https://satoshis.place/">satoshis.place</a>, and you want it to “last”, consider using a QR code. Of course, there is an associated cost. And “last” is very relative.</p><p><strong>Final Thoughts</strong></p><p>In theory, it should be feasible to copy down bech32 addresses (by hand, onto graph paper) as QR codes! Do you agree? (25*25)–3*(8*8) = 625–192 = <strong>433px</strong>? You only need a 70%! I think it’s a bit unreasonable, but hopeful.</p><p>There is another specification yet to be discovered, similar to QR, but using <strong>k-bit color</strong> (4-bit in the case of <a href="https://satoshis.place/">satoshis.place</a>) as an additional parameter. I am not knowledgeable enough to invent it optimally, but know that it can exist.</p><p>Please follow-up with your thoughts!</p><p>Thanks for reading! 😸</p><p><strong>Afterword: Room for Chaos</strong></p><p>- The way to make most chaos is by putting distinguishable, barely-funded private keys into this artboard, resiliently encoded (QR). If this becomes popular, they will compete to overwrite eachother with dust-balance private keys, until only occasionally are hidden private keys deciphered and reported. The most irrational users would spend/waste time doing this crypto-archaeology in a sea of random; the second-most irrational users would be posting these keys.</p><p>- John Ratcliffe suggested a “buy protection” feature; the game theory possibilities are limitless, but each new rule introduces a degree of “centralization” that can be forked away from. I wonder where the equilibrium lies?</p><p>- Transitive QR codes: If there is a mass surveillance of cameras sold/distributed, and/or it is hard to get a picture of a given organization’s QR code due to intense censorship, you only need to see it (the plaintext or copyable bech32 QR) for enough time to write it down; this could be important in the future. Pen and paper and DPI matter when computers and internet are uncertain.</p><p>- Final thought: Are QR codes even desirable? Error-correction can be too fuzzy and <strong>cause</strong> errors; error-detection is a more consistently safe pattern. I even found a quote from BIP-0173 regarding this, during my research:</p><blockquote>An unfortunate side effect of error correction is that it erodes error detection: correction changes invalid inputs into valid inputs, but if more than a few errors were made then the valid input may not be the correct input. Use of an incorrect but valid input can cause funds to be lost irrecoverably. Because of this, implementations SHOULD NOT implement correction beyond potentially suggesting to the user where in the string an error might be found, without suggesting the correction to make.</blockquote><p>This really implies that standalone QR codes should never be used at all. Now what 🤷‍♂… <a href="https://stackoverflow.com/questions/27518792/is-it-possible-to-generate-a-qr-code-without-error-correction">Error correction can’t even be disabled!</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cc8f29fe8c4f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>