Cyimon
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee
  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Attempts to bring Programmability, Privacy and Composability to Bitcoin without any changes When writing this article, my heart was beating very fast. Because I know I am describing something very new, I don't know if this plan is completely feasible, but I hope to write it down, discuss all of this with all blockchain enthusiasts, and put it into practice. These ideas are completely based on my own ([xb](https://twitter.com/ocean_xiaobai)) and my teams ([Sin7y](https://twitter.com/Sin7y_Labs))accumulated experience in existing projects ([olavm](https://twitter.com/ola_zkzkvm))and inspired by the paper published by [Robin Linus](https://twitter.com/robin_linus) and his team: [BitVM: Compute Anything on Bitcoin](https://bitvm.org/bitvm.pdf). I have done some active discussions, research, and thinking, and proposed a solution that I think is better, which can mainly introduce two possibilities for Bitcoin. ## 1. Bitcoin has a real programmable Layer2 (zk proof + fraud proof + timelock) In fact, the biggest difficulty in designing Layer2 for Bitcoin lies in how to verify the validity of a Layer2 on Bitcoin. Suppose the Layer2 solution is based on Zero Knowledge (ZK) technology, that is, ZKVM. In that case, the biggest difficulty lies in how to execute a STARK verification contract on Bitcoin (assuming the STARK zero-knowledge proof algorithm is used). If the Layer2 solution is based on Optimsitic (OP) technology, then the biggest difficulty lies in how to execute a smart contract transaction on Bitcoin. In response to the above difficulties, [Robin Linus](https://twitter.com/robin_linus) presented a solution (** fruad proof + timelock **) in the white paper [BitVM](https://bitvm.org/bitvm.pdf), which draws on the fraud proof challenge mechanism in [Arbitrum](https://github.com/OffchainLabs/nitro/blob/master/docs/Nitro-whitepaper.pdf). The specific principles are shown in sections 6.1 & 6.2. In [BitVM](https://bitvm.org/bitvm.pdf), the program will be compiled into bytecode composed of opcodes supported by [BitVM](https://bitvm.org/bitvm.pdf). The paper gives OP_NAND. Since Bitcoin does not support this opcode natively, it needs to be implemented separately (see [Opcodes used in Bitcoin Script - Bitcoin Wiki](https://wiki.bitcoinsv.io/index.php/Opcodes_used_in_Bitcoin_Script) for the opcode currently supported by Bitcoin). The specific details are shown in the following figure: ![](https://hackmd.io/_uploads/SysT0kwZ6.png) [<p style="text-align: center">Fig1. Example in BitVM</p>](https://bitvm.org/bitvm.pdf) According to the execution order of opcodes, these opcodes are formed into a program taptree, as shown in the following figure: ![](https://hackmd.io/_uploads/SkfUJxDW6.png) [<p style="text-align: center">Fig2. Example in BitVM </p>](https://bitvm.org/bitvm.pdf) In this way, according to the bisection protocol, the challenge mechanism is as follows: only log2(n) numbers of challenges are needed to find the instruction that executes the error. As shown in the figure below, assuming that the prover is doing evil in NAND3. ![](https://hackmd.io/_uploads/HJksJeD-T.png) [<p style="text-align: center">Fig3. Example in BitVM </p>](https://bitvm.org/bitvm.pdf) The operating mechanism of BitVM is shown in the following figure: ![](https://hackmd.io/_uploads/HJTkxlv-T.png) [<p style="text-align: center">Fig4. Example in BitVM </p>](https://bitvm.org/bitvm.pdf) Using Arbitrum's fraud proof principle, it is possible to determine whether a prover has committed wrongdoing without the need for a complete transaction replay on Bitcoin, but there are still several drawbacks: 1. At present, [BitVM](https://bitvm.org/bitvm.pdf) only supports one opcode, which, when compiling a complex program, drastically increases its size. Fixed in 10/15/2023, they support a few more opcodes now. 2. Based on point 1, the number of rounds of Bisection Protocol execution will be increased. 3. During the challenge, the verifier needs to re-execute the program to determine the location of the prover's wrongdoing. 4. Before the protocol is executed, the program taptree needs to be encoded between the prover and the verifier, and different programs need to be executed separately. **Points 1 and 2 can be solved by increasing the amount of opcodes of the VM, points 3 and 4 can be solved by introducing ZK technology. 1. Prover generates a proof for the execution of a transaction, while a Challenger of a fraud proof only needs to perform the verification process of the STARK algorithm. 2. Regardless of the original program, the prover and verifier only need to build a verify program taptree and make a commitment, which is fixed and does not need to be executed repeatedly.** That is, a ZKVM needs to be built on top of Bitcoin, not a VM. The new logic will be shown in the following figure: ![](https://hackmd.io/_uploads/ByJtxlP-T.png) <p style="text-align: center">Fig5. Process flows in ZKVM</p> ## 2. Bitcoin has real Programmable Privacy in Layer2 simultaneously If we can build a programmable Layer2 on Bitcoin, then we can define more features on it, because The Challengers always challenge the verification program, so supporting more functions will not affect the entire mechanism. In the articles [Sin7y Tech Review (35) Hybrid Rollup - The Next-Generation Infrastructure](https://hackmd.io/@sin7y/ByKMMcHwh) and [Hybrid Rollup - What do Aztec, Miden, & Ola Hold for the Future of Next-Generation Infrastructure?](https://hackernoon.com/hybrid-rollup-what-do-aztec-miden-and-ola-hold-for-the-future-of-next-generation-infrastructure), we introduced how to define a privacy-focused ZKVM. If we can introduce the Privacy feature into the second layer of Bitcoin, the new logic is shown in the following figure: ![](https://hackmd.io/_uploads/SyA7bgDbT.png) <p style="text-align: center">Fig6. Process flows in Privacy - first ZKVM</p> This allows for building any privacy-free Dapps or any logical privacy Dapps on top of Bitcoin, entirely depending on the needs of the developer. ## 3. Others As mentioned earlier, the above design is a new attempt based entirely on previous experience accumulation and inspiration from [BitVM](https://bitvm.org/bitvm.pdf). This article is mainly to stimulate more developers and researchers to further explore and iterate on potential solutions together. ## 4. References 1. [BitVM](https://bitvm.org/bitvm.pdf) 2. [MATT](https://hackmd.io/@salvatoshi/H11zrr4cq#MATT-General-smart-contracts-in-bitcoin-via-covenants) 3. [Bisection protocol in Arbitrum](https://github.com/OffchainLabs/nitro/blob/master/docs/Nitro-whitepaper.pdf)

    Import from clipboard

    Paste your webpage below. It will be converted to Markdown.

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template is not available.
    Upgrade
    All
    • All
    • Team
    No template found.

    Create custom template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    How to use Slide mode

    API Docs

    Edit in VSCode

    Install browser extension

    Get in Touch

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    No updates to save
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully