BitVM中文社区
白皮书BTC Layer2生态BitVM生态BTC 2024 会议BTC测试网水龙头社交媒体
  • 社区介绍
  • 成员招募
  • BitVM
    • 📖英文白皮书
    • 📖中英文白皮书
    • 📖BitVM白皮书-详细讲解
    • 🍀BitVM项目概况
    • 🌾基础知识
      • BitVM论文中图1解析
      • 隔离见证的好处
      • Schnorr 签名:简介
      • 谨慎日志合约(DLC):比特币的可扩展智能合约
      • 什么是比特币默克尔化抽象语法树(MAST)?
      • 什么是多重签名钱包(Multisig)?
      • 什么是门限签名(TSS)?
      • 什么是图灵完备
      • 区块、链
      • UTXO与普通账户模型
      • UTXO Vs 普通账户模型
      • PoW共识
      • PoS共识机制
      • 哈希与加密算法
      • 点时间锁合约(PTLC)
      • 基于 Taproot 的闪电通道
      • Taproot 及 MuSig2 回顾
      • Taproot是什么(比特币升级Taproot)
      • SegWit和Taproot是什么?二者之间的差异与各自优势
      • DPoS共识机制
      • 比特币脚本研究
      • 零知识证明介绍
      • Optimistic Rollups
      • Rollup:详解ZK Rollups、Optimistic
  • 👨重要人物
    • Robin Linus
  • BitVM精选文章
    • 与BitVM有关的重要信息
    • BitVM:比特币层计算的突破
    • BitVM 入门
    • 深入探讨BitVM - 表达图灵完备比特币合约的计算范式
    • BitVM and Bridges-侧链桥
    • What is BitVM?
      • What is BitVM? with Robin Linus and Super Testnet (SLP520)
      • BitVM是什么?与Robin Linus和Super Testnet详细讲解
    • Robin Linus on BitVM
      • BitVM:Bitcoin的链下合约
      • BitVM:Off-chain Bitcoin Contracts
      • PPT中文版
      • PPT英文版
    • BitVM:图灵完备的 Taproot 智能合约
    • BitVM 在比特币上实现智能合约
    • 全面解析ZK Rollups和Optimistic Rollups
    • Optimism Rollup原理详解【以太坊L2方案】
    • 要在比特币上计算任何内容,资深开发者们怎么看BitVM?
    • BitVM 是什么?图文讲解
    • BitVM 脑洞大开,复杂概念和落地可行性剖析
    • BitVM:开启比特币的智能合约时代
  • 🆚生态对比
    • 从比特币应用编程理解 CKB 的可编程性
    • BitVM 与 RGB 协议:瞄准比特币生态的“双星”
    • 什么是 RGB 协议?
    • 牛市第一响:BTC L2将造就alpha之王
    • 比特币L2的机会
  • BitVM项目
    • BitVM项目概览
    • Bitlayer
      • Bitlayer 介绍
      • Bitlayer快速了解
      • 一文了解 Bitlayer:构建比特币计算层
      • Bitlayer Research:DLC 原理解析及其优化思考
    • zkBase
      • 为什么市场需要 ZKBase?
      • 了解 ZKByte:基于零知识证明和 BitVm 的比特币 Layer2 拓展解决方案
    • Bitstake
      • Bitstake 简介:基于 BitVM 的权益证明桥
    • Citrea
      • Citrea 概述:比特币首个 ZK Rollup
  • Runes
    • 作者
    • 优质文章
      • 为什么说 Runes 符文赛道即将爆发?
      • 超越BRC20?一文读懂比特币符文协议Runes的前世今生
      • 解读Runes协议:两大发行方式、文化与玩法
      • xiyu 对 Runes 协议的解读:提供了一种在比特币网络上创建和转移符号化资产的方法
      • 解读Runes协议:发展历程及其最新「公开铭刻」发行机制的拓展
      • Ordinals创始人Cesay:首次全面介绍Runes协议
      • Runes预挖矿概念:一文读懂Rune Kingdom符文龙
      • Runes是一个Bitcoin Token Standard协议
      • 一文读懂 Runes 与 BRC20 等同质化代币协议的对比
      • Ordinals创始人首谈Runes协议细节:前10个Runes只支持Open mint
      • 一文看懂BRC20、Atomicals、RUNE等协议的独特之处
    • 视频
      • No129. 什么是符文Runes协议?Runes协议几个关注度高的项目介绍
      • 比特币牛市行情下个热点赛道布局 | 符文协议 runes protocol | 什么是符文协议Runes
      • 被譽為下一個「銘文」的「符文」是什麼?Runes協定主網上線時間已定?|秒懂符文
  • btc
    • 📖白皮书
      • 中英文
      • 注解版
    • 📖《精通比特币》第二版
      • 原版序言
      • 中文版序言
      • 译者序
      • 第二版更新内容
      • 术语
      • 目录
      • 第一章 介绍
      • 第二章 比特币工作原理
      • 第三章 比特币核心
      • 第四章 密钥和地址
      • 第五章 钱包
      • 第六章 交易
      • 第七章 高级交易和脚本
      • 第八章 比特币网络
      • 第九章 区块链
      • 第十章 挖矿和共识
      • 第十一章 比特币安全
      • 第十二章 区块链应用
      • 附录A-1 比特币白皮书吴忌寒翻译
      • 附录A-2 比特币白皮书李笑来翻译
      • 附录B、交易脚本语言操作符,常量和符号
      • 附录C:比特币改进提案(BIP)
      • 附录D:Bitcore
      • 附录E:pycoin库、实用密钥程序ku和交易程序tx
      • 附录F:Bitcoin Explorer(bx)命令
    • 📖《精通比特币》第三版
    • 🌾精选文章
      • BTC生态扩容方案巡礼(1):铭文何去何从
      • BTC生态扩容方案综述
  • 培训
    • Web3技术培训
  • BTC 生态项目汇总
    • 图文版
  • 比特币 二层
    • Rollup
      • Bitlayer
      • QED Protocol
      • BitVM
      • Bison
      • B² Network
        • B² Network技术实现:基于零知识证明验证承诺的比特币ZK-Rollup
      • Chainway
      • bl2
      • Rollux
      • BOB
      • Hacash.com
      • BeL2
      • LumiBit
        • 详解原生比特币 Layer 2 网络 LumiBit
    • 比特币侧链
      • BEVM
        • BEVM Founder自述:为什么以及如何做BTC Layer2 ?
        • 以BTC为Gas且兼容EVM的BTC Layer2
      • MAP Protocol
      • Merlin Chain
      • Chain-key Bitcoin (ckBTC)
      • SatoshiVM
        • 比特币 L2 新机会?详解 SatoshiVM 及测试网交互流程
      • Rootstock
      • Libre
      • Stacks
      • Liquid Network
      • Babylon
      • BitBolt
      • Drivechain
      • RGB++
        • RGB++:为正统比特币L2添砖加瓦
        • RGB++ Protocol Light Paper
        • 从RGB到RGB++:CKB如何赋能比特币生态资产协议
        • 一文了解提出 RGB++ 协议的比特币二层:CKB
        • RGB++:比特币 L2 资产的新思路
    • 数据可用性
      • Veda
      • Nubit
    • 状态通道
      • OmniBOLT
      • Lightning Network
    • 客户端验证
      • BiHelix
      • RGB
    • 其他
      • Path Protocol
      • Bool Network
      • Dovi
      • Bitfinity Network
      • U Protocol
      • Botanix
        • Botanix protocol
      • AiPTP
  • BTC 基础设施
    • 链下索引
      • UniSat
      • Rooch Network
    • 资产协议
      • Layer1
        • Ordinals序列协议
          • BRC20.com
          • LRC-20/LTC-20
          • ORC-20
            • Ordinals
          • BRC-100
          • SRC-20(STAMPS 协议)
            • SRC20 OpenStamp
          • Runes 协议
          • Pipe 协议
          • Tap Protocol
        • Atomical原子协议
          • ARC-20
            • Atomicals Protocol
      • Layer2
        • BitVM
        • Lightning Network
        • RGB
        • Nostr Assets Protocol
    • 资产桥
      • DLC.Link
      • Liquidium
      • BoringDAO
      • GoWrap
      • XLink
      • MultiBit
      • UniRouter
      • VMPX
      • OrdBridge
      • BRCport
      • SoBit
      • BitSwap
      • SaxBridge
      • Ordinfinity
      • Shell Trade
    • 预言机
      • 概览
        • 预言机赛道大全图谱(经典收藏)
        • OKX Ventures研报:重新思考预言机,看到及未被看到的
      • Chainlink
        • 万字拆解 Chainlink 2.0 构成背景、技术原理、经济模型与未来挑战
        • Chainlink (LINK) 资金面情况及近期发展动态
      • Band Protocol
        • 投资 Band Protocol (BAND) – 您需要了解的一切
      • Pyth Network
        • Pyth Network 研报:Solana 生态预言机发展现状与前景分析
      • Supra
        • Supra万字研究报告: Intralayer中间件,能否撼动Link预言机龙头地位?
  • twitter-space
    • 怎么样的 BTC Layer2 更有机会胜出?
      • 全文
    • BTC Layer2 技术创新盘点
      • 全文
    • 比特币L2混战:从业者 / 市场如何选择?
      • 全文版
      • 精简
  • BTC Layer2 周报
    • BTC Layer2 68个项目盘点
    • 2024.3.11 - 2024.3.17
    • 2024.3.4 - 2024.3.10
    • 2024.2.19 - 2024.2.25
  • BitVM 周报
    • 2024.3.18 - 2024.3.24
    • 2024.3.11 - 2024.3.17
    • 2024.3.4 - 2024.3.10
    • 2024.2.26 - 2024.3.3
  • BTC 2024 会议
    • 比特币复兴 2024:按主题演讲和专题小组分段
