黃俊毓
    • 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
    1
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # 在中低階 Arm 環境佈署 IOTA Swarm Nodes [IOTA](https://www.iota.org/) 是一個為了物聯網而設計的開放原始碼分散式賬本技術,為機器提供無需手續費的微交易 (micro-transactions)。 在 IOTA 上,您需要仰賴一個節點 (node) 來發起交易,或是查詢曾經的交易紀錄。但如果我們這樣想,很快就會遇到以下的一些問題: * IOTA 現行的 full-node 需要 fully synced 才能發起交易。 * 運行一個 full-node [最小的系統需求](https://iota.stackexchange.com/questions/1391/minimum-requirements-to-run-a-full-node) * 需要 7 天 24 小時不關機以確保 fully synced * 每個 Node 需要維運 7~9 的鄰居節點 (neighbor nodes),大量的 Node 維運成本非常高。 這樣的使用情境,對物聯網之類的裝置而言,是難以接受的。就像我們不能要求家裡的微波爐儲存著快 100 GB 的分散式帳本, 24 小時上電,就為了達成 fully-synced 這樣的任務。 因此,對於我們週邊的物聯網裝置,合理的使用情境應該是: * 不保證持續的電源、網路狀態。 * 期望的功能唯物聯網裝置本身能夠收/發交易。 * 不定時的查帳可以透過 full-node 或是 [Light Wallet Servers](http://iotasupport.com/lightwallet.shtml) 所以我們可以將 [iota-swarm-node](https://github.com/yillkid/iota-swarm-node) 佈署在便宜的 Arm 開發板上,作為物聯網裝置端微型支付的基礎建設。解釋 iota-swarm-node 之前,我們先看 IOTA 交易是如何連接到 Tangle。IOTA 在發起一筆交易時候,需要在 Tangle 上選擇兩個交易驗證,可以被選的交易,稱之為 tips,如同下列的灰色方塊所示。所以現在我們知道,[iota-swarm-node](https://github.com/yillkid/iota-swarm-node) 只需要這些 tips 就可以發起交易了,這些 tip 大概會佔去幾 MB 的空間。 ![](https://i.imgur.com/e37gGWJ.png) 經過上文的解釋, [iota-swarm-node](https://github.com/yillkid/iota-swarm-node) 與 full-node 分工就很明白了,分工如下: * full-node * 提供 tips 給 iota-swarm-node * 廣播 iota-swarm-node 的交易 * iota-swarm-node * 產生寄款/收款帳號 * 對交易簽名 * 接收來自 full-node 的 tips * tips selection (options) * 對交易做工作證明 (proof of work; PoW) 詳細的架構如下圖所示: ![](https://i.imgur.com/2JJbZVm.png) 順帶一題,iota-swarm-node 採用 [dcurl](https://github.com/chenwei-tw/dcurl) 實現 PoW (proof of work),支援 GPU 加速以及 multi-thread Curl function,在交易的處理上有顯著的效能改善。 ![](https://i.imgur.com/Sca3F0p.png) 以下為 [iota-swarm-node](https://github.com/yillkid/iota-swarm-node) 在 [Raspberry Pi 3 Model B](https://www.raspberrypi.org/products/raspberry-pi-3-model-b-plus/) 上安裝的過程: ## Hardware requirements * Raspberry Pi 3 (Model B) * microSDHC > 2 GB * Resbian 約需要 2 GB * iota-swarm-node 約需要 11 MB ## 設定 Raspberry Pi #### 安裝 Raspberry Pi 上的作業系統 * 下載網路上的 Raspbian [image](https://downloads.raspberrypi.org/raspbian_lite_latest) 作業系統映像檔 * 將作業系統映像檔複製至 microSDHC * `sudo unzip -p 2018-03-13-raspbian-stretch-lite.zip | sudo dd of=/dev/mmcblk0 bs=4M conv=fsync` #### 設定 wifi * 掛載 **boot** 分割區,設定 wifi AP * touch ssh /mount_point/boot/ * vim /mount_point/boot/wpa_supplicant.conf ```shell ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 country=<your_ISO-3166-1_two-letter_country_code> network={ ssid="<your_SSID>" psk="<your_PSK>" key_mgmt=WPA-PSK } ``` #### 第一次登入 * Raspbian 預設帳號/密碼 * pi/raspberry #### 安裝 iota-swarm-node * Update apt list: * `$ sudo apt-get update` * Pre-Installation: * `sudo apt-get install git` * `sudo apt-get install python-pip python-setuptools python-dev python3-dev build-essential libssl-dev libffi-dev` * Official Python library for the IOTA Core: * `$ pip install pyota` * Known issue: [TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'](https://stackoverflow.com/questions/37495375/python-pip-install-throws-typeerror-unsupported-operand-types-for-retry) * Install iota-swarm-node: ```shell $ pip2.7 install cryptography==2.1.4 $ git clone https://github.com/yillkid/iota-swarm-node.git $ cd iota-swarm-node $ python server.py ``` #### 嘗試傳送 0 元交易 ```shell $ cd iota-swarm-node $ python examples/send_data.py ``` ```Send send transfer command ... RXDAJLAPHJ9TXVJWGNYYOFPARCIAHZEUIJYKYHTXEVZA9ZHDIXVIGJHJAQTRSPYGFDEILGFAJLPQWWXBD Duration: 6.59507608414 seconds ```` 您可以隨意將 swarm_node.py 檔案裡的 node 位址換成 [light Wallet Servers](http://iotasupport.com/lightwallet.shtml) 上的任意 node,例如:http://cryptoiota.win:14265 `$ python examples/send_data.py` ```Send send transfer command ... BXCEOILCZNLDACORIWDTKIKJXTSUMYCPHCBFEZRZXIDVCRWECDKRUAWTORBWFFDEGBDWQN9DGLISFF9VZ Duration: 13.4243559837 seconds ``` 在 [Asus Tinker board](asus.com/tw/Single-Board-Computer/Tinker-Board/) 上的測試結果: `$ python examples/send_data.py` ```Send send transfer command ... WIAEHXJUVO9IDZXROJEDBQLFHVFLZCIQKPLLXCGWLNZFIUJZLBZACVLZPWAKUBYLDYRZKFIDKLSAHJHEY Duration: 1.91658091545 seconds ``` ###### tags: iota, swarm-node

    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