Irene
    • 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
    # Retriev v2.0 (Arbitrum) ### High level description of the new modular design We assume there's a L1 chain (eg, Ethereum) and a L2 chain (eg, Arbitrum) which are able to exchange onchain messages using an existing protocol (L1<>L2 messaging: https://developer.arbitrum.io/arbos/l1-to-l2-messaging). So the current Retriev smart contract will be replaced by 3 different contracts: #### (1) Smart Contract on Ethereum to manage payments - Client uses a `depositEth()` function to move tokens (ETH) in an user owned vault inside the smart contract; - Allowed contracts (eg, Retriev and other protocols) can lock X tokens for Y amount of time using the function `lockPayment (uint256 amount, uint256 time)`; - Providers use a `claimPayment()` function to get paid after the locktime; - Referees use a `slashProvider(uint256 amount)` function using L2 to L1 messaging; - NOTE: confirmation time may be quite long (1 week?) - Referees use a `claimFees(bytes32 client_signature)` function to get payment for appeal fee, contract maintain a list of used client signatures to avoid double spending; - [Referees use a `cancelProposal(uint256 deal_index, bytes32[] referee_signatures)` function if requested by the client to cancel a proposal and unlock the payment; L1 event;] - Referees are in charge to check if the proposal was accepted or not (client ask this info off-chain with sign, referees check and send transaction, if allowed) - Checks if signatures aren't used yet - Before cancel deal contract referees checks in (3) - A transaction on (3) is run to mark deal as canceled #### (2) ("Retriev") Smart Contract on Ethereum to propose deals and request appeals - Client uses the`createDealProposal(string data_uri, uint256 duration, uint256 collateral, address[] providers, address[] appeal_addresses)` -> `uint256 deal_id` function to propose deals; - This calls (1) to lock an X amount of payment for Y amount of time; - NOTE: This uses L1 to L2 messaging; ~15 min to go from L1 to L2; to avoid the client to have to wait we can have the provider list to L1 to see the transaction and start dowloading the file to give a "soft" off-chain acceptance to the client - Function `createAppeal(uint256 deal_index, bytes32 client_signature)` - L1 event, referee listen to this event to active the appeal process; - Thus calls (1) to pay the appeal fee to referees; - [or Here clients post the signature that allows referees to get paid.] tbd #### (3) Smart Contract on Arbitrum to manage appeals - function `acceptDealProposal(uint256 deal_index)` - NFT is minted on L2; - Deal is active (timestamp); - function `startAppeal(uint256 deal_index)` used by referee network *after* the `claimFees` function is executed on L1. - function `processAppeal(uint256 deal_index, address[] memory _referees, bytes[] memory _signatures)` used by referee leader or another referee with enough signatures to slash the provider onchain. - function `slashProviderOnL1(uint256 deal_index)` here referee network post signatures that allows the client unlock the payment and slash the provider by sending a message from L2 to L1. - NOTE: slashing will happen with a 1 week delay! ### Flow to make a deal 1. User go to (1) and deposit an X amount of ETH, these will be used to make deals 2. User go to (2) and create a deal proposal 3. Provider will wait for message going from (2) to (3) and continues by checking if deal can be accepted or not, if yes accept the deal on (3) and deal is marked as active. ### Flow to make an appeal 1. User creates a signature to unlock the fees for the referees using (1) prefix and posting the request on (2) 2. Referees goes to (1) and uses the signature to unlock the payment and the payment is splitted among all referees. If payment is wrong (underpriced) the referees don't take the money 3. Referees starts the appeal on (3) to leave an on-chain trace and process the rounds on-chain 4. If the provider is not slashed, nothing more happens; if the provider have to be slashed then referees goes to (3) and slash the provider with L2 to L1 messaging, deal is marked as inactive on (3) 5. User will receive the unlock of the funds on (1) and they will be added to the available balance

    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