Daniel A. Nagy
    • 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
    *This document still uses quite a bit of internal jargon. For a public document, all these terms will need to be either explained or omitted. Also, it is work in progress.* # Storage Rewards ## Introduction The Storage Rewards are part of the larger storage incentive system, specifically aiming to provide the following incentives for the storer nodes: * To prioritize the storage of chunks with valid postage stamps. * To maintain stable overlay addresses. * To stay online and synced * To share chunks within the neighborhood. * Not to create sybil nodes with shared storage. These incentives are provided through the on-chain re-distribution of the payments for postage stamps and by penalties for not following the protocol. Note that this mechanism requires that syncing -- the delivery of chunks to all storer nodes in their corresponsing neighborhood -- works reliably and reasonably fast. ## Preliminaries The storage rewards are awarded at regular intervals called *epoch*. Each *epoch* consists of three non-interlapping *phases*, labeled **stake**, **prove** and **claim**. The BZZ amount redistributed in each epoch is equal to the rent subtracted from postage payments during the epoch. (*Maybe the penalties from the previous epoch should also be redistributed?*) Epochs should be sufficiently long for rewards to dominate transaction costs. In order to participate, storer nodes must *stake*, i. e. lock some amount of BZZ in a smart contract. The share from the reward is proportional to the staked amount. So is the potential loss due to penalties. All participating nodes must provide cryptographic evidence to storing all the chunks with valid stamps within their neighborhood's area of resposibility. Nodes sharing at least *d* most significant bits in their overlay addresses are said to be within the same neighborhood. The depth *d* is available from an on-chain oracle and is defined as follows: Any two nodes with at least *d* identical most significant bits in their overlay address must be connected. For any sequence of *d* bits there are at least *r* fully synced storer nodes with overlay addresses sharing these as their most significant bits. ## Stakes Stakes are recorded in an on-chain binary trie where a path from the root to one of the leaves corresponds to an overlay address. At the root of each sub-trie (including the entire trie), the total stake *s* is recorded. Thus, for every prefix *p*, one can look up the summary stake *s*(*p*) of all nodes with *p* as their most signifcant bits of their overlay addresses. In particular *s*(*ε*), with *ε* denoting the empty string, is the total stake of all staking nodes. Similarly given *n*, the *d* most signifncant bits of the overlay addresses of all nodes in neighborhood *N*, *s*(*n*) is the total stake of all nodes in neihborhood *N*. Nodes with zero stake are not represented in the stake trie. Changing the stake of one particular node requires the update of all the stakes from the root to the corresponding leaf in the stake trie. Assuming a uniform distribution of overlay addresses, the expected number of updates is the base 2 logaritm of the number of staking nodes. Since up to *d* the trie branches on every bit, and aggregated stake values are only ever looked up for prefixes shorter or equal to *d*, it may be worth using a simpler data structure instead of a proper trie, directly recording aggregated stakes in a map *s*(*p*) for all prefixes *p* up to some *D* ≥ *d*. This makes updates in stake values more expensive (requiring O(*D*) updates), but lookups much cheaper, O(1). Staking nodes can initiate changes in the stakes only during the **stake** phase of each epoch. In order to encourage stable overlay addresses and consistently honest behavior, there needs to be some friction in withdrawing of the stake. The extreme case, when stakes cannot be withdrawn at all has the severe drawback that in a "bidding war" (see below) it limits how far honest nodes are willing to go at the present value of future profits. In order for penalties to be meaningful, there is a minimal stake *m*. ### Bidding Wars The security assumption that honest nodes have a majority stake in every neighborhood is a rather strong one. Attackers might attempt to outstake a particular neighborhood in which case honest nodes might need to raise their stakes beyond the budget of the attacker. If stakes are not recoverable, it turns the bidding war into a "dollar auction" in which many of the outcomes are undesirable. If stakes are fully and unconditionally recoverable in every epoch, it allows for "hit and run" attacks where the attacker gains majority stake in a neighborhood, takes one epoch reward and promptly withdraws in the next stake phase. Thus, for practical security, stakes should be recoverable, but with significant delay, during which they are still vulnerable to penalties. ## The "prove" Phase During the **prove** phase, the every participating node should submit a blockchain transaction with cryptographic evidence of storing everything within their neighborhood's area of responsibility, i. e. all the chunks with valid postage stamps and addresses sharing the *d* most significant bits with the node's overlay address. One practical solution is to divide the **prove** phase into **commit** and **reveal** sub-phases all participants must provide the same response to a cryptographic challenge that can be reliably calculated only with access to all stamped chunks within their neighborhood. From the point of view of the contract, it is a Schelling game; the response with the majority of stake behind it is considered to be the correct one. Having the contract verify the actual response would provide a disincentive to sharing chunks within the neighborhood. The security assumption is that honest nodes have majority stake. For example, a simple challege would be providing proof of storing of the chunk (or several chunks) closest to some anchor *A*<sub>*n*</sub> in every neighborhood *n* coming from an on-chain random oracle: Let *p<sub>n</sub>* denote the *d*-long prefix of in neighborhood *n* padded to 256 bits, *M* a mask consisting of *d* zeroes and 256 - *d* ones, and *b* the block hash of the last block before the **prove** phase. Thus, *A<sub>n</sub>* = *p<sub>n</sub>* | (*M* & *H*(*p<sub>n</sub>* XOR *b*) ) where *H* is the Keccak hash function. Another possibility is using *b* as *A* in the neighborhood where *p<sub>n</sub>* = *b* & *M* and redistribute to only one neighborhood in each epoch. It would allow for shorter epochs and reduced transaction costs, but would introduce additional variance into storer revenue. Failure to sumbit evidence or submitting the wrong evidence results in a penalty in the form of reducing the node's stake by some penalty coefficient *r* < 1. If it results in the stake to go below *m*, the stake is zeroed. ## Claiming the Reward and Penalizing Misbehavior In case of a successful **prove** phase, in the following **claim** phase, every staked node in the neighborhood that revealed a response identical to that of more than half of the neighborhood stake can submit a transaction claiming their share of the reward, which is calculated as (reward) × (own stake) / (neighborhood stake revealing the same response) In order to verify this, the contract needs to build a *response* → *stake* map and a *node* → *response* map during the **reveal** sub-phase of the most recent **prove** phase, accumulating the stakes of each node revealing a particular response. If nodes are allowed to claim in a later epoch, the epoch identifier should also be part of the key of these maps. A node can be penalized, if they failed to reveal the majority-stake response during the **prove** phase. While penalizing other nodes is in the interest of all other nodes, there is a "tragedy of commons" situation with the transaction costs of doing so. It can be remedied with refunding the transaction costs to the reporting address, which might require an on-chain exchange between BZZ and the native token. Maps built during the **prove** phase should be reclaimed at the end of the **claim** phase. *to be continued* ## Discussion of Incentives Staked nodes are directly incentivized to store all stamped content within their neighborhood's area of responsibility by the reward. Maintaining stable overlay addresses can be incentivized by adding friction to moving the stake to a different overlay address. Staying online is incentivized by requiring each node to submit evidence, which requires both monitoring the block-chain and maintaining an up-to-date local storage, which, in turn requires being synced. The sharing of chunks within the neighborhood is incentivized by the Schelling game. It is in each node's interest that all other nodes in the neighborhood arrive to the same response to the cryptographic challenge. Splitting the stake between several sybil nodes does not increase the profits (it remains the same), but does increase transaction costs. Also, it does not change the penalty in case of failure in the *prove* phase. *to be continued*

    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