由 GitBook 提供支持
在本页
  • BitVM: Compute Anything on Bitcoin
  • 1 Introduction
  • 2 Architecture
  • 3 Bit Value Commitment
  • 4 Logic Gate Commitment
  • 5 Binary Circuit Commitment
  • 6 Challenges and Responses
  • 7 Inputs and Outputs
  • 8 Limitations and Outlook
  • 9 Conclusion
  • Acknowledgments
  • References

这有帮助吗?

  1. BitVM

英文白皮书

上一页成员招募下一页中英文白皮书

最后更新于1年前

这有帮助吗?

BitVM: Compute Anything on Bitcoin

Robin Linus robin@zerosync.org 2023.12.12

Abstract

BitVM is a computing paradigm to express Turing-complete Bitcoin contracts. This requires no changes to the network's consensus rules. Rather than executing computations on Bitcoin, they are merely verified, similarly to optimistic rollups. A prover makes a claim that a given function evaluates for some particular inputs to some specific output. If that claim is false, then the verifier can perform a succinct fraud proof and punish the prover. Using this mechanism, any computable function can be verified on Bitcoin.

Committing to a large program in a Taproot address requires significant amounts of off-chain computation and communication, however the resulting on-chain footprint is minimal. As long as both parties collaborate, they can perform arbitrarily complex, stateful off-chain computation, without leaving any trace in the chain. On-chain execution is required only in case of a dispute.

