Positive Coin
      • 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
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners 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
    • 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 Help
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
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners 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
    # 系統行為 :::danger 由於寫文件的速度趕不上設計變更的速度,所以以下資訊可能與最終版本不同,一切以 [Miro Board](https://miro.com/app/board/uXjVPRL6iv4=/) 上的設計圖為準! ::: * POS: Positive Coin * ATM: ATM 交易互動機 * WebServ: Web server * UE: User Equipment ## 連線 WebServ 使用者透過掃 QR code 連上 WebServ(位於阿里雲上的 ECI docker) ```sequence Note left of UE: 1st connecttion Note over UE: scan QR code Note over UE: Generate deviceID UE->WebServ: HTTP GET (connect) UE->WebServ: send deviceID Note over WebServ: Generate RNA from\nx*{A,B,C,D} WebServ->pgSQL: record: {deviceID:RNA} Note over WebServ: Add signature for UE WebServ->UE: send (RNA+signature) Note over UE: store (RNA+signature)\nin local Note over UE: cache webpage\nin local Note left of UE: 2nd connecttion Note over UE: detect webpage in cache Note over UE: open webpage and\nparsing (RNA+signature) ``` **NOTE:** 開 webpage 不需要 server 也可以開得起來,第一次連線後本機會存一個 cache file。webpage 裡面會透過設定參數決定是否需要連線遠端更新或是使用本地的資料。這樣的技術就是 PWA -- Progressive Web App。 ATM 將收到的兩個 RNA 上傳到 WebServ 後,WebServ 會計算出一組 RNA-pair。但 WebServ 此時無法 response 到 UE 端。因為送出 request 的人是 ATM。那麼 UE 端要怎麼接收更新呢?-- 每次 UE 重新開啟 webpage 的時候,才會從 WebServ 得到需要更新 RNA 的通知。 每一個裝置都會有一個唯一性的 deviceID 紀錄在 WebServ,UE 第一次連線時會將這個 deviceID 送給 WebServ 紀錄。之後 UE 的每次連線,都會將 deviceID 夾帶在 token 送給 WebServ。所以 WebServ 能夠知道這個連線來自於誰。 ps: 如果 UE 端 reload WebServ URL,因為沒有改變任何事情,看起來就像什麼事情都沒發生,只有動畫會重跑。 ## 首次發送 RNA UE 每次跟 WebServ 溝通時只要是新用戶,就會進行上面的流程。過程中的 RNA 其實算是一種「類發幣」的行為,RNA 會由 {A,B,C,D} 四種病毒株組成。只要有一個 UE 連進 WebServ,WebServ 就會依序發送 x*{A,B,C,D},並以 RNA 的格式呈現。x 是固定值,假如程式碼裡設定 20,則: 第一個連進來的人,拿到由 20A 組成的 RNA; 第二個連進來的人,拿到由 20B 組成的 RNA; 第三個連進來的人,拿到由 20C 組成的 RNA; 依此類推 NOTE: 不管如何,「幾A幾B幾C幾D」都可以透過 hash() 轉換為 RNA 格式。當我們提到 RNA 的時候,單一 RNA 的 hash string 是可以解出含有「幾A幾B幾C幾D」的。 ## ATM 感染行為 感染的系統行為操作就是將兩個不同亞型病毒的人交換彼此的病毒株數量,但是仍會維持總量固定。ex: Alice 的 RNA 含有 20C,Bob 的 RNA 含有 20D,兩個人在 ATM 機前互相感染後,最終 WebServ 可能會產生: 10C10D, 5C15D, 16C4D, 8C12D... 等等的任意兩個 RNA,並且指派給 Alice 和 Bob 的 deviceID。 等到 Alice 和 Bob 再次打開 UE browser 的時候,會提示要更新 RNA。這時候才會從 WebServ 把新的 RNA 更新回來。 ```sequence Alice->ATM: scan QR code Alice->ATM: scan RNA(Alice) Bob->ATM: scan QR code Bob->ATM: scan RNA(Bob) ATM->WebServ: send RNA(Alice)+RNA(Bob) Note over ATM: show HIVStory\n(Text/Photo/Video) Note over WebServ: pasing RNA(Alice)\nget 20C Note over WebServ: pasing RNA(Bob)\nget 20D Note over WebServ: generate 16C4D & 8C12D WebServ->pgSQL: record: deviceID(Alice).RNA=16C4D WebServ->pgSQL: record: deviceID(Alice).infect_count++ WebServ->pgSQL: record: deviceID(Bob).RNA=8C12D WebServ->pgSQL: record: deviceID(Bob).infect_count++ Note left of Alice: Alice open web browser App Alice->WebServ: HTTP GET (connect) WebServ->Alice: response RNA(Alice)=16C4D Note over Alice: store new RNA(Alice) Note left of Alice: Bob open web browser App Bob->WebServ: HTTP GET (connect) WebServ->Bob: response RNA(Bob)=8C12D Note over Bob: store new RNA(Bob) ``` ps: Alice 在 ATM 前掃完 QR code 之後,ATM 會在接下來的 5min 內等待下一個人掃描 QR code,如果沒有就 timeout,不會處理 Alice 的 RNA(一切重來的意思)。 ## WebServ 會記錄交易次數 當 Alice 和 Bob 做 RNA 交易的時候,WebServ 端會更新這兩個人的交易次數(+1) infect_count。次數是影響最後將 RNA 換算成多少價值的參數。 ## 汙名化 目前沒有這個機制 ## 病毒量衰減的功能 這次也會有病毒衰減的行為,但是衰減期要拉長,避免需要觀眾經常跑去展間(考量北京的交通距離和觀眾習慣)。 * TBD * 如果有衰減的話,避免的方式是「服藥」嗎?服藥的行為要怎麼進行? * UI 顯示: 倒數計時,或是生命值往下降。顯示在哪? ## 交易透明化 * TBD: 要呈現什麼資訊? * [x] 即時交易: 哪個 RNA 跟哪個 RNA 做了交易(Infect)變異出什麼 RNA pair ## FAQ * Q: 使用者在 ATM 上經過多次的感染後,可能產生相同的 RNA 嗎? * Ans: RNA 可能會相同,但是每個手機會有個唯一的 deviceID,所以還是可以辨識出連上來的人是誰。

    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