Gonçalo Pestana
    • 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 New
    • Engagement control
    • Make a copy
    • 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 Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy 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
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    --- title: O1Labs - server-side costs tags: rfcc, themis, o1labs --- **Context**: This document estimates the infrastructure costs required to run THEMIS instatiated with the [O(1) Labs scheme](https://hackmd.io/@izzy/rJApOn5zu). The on-chain reward verification is out of scope of this document -- costs and potential infrastructure cost savings associated with running the reward verification on-chain will be considered on another document. ### Document outline - [2nd Round of Feedback](https://hackmd.io/1fZEaydPTlmL0t01jOoJ0g#2nd-Round-of-Feedback) - [1st Round of Feedback](https://hackmd.io/1fZEaydPTlmL0t01jOoJ0g#1st-Round-of-Feedback) ## 2nd Round of Feedback The following tables consider the cryptography and engineering (batching operation) optimized code of the PoC implementation. **Accumulator Issuance** | | 1 user | 100 users | 1000 users | --------|--------|--------|--------| | 1 accumulator |6ms |1.05ms | 0.82ms | *Table 1. Operation costs per user when issuing 1 accumulator for 1, 100 and 1000 batches of users.* **Accumulator Update** | | 1 user | 100 users | 1000 users | --------|--------|--------|--------| | 1 ad update | 3.7ms | 1.05ms | 0.92ms | | 10 ad update | 3.3ms (0.33ms/ad) | 0.95 ms (0.095ms/ad) | 0.96ms (0.0096ms/ad) | | 30 ad update | 3.3ms (0.11ms/ad) | 0.95ms (0.0032ms/ad) | 0.82ms (0.0027ms/ad) | *Table 2. Operation costs per user when updating 1, 10 and 30 ads for 1, 100 and 1000 batches of users.* **Reward Verification** | | 1 user | 100 users | 1000 users | --------|--------|--------|--------| | 1 ad update | 2.83ms | 0.875ms | 0.8ms | *Table 3. Operation costs per user when verifying 1 reward proof for 1, 100 and 1000 batches of users.* **Estimates per user for monthly max request flow** We assume that, each month, a user requests one accumulator issuance, requests 150 ad updates and, finally, requests one reward verification. Given the figures in Tables 1, 2 and 3, the processing time necessary for handing the user requests are: - **Users requests accumulator update with per ad interaction (i.e no batching)** i) No user batching `6 + 150 * 3.7 + 2.83ms = 563.83ms /user` ii) 100 user requests operation batching `1.05 + 150 * 1.05 + 0.875ms = 159ms /user` i) 1000 user requests operation batching `0.82 + 150 * 0.92 + 0.80ms = 138ms /user` - **Users requests accumulator update with 10 ads** i) No user batching `6 + 15 * 3.3 + 2.83ms = 58.3ms /user` ii) 100 user requests operation batching `1.05 + 15 * 0.95 + 0.875ms = 16.176ms /user` i) 1000 user requests operation batching `0.82 + 15 * 0.96 + 0.80ms = 16ms /user` - **Users requests accumulator update with 30 ads** i) No user batching `6 + 5 * 3.3 + 2.83ms = 25.33ms /user` ii) 100 user requests operation batching `1.05 + 5 * 0.95 + 0.875ms = ms 6.675ms /user` i) 1000 user requests operation batching `0.82 + 5 * 0.82 + 0.80ms = 5.72ms /user` --- ## 1st Round of Feedback For the infrastructure cost we take into consideration how much time to does the baseline machine (`2.4 GHz Intel Core i5, single-threaded, 16 GB memory`) takes to compute the relevant cryptographic operations. We use the baseline machine to compare the different THEMIS schemes and extrapolate costs. | | Time to init accumulator `issue()` | Time to update accumulator `update()` | Time to verify reward calculation `verify()` | --------|--------|--------|--------| |[PoC implementation](https://github.com/imeckler/bba) |17ms |13ms |13ms | |Optimized (4x faster)|4.25sm |3.25ms |3.25ms | *Table 4. Operation costs (time, ms) per core* ### System assumptions - One accumulator per user; - Each accumulator is valid for a period of 1 month (epoch); - Each user interacts with up to 150 ads per epoch; - The reward calculation and settlement happens at the end of the epoch; ### Time to compute ad interactions per user/epoch When estimating the time to update the accumulator, we assume the computation time to update a single polynomial is the same as computing the updates of `n` polynomials; - *(optimized, single ad update)*: `4.25 +(150 * 3.25) + 3.25 ms = 453.5 ms` - *(optimized, batch update size 10)*: `4.25 +(15 * 3.25) + 3.25 ms = 56.25 ms` - *(optimized, batch update size 30)*: `4.25 +(5 * 3.25) + 3.25 ms = 24 ms` ### Questions/ Discussion #### Tainted accumulators For reputation/antifraud purposes, we need to embed 1 bit of private metadata in the accumulator. The goal to to encode 1 private bit that represents whether the user requesting the issuing is reputable or not, based on our internal privacy-preserving reputation system. This private bit needs to be checked when the BBA is updated, to make sure we don't report ad-click/interaction to advertisers when the accumulator is non-reputable at update time. In addition, we’d like the bit to be encoded in the reward calculation proof, to make sure we don't pay rewards to non-reputable users. The user should not be aware of the state of the bit at any step of the protocol. #### Storage requirements In the off-chain mode, Brave needs to store the set of `id` of spent accumulators. In order to save storage costs and speed up processing requirements we looking at using bloom filter to store spent `ids` and check for set membership. The problem with this approach is that false positives are critical -- users won't be able to be rewarded as their accumulator is considered spent. #### Expiring accumulators Instead of using bloom filters, we can reduce the set of `ids` to store if the accumulator (or the `id` itself) had an expiration date. There are a couple ways to implement this: - if an `id` was a scalar which `n` bits would encode the month/year representing the epoch while the accumulator is valid; - encode the valid epoch in one of the accumulator parameters (this would probably be more expensive when generating/verifying the reward proof, as the user would have to prove that the accumulator e valid). Both options above would allow Brave to drop the accumulator `ids` from the double-spending protection set once they've been expired. **Questions:** - Can we assume that batch update of `n` polynomials takes the same server-side resources as a single update? If not, how to factor in that in the cost calculations? - How do you estimate that the tainted token feature would impact token issuance, update and reward verification costs? (compared to Table 1.) - Could you elaborate where the 4x performance improvements come from?

    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