1 Introduction

By design, the smart contract capabilities of Bitcoin are reduced to basic operations, such as signatures, timelocks, and hashlocks. The BitVM creates a novel design space for more expressive Bitcoin contracts and also off-chain computation. Potential applications include games like Chess, Go, or Poker, and particularly, verification of validity proofs in Bitcoin contracts. Additionally, it might be possible to bridge BTC to foreign chains, build a prediction market, or emulate novel opcodes.

The main drawback of the model proposed here is that it is limited to the two-party setting with a prover and a verifier. Another limitation is that, for both the prover and the verifier, significant amounts of off-chain computation and communication is required to execute programs. However, these issues seem likely to be solved by further research. In this work, we focus solely on the key components of the two-party BitVM.

2 Architecture

Similar to Optimistic Rollups[1] and the MATT proposal (Merkelize All The Things)[2], our system is based on fraud proofs and a challenge-response protocol. However, BitVM requires no changes to Bitcoin's consensus rules. The underlying primitives are relatively simple. It's mostly based on hashlocks, timelocks, and large Taproot trees.

The prover commits to the program literally bit-by-bit, however verifying all of that on-chain would be too computationally expensive, so the verifier performs a sequence of carefully crafted challenges to succinctly disprove a false claim of the prover. Prover and verifier jointly pre-sign a sequence of challenge-and-response transactions, which they can later use to resolve any dispute.

