本周 Newsletter 总结了关于在 Bitcoin 的 Script 语言中加入最小改动以启用递归契约的讨论,考察了经修订的 OP_TX 操作码提案,并回顾了将输出脚本描述符适配到硬件签名设备的研究。此外,我们照例提供了服务和客户端软件的最新变更、发布与候选发布,以及流行 Bitcoin 基础设施软件的值得注意的代码与文档更新。 另外,我们共同庆祝 Optech 发布第 200 期常规 Newsletter。

新闻

  • 启用 OP_CAT 何时会允许递归契约? 在 Bitcoin-Dev 邮件列表关于重新加入 2010 年被移除的 OP_CAT 操作码的讨论中,开发者 ZmnSCPxj 声称,只有当 OP_CAT 与提议中的 OP_TX(见 Newsletter #187)、OP_CHECKSIGFROMSTACK(CSFS)或类似功能结合使用时,才能实现不可逃避的递归契约——即使用 Bitcoin 共识规则保证合同收到的所有比特币只能再次支付给同一合同。

    递归契约依赖于被称为 交易内省 的技术,即操作码可以分析执行该操作码的交易的部分内容。现有操作码 OP_CHECKSIGBIP65 OP_CHECKLOCKTIMEVERIFYBIP112 OP_CHECKSEQUENCEVERIFY 提供有限的内省能力。提议中的 TX 和 CSFS 操作码则可以灵活地内省交易的所有部分,包括下一输出(支付金额和地址)以及 prevout(上一输出,已接收金额和当前用于授权支出的脚本)。

    如果某个操作码或其他脚本特性被用来确保 prevout 与下一输出完全相同,就可以创建最简单的递归契约。然而,prevout 并不是交易的直接组成部分——它必须从区块链中获取——因此需要在交易中包含 prevout 的副本以便与下一输出进行比较。进一步地,在 Bitcoin 交易的多个部分使用哈希函数似乎阻止了 prevout 脚本直接与下一输出脚本比较;因此,需要从组成元素动态构造 prevout、下一输出或二者——这就是为什么提议的连接操作码(CAT)或类似结构对于递归契约是必要的。

    taproot 出现之前,在交易中包含 prevout 副本的最高效方式通常是将其作为类似数字签名的授权数据提供。如果 prevout 的副本与签名一起提供,就可以通过对交易见证进行内省来检查它,这需要像 TX 或 CSFS 这样的灵活内省机制。提议中的 CTV 与 APO 脚本变更也允许内省下一输出,但它们几乎不能内省见证,因此看起来即便与 CAT 结合也无法创建递归契约。

    Nadav Ivgi 回复称,也可以把构造 prevout 所需的信息副本直接放入 prevout 本身(即在它还是下一输出时就加入该信息)。在创建递归契约时,这仍然需要 CAT 来绕过哈希问题,但这意味着以输出内省为重点的 CTV 与 APO 与 CAT 结合后同样能够创建递归契约。结合 taproot 的特性,Ivgi 还认为通过下一输出验证 prevout 会让契约脚本更易编写,并提供了两个有趣的递归契约示例链接。

    ZmnSCPxj 同意 Ivgi 的分析,并再次表达了他对在 Bitcoin 上启用递归契约风险的担忧(见 Newsletter #190),不过他也在随后帖子中指出,“【仅供参考】递归契约或许是安全的,因为它们实际上并非图灵完备”。

    Russell O’Connor 还引用了 Andrew Poelstra 的一篇帖子(见 Newsletter #134),其中描述了仅凭 CAT 与已有 Bitcoin 特性即可创建非递归契约的强大能力——并且在理论上,如果 CAT 被重新加入 Bitcoin,也可能仅凭它自身创建递归契约。

    以上讨论均围绕对 Bitcoin 的新增提案展开,因此对当前已部署的 Bitcoin 系统状态没有任何影响。

  • OP_TX 提案更新:Newsletter #187 所述,Rusty Russell 提出了 OP_TX 操作码(基于先前的提案),允许 tapscript 将执行该脚本的交易的选定部分压栈。例如,Alice 可以将比特币接收至包含 OP_TX(SELECT_LOCKTIME) 的脚本,以把支出交易的 locktime 压栈。借助 TX 的通用交易内省功能,Alice 可以复现 OP_CHECKLOCKTIMEVERIFY(CLTV)的专用内省能力,例如 OP_TX(SELECT_LOCKTIME) <height> OP_GREATERTHAN OP_VERIFY

    在上述示例中使用 CLTV 所占 vbyte 少于使用 TX,但 TX 的灵活性可用于检查 Bitcoin 目前无法内省的交易其他部分。TX 还可能内省交易之外、但完整节点在验证交易时需要的数据。按最初提案,TX 被标记为可启用递归契约,而递归契约目前似乎存在争议(见 Newsletter #190)。

    本周,Russell 提出 了受限版本的 TX,仅允许访问 OP_CHECKTEMPLATEVERIFY(CTV)所使用的字段,且仅采用 CTV 所消耗的同一哈希摘要格式。BIP119 CTV 专门设计为无法与任何现有 Script 特性组合创建递归契约,因此受限 TX 应提供同等功能且同样不会启用递归契约。

    此外,受限 TX 设计为未来软分叉可轻松扩展其内省功能,包括在有共识时可选启用递归契约的特性。截至撰写时,已有两位开发者建议通过稍作扩展来使用 TX:

    • 改进的保险库原语: Russell 的提案建议扩展,以便将交易每个输出的 satoshi 数量压栈。Brandon Black 建议再包括每个 prevout(输入)金额,这将简化创建保险库。Black 特别提议复制数月前 OP_TAPLEAF_UPDATE_VERIFY(TLUV)提案中的 OP_IN_OUT_AMOUNT 操作码能力(见 Newsletter #166)。

    • 利用交易内省防止 RBF(RBF)固定攻击: Gregory Sanders 指出,基于 SIGHASH_ANYPREVOUT 操作码的 Eltoo 层可能因与 BIP125 规则 #3 交互而易受交易固定攻击(见 Newsletter #27)。Sanders 建议让 TX 能够将交易权重(大小)压栈,参与者即可对 eltoo 通道中的交易设定最大尺寸限制,消除依赖膨胀交易大小的一类固定攻击风险。这与 Newsletter #191 中提到的防止 CPFP(CPFP)固定的想法在概念上相似。

  • 为硬件签名设备适配 miniscript 与输出脚本描述符: Salvatore Ingala 在 Bitcoin-Dev 邮件列表发布了他为硬件签名设备实现输出脚本描述符(描述符)与 miniscript 的工作。他指出,签名设备尤其关注策略验证——用户需要了解批准交易后会发生什么,但又不应被提示过多无关信息,以确保资金安全。由于许多签名设备的屏幕尺寸较小且验证信息困难,如何尽可能紧凑地显示信息也很重要。Ingala 提出若干针对描述符的改进建议来解决这些问题:

    • 策略注册: 在设置签名设备时,用户应使用设备验证其首选策略。对于具有持久存储的设备,应将已注册策略保存至设备;对于无存储的设备,设备应返回加密安全的注册证明,使得每次启动设备时可快速重新加载该证明和策略。提案未详细说明策略应如何在设备上注册,但引用了 BIP129 安全多签设置(见 Newsletter #136)。

    • 密钥占位符: Ingala 建议允许策略定义简短占位符来替代在描述符中重复出现的 BIP32 扩展密钥,在解释策略时再用 BIP32 信息替换占位符。这既能显著减小策略字节大小,也能提高人类可读性。Ingala 亦提出了描述符中常用字符串的数个简写。

    • 降低表达能力: 目前仅支持描述符的一个子集;如有需求,后续可添加其他功能。这有助于简化实现。

    截至目前,该提案已在邮件列表上获得一些讨论。

服务和客户端软件的更改

本月特写:我们关注 Bitcoin 钱包与服务的有趣更新。

  • MyCitadel Wallet 发布: MyCitadel Wallet 是一款桌面 Bitcoin、闪电网络与 RGB 钱包,支持多签、PSBTs、segwit、taproot、timelocks、硬件签名设备、描述符等功能。

  • Tauros 交易所支持闪电网络: 墨西哥交易所 Tauros 宣布已支持闪电网络充值与提现。

  • Lightning Multiplexer 发布: 支持 LND 的 Lightning Multiplexer(lnmux)软件通过在入站支付中允许故障转移场景提高闪电网络支付可靠性。更多详情见 Bottlepay 博文

  • Coldcard 新增 taproot 转账: 最新 Coldcard 固件(Mk4 5.0.3,Mk3 4.1.5)已支持向 bech32m 地址发送。

发布与候选发布

流行 Bitcoin 基础设施项目的新版本与候选发布。请考虑升级到新版本或协助测试候选发布。

值得注意的代码与文档变更

本周在 Bitcoin CoreCore LightningEclairLDKLNDlibsecp256k1Hardware Wallet Interface (HWI)Rust BitcoinBTCPay ServerBDK比特币改进提案(BIPs)以及闪电网络规范(BOLTs)中的值得注意的变更。

  • Bitcoin Core #22235:新增脚本可直接从源代码中定义的配置选项生成示例 bitcoin.conf 文件。此改动使得未来 Bitcoin Core 发行版可以预装 bitcoin.conf 文件,而无需另行维护配置选项状态的“第二来源”。

  • LND #6450:新增对支出 taproot 输出的 PSBTs 签名支持。

  • LND #6345:允许 LND 通过反复轮询 Bitcoin Core 获取新交易与区块更新,而不是通过 ZMQ 接收推送更新。

  • BIPs #1309:更新了 BIP119OP_CHECKTEMPLATEVERIFY 示例实现。此前示例包含用 C++ 编写的 Bitcoin Core 操作码实现代码,新示例改为伪 Python,并补充了如何避免在简单实现中可能遭遇的拒绝服务攻击的额外信息,该问题此前已在 Bitcoin-Dev 邮件列表讨论(见 Newsletter #183)。

庆祝 Optech Newsletter #200

每当 Newsletter 累积至 50 期,我们都会花一点时间回顾 Optech 的主要成果。我们这样做,一方面是帮助读者了解我们提供的全部资源,另一方面也是吸引捐赠,以支持我们继续产出有用内容。当然,还有一点点原因是:自豪。

我们并非出于个人虚荣而自夸,而是因为 Optech 的每一位贡献者本身都是其他贡献者的忠实粉丝。与优秀的同事一起协作是一种美好体验,而这些特别的 Newsletter 章节正是我们得以公开表达彼此赞赏之处。

今年,我们决定换个方式。我们想给你们——读者——一个机会,让你们分享对 Optech 贡献者的欣赏。在没有进行任何征集的情况下,我们就在 Twitter 上找到了数十、甚至数百条暖心评价。精彩评论多到难以尽数刊登,因此我们仅选取过去四年中点赞数最高的 50 条。

在下方可以看到这些评论。但首先,我们要感谢过去一年中的主要贡献者——Adam Jonas、Carl Dong、David A. Harding、Gloria Zhao、John Newbery、Mark Erhardt、Mike Schmidt 以及 Shigeyuki Azuchi——同时也感谢众多支持者,包括我们的创始赞助人 Wences Casares、John Pfeffer 和 Alex Morcos。

The 100th issue of @bitcoinoptech was just published. […] It’s one of the best technical newsletters in Bitcoin.

@Bitcoin

Follow @bitcoinoptech and subscribe to the free newsletter for true signal. I don’t understand all of it, but it keeps me bullish regardless of what the market is doing.

@ChartsBTC

Bitcoin Optech @bitcoinoptech has a great overview of what is being worked on currently in Bitcoin. It really shows how much that is actually happening in the Bitcoin space and kills the notion that Bitcoin is “stale old tech”. https://bitcoinops.org/en/topic-dates/

@softsimon
Creator of Mempool.Space

I’d also highly recommend @bitcoinoptech :)

Alexander Leishman
Founder, River Financial

While the consumer market grows and infrastructure advances, work to catalyze enterprise adoption of (a) protocol upgrades and (b) the techniques that allow service providers to operate more efficiently and better serve the growing market, is underway via @bitcoinoptech

Alyse Killeen
Founding Partner, Stillmark

The Bitcoin Optech (@bitcoinoptech) newsletter continues to deliver interesting and detailed content. I just read the [latest] one and it was great.

Andreas M. Antonopoulos
Author of Mastering Bitcoin and co-author of Mastering the Lightning Network

As always, thanks for this newsletter!

Bastien Teinturier
VP of Engineering at ACINQ

@bitcoinoptech does a good job explaining the tech to a technical integrators audience, I would watch their workshop

Ben Woosley
Bitcoin Core Developer and Senior Developer at Unchained Capital

Bitcoin Optech (@bitcoinoptech) was founded in 2018 to bridge the worlds of open-source development and companies. They have come a long way since inception.

Bitcoin Magazine

Incredible roundup of all the major developments in Bitcoin and Lightning during 2018 from the excellent @bitcoinoptech newsletter. Month by month walk through with links. Makes for a nice weekend reading list!

Buck Perley
Engineer at Unchained Capital

Another great newsletter. Thanks @bitcoinoptech !

CardCoins

I think efforts like @bitcoinoptech are improving communication, but we need more!

Carl Dong
Bitcoin Core developer at Chaincode Labs

Get a head start on your New Years resolution to keep up with the wonderful world of Bitcoin development by reading @bitcoinoptech’s 2021 year in review 🌟

Carla Kirk-Cohen
Independent LN Developer and Board Member at Brink, ₿trust, and Qala

A bit behind on Taproot? There is still time and luckily for you @bitcoinoptech has a GREAT workshop that will bring you up to speed: https://github.com/bitcoinops/taproot-workshop/

Can highly recommend. It goes through all the building blocks you need. Go do iiiiiiiit 💪 #Bitcoin #taproot

Elle Mouton
Engineer, Lightning Labs

We [at Bitcoin Magazine] do our best to distill the hard stuff, but @bitcoinoptech is pretty hard to beat if you’re looking for the raw goods.

It’s my favorite non-BM content by far and one of the few newsletters that stay in my inbox until I can actually spend proper time on it.

Flip Abagnale

@bitcoinoptech is honestly amazing

George Kaloudis
Research Analyst for CoinDesk

@bitcoinoptech is a great resource

Gregory Sanders
Bitcoin Developer

Just wanted to say a thanks to the @bitcoinoptech team for their newsletter.

It saves me a TON of time going through chats and emails to just hit the main developments & easily dig deeper into anything particularly relevant or interesting.✊

Guy Swann
Host of Bitcoin Audible

P.S. I want to appreciate developers, educators, and miners who run and improve the network every day.

Folks at @lightning, @ChaincodeLabs, @CryptoGarageInc , @Blockstream, @bitcoinoptech, and many many contributors are doing amazing things.

I really thank you all.

Haegwan Kim

Great summary for the year 👍 @bitcoinoptech

Hong Fang
CEO of OKCoin

Ignoramus: “Bitcoin stopped innovating; development is stalled!”

Me: “@bitcoinoptech’s annual high level review of developments won’t even fully render in my email client because it’s too long.”

Jameson Lopp
Co-founder and CTO at Casa

one of the few newsletters I read every issue of, consistently. thanks @bitcoinoptech

John Light
Human Rights Foundation ZK-Rollup Research Fellow

Immense admiration for the talented and passionate developers dedicated to building #bitcoin. It’s a privilege to support @meshcollider, Antoine Riard, @bitcoinoptech, @mitDCI, dev training…and more to come soon! Please join me in supporting #btc development!

John Pfeffer
Entrepreneur and investor

Giving a shout out to Bitcoin Optech, who (among other things) chronicle technical development in Bitcoin. No hype, no drama, just great information about advances in using and deploying Bitcoin. @bitcoinoptech

Johnathan Corgan

@bitcoinoptech topics are a good first place to start

Jon Atack
Bitcoin Developer

@bitcoinoptech wrote a very nice year-in-review newsletter

Justin Moon

This writeup by […] @bitcoinoptech explains why nonce reuse in a multisig setup is bad and also the challenges in avoiding it. It really helped me understand the issue better. Thanks!

Kalle Rosenbaum
Author of Grokking Bitcoin

There’s plenty of newsletters around crypto stuff to keep you up to date.

One of the ones I’ve religiously followed has been @bitcoinoptech.

highly recommended if you hold some btc and wants to see real work being done to make the protocol better.

Kristian Kho

Important piece by @bitcoinoptech summarizing & cataloging notable coding developments

Leah Wald
CEO at Valkyrie Investments

Don’t you love finding amazing educational resources out of nowhere?

My #1 project this weekend will be @bitcoinoptech’s workshop on taproot, which I only recently discovered.

Lucas Nuzzi
Head of R&D at CoinMetrics.io

Wow - @bitcoinoptech has 25+ contributors!!

The highest quality of #Bitcoin news - peer reviewed by high caliber free software contributors!

Thanks to all the supporters. 🔥🚀

Max Hillebrand
Free Software Entrepreneur

I’m assuming everyone knows about the excellent @bitcoinoptech newsletter by now. But did you know it has a topics page indexed by topic name, event and part of Bitcoin system it impacts? https://bitcoinops.org/en/topic-categories/

Michael Folkson

Thanks to everyone who helped us get here: co-authors @ajtowns, @n1ckler, and @real_or_random, everyone who contributed to the document, the participants in the @bitcoinoptech workshops and structured review, Greg Maxwell for the original idea, and many others.

Pieter Wuille
Bitcoin Developer at Chaincode Labs

[…] it’s almost a full time job trying to summarise what’s happening everywhere. That’s what guys at @bitcoinoptech does, so just following their news letters will give good enough understandings.

Rajarshi Maitra

Once again I enjoyed @bitcoinoptech newsletter […] This is the most informative and best resource and overview for developers and educators.

Rene Pickhardt
Bitcoin and Lightning Network Developer

I recommend the video series from @bitcoinoptech for understanding Taproot, in particular the interactive colab notebook from @digi_james is very helpful for understanding how to use tapscript.

Richard Myers

The @bitcoinoptech newsletter presents cutting-edge developments and updates in #Bitcoin each week.

River Financial

@bitcoinoptech is an incredibly valuable community project and the greater the percentage of the wider ecosystem that is involved and learning best practices, the better

Robert Spigler
OpSec consultant

Follow @bitcoinoptech and sign up for their news letter, 5-9 signal.

Very few sources of bitcoin technical information are this well summarized and explained.

Do it now, so that you don’t forget 😉

Rodolfo Novak
CEO and Co-Founder of Coinkite

As always, @bitcoinoptech provides an expertly crafted summary […]

Ruben Somsen
Bitcoin Sorcerer and co-host of The Unhashed Podcast

trying to read less twitter and more @bitcoinoptech

Sahil Chaturvedi
Product Designer at Unchained Capital

A great example of why Game Theory is so important, in the latest edition of @bitcoinoptech

Sam Wouters
Bitcoin Educator

Great work to the @bitcoinoptech team on a comprehensive job well done with the compatibility matrix.

Samourai Wallet

Nice write up @bitcoinoptech. 👍

Samson Mow
CEO of Jan3

The taproot series has been an invaluable resource for understanding not only the big picture, but also the technical details. Ty to everyone that contributed to this!

Stacie Waleyko
Engineering at Casa

Great and perhaps less well known resource for people learning more about Bitcoin tech: [the] @bitcoinoptech topics pages: https://bitcoinops.org/en/topics/

Stephan Livera
Managing Director at Swan Bitcoin and Podcaster

@bitcoinoptech had a nice writeup of LDK’s approach in February https://bitcoinops.org/en/newsletters/2022/02/23/#ldk-1199

Steve Lee
Lead at Spiral

Thank you @bitcoinoptech, one of the best organizations in Bitcoin, focused on helping the rest of us use Bitcoin and be better Bitcoiners!

Terrence Yang

Our whole team is honored to be included in the most respected and advanced technical #bitcoin newsletter that is @bitcoinoptech

Veriphi

Really, @bitcoinoptech is essential reading material for every bitcoiner.

Zack Voell