HAOYUatHZ
    • 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

      This note has no invitees

    • 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
    • Note Insights
    • 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 Note Insights 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

    This note has no invitees

  • 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
    # V 字仇杀队: 使用可验证随机函数(VRF)来消灭矿池 > 这篇文章是对英文原版和论文版的简要阐释,欢迎阅读 [英文原版](https://hackmd.io/nDGr82aLTyaUADKRF4mo6g),更加详尽、严谨。 作者:Runchao Han (runchao.han@monash.edu),Haoyu Lin (chris.haoyul@gmail.com) <!-- ex_nolevel --> 这篇文章介绍了如何通过可验证随机函数(Verifiable Random Function, VRF)来达到消灭矿池的效果, 回归中本聪去中心化、one-cpu-one-vote 的初衷。(就像 V 字仇杀队那样,推翻中心化的集权独裁统治。) ## 矿池中心化问题 在 https://www.blockchain.com/zh-cn/pools 上可以看到,前三大矿池算力加起来已经超过 51% (2020/01/23 日数据)。这时矿池们可以合谋篡改区块链数据,发起双重支付攻击(双花),也可以故意不打包你的交易,等等。矿池甚至可以故意暂停矿池出块,造成网络的临时瘫痪。 ## 可验证随机函数(VRF) 可验证随机函数(VRF)是一种非对称密钥版本的哈希函数。 包含了以下几个组成部分(`α` 是要被哈希的内容, `PK` 是公钥, `SK` 是私钥): - 生成一个哈希 `h`:`h = VRF_hash(SK, α)` - 生成一个 proof `π`:`π = VRF_prove(SK, α)` - 验证 proof: `VRF_verify(PK, α, h, π)` ## 为什么可以用 VRF 来解决 中心化矿池问题 从上面的VRF函数中,可以看到,生成hash需要知道私钥`SK`。 我们的VRF mining的构造是这样的: 我们把 coinbase 奖励设为打到这个 `PK` 地址,然后枚举 nonce,这样就有了不同的区块。然后把原区块头作为`α`、矿工的私钥作为`SK`计算`VRF_hash`。 找到满足难度的哈希结果之后,算出proof `π`, 然后把 `h` 和 `π` 塞到区块头里面。 共识验证的时候,因为 `PK` `α` `h` `π` 都可以拿到,只需要验证`VRF_verify(PK, α, h, π)` 结果是否通过即可。(当然还有别的基本的验证,比如验证是 `h` 否满足难度要求,以及验证 transactions 及其 merkle root,等。) 也就说如果开矿池,矿池就 **必须要把自己的私钥告诉矿工** (因为计算 VRF_hash 需要私钥) ,但是矿池又不可能把私钥告诉矿工,否则就会导致自己的钱全被矿工偷走。而且矿池和矿工双方都没法证明自己有没有偷钱。 具体的哈希函数的设计选取看这里: 1) https://hackmd.io/@ZcwjuAe3RUCFVPrXtvriPQ/S1YM1KZWI#Appendix 2) https://hackmd.io/@ZcwjuAe3RUCFVPrXtvriPQ/S1YM1KZWI#Instantiating-VRF ## 你可能想问 __Q:__ 去中心化挖矿我以前有听说过,比如 P2Pool 什么的。这个相比起来有什么好处呢? __A:__ P2Pool容易被引入算力攻击, 并且网络延迟严重,出块效率很差。事实上 P2Pool 已经好几年没出块了。我们也和现有的其他协议进行了对比,包括 SmartPool,2P-PoW,stratumV2 用的 BetterHash,还有 Andrew Miller 的 non-outsourceable scratch-off puzzle,得出的结论是我们比他们的更好。详见 https://hackmd.io/@ZcwjuAe3RUCFVPrXtvriPQ/S1YM1KZWI#Related-work 简单来说: + SmartPool * 需要链支持智能合约 + BetterHash & 2P-PoW * 并不能消灭矿池,只是减少了矿池的中心化程度 * Andrew Miller's non-outsourceable scratch-off puzzle 1. 构造复杂 2. 只能使矿池丢失新挖到的币,我们的会导致矿池直接丢失私钥。 __Q:__ 我看了一下 2P-PoW,他们用私钥进行签名 来算哈希,这样不也能达到如果想算 PoW 必须知道私钥的效果吗,为什么要用 VRF,有什么意义? __A:__ 2P-PoW的问题在于,他们需要 一个确定性的(deterministic)签名函数(即给定数据和私钥,签名是唯一的),当前常用的签名函数(比如ECDSA)都不满足这个性质。ECDSA引入了一个随机数,来保证安全性。那么同一个 nonce,每次签出来的名不一样,就可以碰撞出满足难度的结果。 这样也就是可以通过不停尝试签名来满足难度,而不需要不停尝试不同的nonce。如果的区块链的挖矿算法是内存困难的(memory-hard)(一般会想用memory-hard的哈希函数来抗 ASIC),矿工可以通过不断尝试签名绕过此memory-hard哈希函数。 <!-- __Q:__ 这个好像不能完美解决 ASIC 问题吧? __A:__ 为VRF选用合适的 h1 h2 就可以了,目前我们正在参考门罗的 RandomX。 --> __Q:__ 私池自己挖呢? __A:__ 这个暂时没有办法解决,我们在看通过 DID 去中心化认证的方式来阻止。但是其实也不用太担心,因为私池算力是有限的,规模一大就要引入很多人管理,就引入了自己人作恶盗窃私钥的风险。 ## 致谢 感谢以下大神们的反馈: + Omer Shlomovits [[1]](https://cyber.biu.ac.il/member/omer-shlomovits/) [[2]](https://twitter.com/omershlomovits), ZenGo co-founder, Lindell 亲传弟子 + [Cheng Wang](https://github.com/polarker), [Alephium](https://alephium.org/) 创始人 + [Jiangshan Yu](https://www.jiangshanyu.com/), Monash University 教授 + [John Tromp](https://github.com/tromp), Cuckoo Cycle 发明者 + [Mikerah](https://github.com/Mikerah), Hashcloak 创始人, v 神2018 年底送了 1k ETH 给她... + Silur [[1]](https://github.com/Silur) [[2]](http://silur.me/) from Algorand + 吴逸飞

    Import from clipboard

    Paste your markdown or webpage here...

    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 has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a 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

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    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

    Note content is identical to the latest version.
    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