The model is designed to simply illustrate that this approach allows for universal computations on Bitcoin. For practical applications we should consider more efficient models.

The protocol is simple: Firstly, prover and verifier compile the program into a huge binary circuit. The prover commits to that circuit in a Taproot address which has a leaf script for every logic gate in the circuit. Additionally, they pre-sign a sequence of transactions, enabling a challenge-response game between the prover and the verifier. Now they have exchanged all of the required data, so they can make their on-chain deposits to the resulting Taproot address.

This activates the contract and they can start exchanging off-chain data to trigger state changes in the circuit. If the prover makes any incorrect claim, the verifier can take their deposit. This guarantees attackers always lose their deposits.

3 Bit Value Commitment

The bit value commitment is the most elementary component of the system. It allows the prover to set the value of a particular bit to either "0" or "1" . Especially, it allows the prover to set the value of a variable across different Scripts and UTXOs. This is key, as it extends the execution runtime of Bitcoin's VM by splitting it across multiple transactions.

Similar to Lamport signatures[3], the commitment contains two hashes, hash0 and hash1. At some later point, the prover sets the bit's value either to "0" by revealing preimage0, the preimage of hash0 – or the prover sets the bit's value to "1" by revealing preimage1, the preimage of hash1. If, at some point, they reveal both preimages preimage0 and preimage1, then the verifier can use them as a fraud proof, and take the prover's deposit. That is called equivocation. Being able to punish equivocation is what makes the commitment binding – it is an "incentive-based commitment" .

Combining bit value commitments with timelocks allows the verifier to force the prover

to decide the value of a particular bit within some given time frame.

Figure 1: A concrete implementation for a 1-bit commitment. To unlock this script, the prover has to reveal either the preimage of hash0 or of hash1. In this example execution, the prover reveals hash1, and sets the bit's value to "1" . We can have copies of this commitment to enforce a specific value across different scripts.

4 Logic Gate Commitment

Any computable function can be represented as a Boolean circuit. The NAND gate is a universal logic gate, so any Boolean function can be composed from them. To keep our model simple, we show that our method works for simple NAND gates. Additionally, we show how to compose gates arbitrarily. Together this demonstrates BitVM can express any circuit.

The implementation of a NAND gate commitment is simple. It contains two bit commit- ments representing the two inputs and a third bit commitment representing the output. The Script computes the NAND value of the two inputs to ensure that it matches the committed output bit.

Figure 2: Logic gate commitment for a NAND operation. Executing this script requires to reveal values for the bit commitments A, B, and C, such that A NAND B = C holds.

(Here, we assume for simplicity, that an opcode for OP_NAND exists . Actually it does not exist, however, it can be easily implemented using OP_BOOLAND and OP_NOT.)

5 Binary Circuit Commitment

In the previous section we defined NAND gate commitments. We can express any circuit by composing gate commitments. Every step of the execution is committed to in a Tapleaf. They're are all combined into the same Taproot address, such that the prover could execute any gate in the circuit. Executing a gate requires the prover to open the corresponding gate commitment and set values for its inputs and output bits.

The Taptree might become huge and have a billion Tapleaf Scripts, but its on-chain footprint is minimal.

Figure 3: A random example circuit which has 8 different NAND gates, and 4 inputs A,B,C, and D. Using billions of gates would allow us to define basically any function.

Figure 4: For each gate, the prover's Taproot address contains a leaf script with a corresponding gate commitment. This allows the prover to set the values of the circuit's inputs, (here, A,B ,C, and D), at any point later in time.

6 Challenges and Responses

Committing to a circuit is not enough. To disprove an incorrect claim, the verifier has to be able to challenge the prover's statement. This is possible by them pre-signing a sequence of transactions during setup. The transactions are linked like challenge → response → challenge → response → .... If one of the parties stops engaging then, after some timeout, the other party wins the challenge and can take both deposits. As long as both parties are cooperative, they can jointly settle any contract with a 2-of-2 signature. The following mechanism is required only in case of fraud.

Figure 5: A pre-signed sequence of transactions to perform multiple rounds of challenge-and-response. This sequence is generated during setup.

Vicky chooses a challenge by opening one of the hashlocks in her Tapscript leaves. This unlocks for Paul a specific Tapscript and forces him to execute it. The script forces Paul to reveal the gate commitment challenged by Vicky. Any inconsistent claim can be disproven quickly by repeating this procedure for a few rounds of queries.

If the prover stops collaborating with the verifier off-chain, the verifier needs a way to force his hand on-chain. The verifier does this by unlocking a hashlock: each of the NAND Tapleaves in the prover's UTXO can only be spent if the prover knows a preimage held by the verifier. Therefore, the prover can prove that a given Tapleaf executes correctly by revealing its inputs and outputs, but only if the verifier "unlocks" it for him by revealing the preimage to the hash that guards that Tapleaf. Applying binary search, the verifier can quickly identify the prover's error after just a few rounds of challenge-and-response.

Figure 6: After each response, Vicky can punish equivocation. If Paul ever reveals two conflicting values for a variable, then Vicky immediately wins the challenge and is allowed to take his deposit. Vicky proves Paul's equivocation by revealing for any of his bit commitments both of the preimages.

7 Inputs and Outputs

The prover can set inputs by revealing the corresponding bit commitments. Ideally, they reveal the commitments off-chain to minimize their on-chain footprint. In the noncooperative case the verifier can force the prover to reveal their inputs on-chain.

It is possible to process large amounts of data by exchanging it upfront, but encrypted. This way the prover can reveal the decryption key at a later point in time.

Multi-party inputs are also possible. Gates can have bit commitments from both parties.

8 Limitations and Outlook

It is inefficient to express functions in simple NAND circuits. Programs can be expressed more efficiently by using more high-level opcodes. E.g., Bitcoin script supports adding 32-bit numbers, so we need no binary circuit for that. We could also have larger bit commitments, e.g. it is possible to commit to 32 bits in a single hash. Additionally, scripts can be up to about 4 MB in size. Thus, we can implement substantially more than a single NAND instruction per leaf script.

The model proposed here is limited to two parties. However, it might be possible to have two-way channels, and chain them to form a network similar to Lightning. Exploring the two-party setting might yield interesting possibilities for generalization. For example, we can explore a 1-to-n star topology for the network. Another research question is if we can apply our model to the n-of-n setting and create more sophisticated channel factories. Furthermore, we could combine our system with different off-chain protocols, e.g., the Lightning Network or rollups.

Other directions of research include cross-application memory, how to make statements about arbitrary data inscribed into the chain, or off-chain programmable circuits, i.e. an off-chain VM. It also might be possible to apply more sophisticated sampling techniques, similar to STARKs, to check a circuit in a single round.

The next major milestone is to complete a design and an implementation of a concrete BitVM and also of Tree++, a high-level language to write and debug Bitcoin contracts.

9 Conclusion

Bitcoin is Turing-complete in the sense that encoding fraud proofs in large Taptrees allows to verify the execution of any program. A major constraint of the model outlined here is that it is limited to the two-party setting. Hopefully, this can be generalized in further works.

Acknowledgments

Special thanks to Super Testnet and Sam Parker, who always kept refusing to believe that Bitcoin would not be Turing-complete.

References

[1] Ethereum Research. Optimistic rollups. https://ethereum.org/en/developers/ docs/scaling/optimistic-rollups/, 2022.

[2] Salvatore Ingala. Merkleize all the things. https://lists.linuxfoundation.org/ pipermail/bitcoin-dev/2022-November/021182.html, 2022.

[3] Jeremy Rubin. CheckSigFromStack for 5 Byte Values. https://rubin.io/blog/

2021/07/02/signing-5-bytes, 2021.

Sponsor BitVM developers: bc1qf5g6z0py2t3t49gupeqrlewga0qz2etalu4xf9

For simplicity, from here on, we assume there's an opcode OP BITCOMMITMENT, which is shorthand for the script above. The opcode consumes two hashes and a preimage of one of the hashes. It puts a bit value on the stack, according to which hash is matched by the preimage.

📖
官方链接
www.bitvm.org