<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[SWF Lab - Medium]]></title>
        <description><![CDATA[SWF Lab was born in Jun. 2022 at NTU(Taipei, Taiwan), we research everything about Blockchain, including Underlying Architecture, Smart Contract, Dapp, DeFi, NFTs and Marketing, Data Science, Data Analysis. - Medium]]></description>
        <link>https://medium.com/swf-lab?source=rss----50e7f2f831ca---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>SWF Lab - Medium</title>
            <link>https://medium.com/swf-lab?source=rss----50e7f2f831ca---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 03:21:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/swf-lab" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[如何跑起以太坊執行層與共識層客戶端]]></title>
            <link>https://medium.com/swf-lab/%E5%A6%82%E4%BD%95%E8%B7%91%E8%B5%B7%E4%BB%A5%E5%A4%AA%E5%9D%8A%E5%9F%B7%E8%A1%8C%E5%B1%A4%E8%88%87%E5%85%B1%E8%AD%98%E5%B1%A4%E5%AE%A2%E6%88%B6%E7%AB%AF-54d0b472e7ac?source=rss----50e7f2f831ca---4</link>
            <guid isPermaLink="false">https://medium.com/p/54d0b472e7ac</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[nethermind]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[consensus]]></category>
            <category><![CDATA[prysm]]></category>
            <dc:creator><![CDATA[ChiHaoLu]]></dc:creator>
            <pubDate>Fri, 07 Jul 2023 14:41:02 GMT</pubDate>
            <atom:updated>2023-07-07T14:41:02.847Z</atom:updated>
            <content:encoded><![CDATA[<p>本文一開始會簡單介紹什麼是客戶端，如果大家對相關內容還完全不了解，可以透過我提供的 References 來幫助理解。而本文的重點在介紹在 The Merge 之後如何跑起執行層與共識層的客戶端。</p><blockquote><strong>Author: </strong><a href="https://chihaolu.me/"><strong>ChiHaoLu</strong></a><strong>(</strong><a href="https://chihaolu.eth.xyz/"><strong>chihaolu.eth</strong></a><strong>) @ swfLAB</strong></blockquote><h3>Briefly Introduction</h3><h4>What is Node? What is Client?</h4><blockquote><em>“Run a Node” 和 “Run a Client” 是同一件事情。</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/1*T55DFrNdAIpShC_MEaChyw.png" /><figcaption><em>Image0: </em><a href="https://docs.prylabs.network/docs/concepts/nodes-networks"><em>Nodes and networks | Prysm</em></a></figcaption></figure><p>以太坊是一個分散式網路，由節點們（Nodes）構成，實際上跑（或說運行）每一個節點就是在跑一個軟體，而這個軟體又稱為客戶端（Client）：</p><ol><li>包含了 Ethereum 的 Protocol（EVM、如何處理交易、區塊、合約的規則）、會根據交易執行合約內容，並產生新的狀態</li><li>會下載以太坊區塊鏈的副本並驗證每個區塊的有效性</li><li>隨著新的區塊和交易的出現時可以驗證新區塊和交易數據，使其保持最安全和最新的狀態</li><li>協助其他人下載和更新他們自己的副本（與其他人進行同步）</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/531/1*hOxLv6dtxeAQNVPJv0YwWg.png" /><figcaption><em>Image 1：</em><a href="https://ethereum.org/en/developers/docs/nodes-and-clients/run-a-node/"><em>Ethereum.org | SPIN UP YOUR OWN ETHEREUM NODE</em></a></figcaption></figure><p>由 Image 1 可以看見一個 Ethereum Node 由 Execution Layer Client（執行層客戶端）和 Consensus Layer Client（共識層客戶端）兩種客戶端組成。而本文會著重在運行一個節點，也就是這兩種客戶端上，而不會深入 Validator 的內容。</p><blockquote><em>關於「The Merge 前後的差別」以及「Run a Node 還有 Run a Validator 的差別」在後文會提到。</em></blockquote><h4>Execution Client vs Consensus Client</h4><p>合併後的以太坊由兩個部分組成：執行層和共識層。這兩層由不同的客戶端軟體運行。不同的執行層客戶端和不同的共識層客戶端，會有不同的團隊以不同程式語言開發實現。</p><p>執行層客戶端（Execution Layer Client）</p><ul><li>也稱為 Execution Engine、EL Client 或過往稱作 ETH1 Client。</li><li>用於監聽網路中廣播（會管理一個 mempool）的新交易，將它們在 EVM 中執行（執行智能合約的內容），並保存所有當前以太坊數據的最新狀態和數據庫。更白話一點說就是管理用戶狀態並執行與交易相關的計算。</li><li>例如 <a href="https://geth.ethereum.org/">Geth</a> 由 Golang 實現，<a href="http://nethermind.io/">Nethermind</a> 以 C# 和 .NET 實現。</li></ul><p>共識層客戶端（Consensus Layer Client）</p><ul><li>也稱為 Beacon Node、CL Client 或過往稱作 ETH2 Client。</li><li>驗證 PoS，以及 Fork Choice Rule（LMD GHOST）</li><li>例如 <a href="https://docs.prylabs.network/docs/getting-started">Prysm</a> 以 Golang 實現，和 <a href="https://lighthouse.sigmaprime.io/">Lighthouse</a> 以 Rust 實現。</li></ul><p>多種客戶端實現可以減少對單個程式碼庫的依賴，使網路多樣性增加，不讓任何一種客戶端主導整個網路，從而消除潛在的單點錯誤。多種語言的存在還可以吸引更廣泛的開發者社區，使他們能夠使用自己喜歡的語言來參與客戶端的開發。</p><p>以下是兩種客戶端之間的關係：</p><ol><li>兩種客戶端透過 <a href="https://github.com/ethereum/execution-apis/tree/main/src/engine">Engine API</a> 這樣一個 JSON RPC API 溝通（可見下方 Image 2）</li><li>執行層和共識層客戶端使用 JWT 密鑰對彼此進行身份驗證（達到安全的溝通），且每一個共識層客戶端必須要且只能與一個執行層客戶端配對。</li><li>多個 Validator 可以對應同一組共識層客戶端 + 執行層客戶端組合</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bfwvpVHyaHPf4BU8nCF1VA.png" /><figcaption><em>Image 2: </em><a href="https://ethereum.org/en/developers/docs/nodes-and-clients/"><em>Ethereum.org | NODES AND CLIENTS</em></a></figcaption></figure><p>關於兩者如何互動的細節可以參考以下 Reference：</p><ol><li><a href="https://github.com/ethereum/execution-specs">Ethereum.org | Ethereum Execution Client Specifications</a></li><li><a href="https://github.com/ethereum/consensus-specs">Ethereum.org | Ethereum Consensus Client Specifications</a></li><li><a href="https://notes.ethereum.org/@hww/the-merge-brief-summary">TEM | 以太坊 The Merge 合併之技術面懶人包 (2022–04 version)</a></li><li><a href="https://medium.com/taipei-ethereum-meetup/eth-2-0-cl-el-separation-and-impact-of-the-merge-dbeb6828c907">TEM | Eth 2.0 的共識層和執行層分工及 The Merge 影響</a></li><li><a href="https://www.youtube.com/watch?v=91-GArv6lKo&amp;ab_channel=Infura">Infura | How The Execution Client and the Consensus Client Can Work Together on the Blockchain</a></li></ol><p>當使用者抵押 32 ETH 參與以太坊的 PoS 共識機制時，他們會使用一個獨立的軟體稱為 Validator Client，他會連接到他們的 Prysm Beacon Node。這個特殊的軟體管理著 Validator 金鑰和負責生成新的區塊和對他人提議的區塊進行投票。</p><p>簡單來說，Validator Client 讓人們將 32 ETH 作為擔保品在以太坊的共識層中進行抵押。Validator 負責在以太坊的 PoS 共識機制中提議區塊，並在「合併」之後完全取代 PoW miner。</p><p>Validator Client 僅與本地通過 Beacon Node 連接到以太坊網路，Validator 的 Beacon Node 告訴 Validator 需要執行的工作，並在 Validator 執行其職責時將 Validator 的成果廣播到以太坊網路上。而 Beacon Node 則依賴 Execution Node。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*Bdp0mB3Hk7YyamkvuMgbSw.png" /><figcaption><em>Image3: </em><a href="https://docs.prylabs.network/docs/concepts/nodes-networks"><em>Nodes and networks | Prysm</em></a></figcaption></figure><h4>Before and After The Merge</h4><p>在合併之前，共識層和執行層是獨立的網絡，那時候所有以太坊的交易和用戶活動都在現在的執行層上進行。也就是只有一個（執行層）客戶端軟體同時提供執行環境（EVM）和對礦工生成的區塊（PoW）進行共識驗證。</p><p>自 2020 年 12 月之後，共識層（信標鏈、Beacon Chain）開始獨立運行，它使用了基於權益證明（PoS、proof-of-stake）的共識機制，並根據來自以太坊主網的數據協調 Validator 的網路。</p><p>而在 The Merge 之後，Ethereum 進到 PoS，執行層客戶端和共識層客戶端<strong>必須一起運作</strong>，以驗證以太坊的最新狀態。也就是我們前面講的執行層客戶端會負責搜集交易然後利用 EVM 執行交易，而共識層客戶端會驗證共識機制（PoS）。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9hBcPxg1YbbFnAk7GpBHag.png" /><figcaption><em>Image 4: </em><a href="https://blog.ethereum.org/2022/08/24/mainnet-merge-announcement"><em>Mainnet Merge Announcement</em></a></figcaption></figure><h4>誰需要/可以跑節點？跑節點需要抵押 ETH 嗎？</h4><p>從 Image 1 我們可以看見 Node 並不包含 Validator，而 Validator 包含 Node。所以節點不是只給 Validator（PoS 權益證明的驗證者）使用，<strong>而是任何人都可以運行節點，而且你不需要擁有以太幣就可以跑節點。</strong></p><blockquote><em>跑節點不一定要當 Validator（抵押 ETH），而當 Validator 一定要跑節點。</em></blockquote><p>只跑一個節點無法像 Validator 那樣獲得獎勵，因為真正「批准一筆交易是否能夠到區塊」裡面是 Validator 在做的，而節點只負責「執行交易和驗證結果」。但對於任何以太坊用戶來說，運行節點還有許多其他好處，包括隱私、安全性、降低對第三方服務器（Node Provider）的依賴、抗審查性和改善網路的健康和去中心化程度。</p><blockquote><em>也就是說擁有自己的節點之後，你就不需要信任由第三方提供的有關以太坊的網路狀態的訊息，也不用透過第三方送出你的交易。</em></blockquote><p>關於跑節點的好處可見 Reference：</p><ol><li><a href="https://ethereum.org/en/developers/docs/nodes-and-clients/#why-should-i-run-an-ethereum-node">Ethereum.org | WHY SHOULD I RUN AN ETHEREUM NODE?</a></li><li><a href="https://github.com/ethereumbook/ethereumbook/blob/develop/03clients.asciidoc#should-i-run-a-full-node">Mastering Ethereum — Should I Run a Full Node</a></li></ol><p>當然跑一個自己的節點會耗費許多成本，如果覺得不需要的話使用第三方的 Node Provider（e.g. Infura 或 Alchemy）也可以。</p><h4>Node Types vs Sync Modes</h4><p>為了追蹤和驗證網路中的當前數據，以太坊客戶端需要與最新的網路狀態同步。所以當我們運行客戶端，會從其他節點下載數據，進行加密驗證以確保其完整性，並構建一個 Local DB 來儲存區塊鏈歷史資料。</p><ul><li>不同的 Node Types 代表這些節點以不同的方式儲存數據，以及參與驗證與否。</li><li>不同的 Sync Modes 代表節點能夠多快地獲取到以太坊狀態的最新信息，而執行層客戶端與共識層客戶端有不同的同步方式。</li></ul><p>Node Types 和 Sync Modes 有很多種分類，詳細可見以下 Reference：</p><ul><li><a href="https://ethereum.org/en/developers/docs/nodes-and-clients/#node-types">Ethereum.org | NODE TYPES</a></li><li><a href="https://ethereum.org/en/developers/docs/nodes-and-clients/#execution-layer-sync-modes">Ethereum.org | Execution layer sync modes</a></li><li><a href="https://ethereum.org/en/developers/docs/nodes-and-clients/#consensus-layer-sync-modes">Ethereum.org | Consensus layer sync modes</a></li></ul><h3>Running Clients</h3><h4>Travel Preparations</h4><ol><li>本文選擇開發文件最豐富的 <a href="https://docs.nethermind.io/nethermind/first-steps-with-nethermind/running-nethermind-post-merge">Nethermind</a> 作為示範執行層的客戶端，以及選擇<a href="https://clientdiversity.org/">目前參與程度</a>最高的 <a href="https://docs.prylabs.network/docs/install/install-with-script">Prysm</a> 作為共識層的客戶端。</li><li>本文使用 MacBook Pro 2022 M2 作為作業系統</li><li>本文使用 Sepolia 作為測試網</li></ol><h4>Step 0: Create Folders</h4><p>首先在電腦的任意一處創建一個資料夾 ethereum，底下創建兩個子資料夾 consensus 和 execution，分別儲存共識層客戶端和執行層客戶端的軟體。</p><pre>📂ethereum<br>┣ 📂consensus<br>┣ 📂execution</pre><h4>Step 1: Installing CL Client</h4><p>進到 consensus 這個資料夾（$ cd consensus），並且下載執行層客戶端 prysm：</p><pre>$ mkdir prysm &amp;&amp; cd prysm<br>$ curl https://raw.githubusercontent.com/prysmaticlabs/prysm/master/prysm.sh --output prysm.sh &amp;&amp; chmod +x prysm.sh<br>&gt;<br>  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current<br>                                 Dload  Upload   Total   Spent    Left  Speed<br>100  9538  100  9538    0     0  16510      0 --:--:-- --:--:-- --:--:-- 16762</pre><p>設置 auth-secret：</p><pre>## Optional. This command is necessary only if you&#39;ve previously configured USE_PRYSM_VERSION<br>$ USE_PRYSM_VERSION=v4.0.0<br><br>## Required.<br>$ ./prysm.sh beacon-chain generate-auth-secret<br>&gt;<br>Latest Prysm version is v4.0.6.<br>Downloading beacon chain@v4.0.6 to /Users/chihaolu/Desktop/Blockchain/ethereum/consensus/prysm/./dist/beacon-chain-v4.0.6-darwin-arm64 (automatically selected latest available version)<br>  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current<br>                                 Dload  Upload   Total   Spent    Left  Speed<br>100 71.7M  100 71.7M    0     0  9242k      0  0:00:07  0:00:07 --:--:-- 11.6M<br>gpg is not available. Either install it or run with PRYSM_ALLOW_UNVERIFIED_BINARIES=1.</pre><p>共識層客戶端與執行層客戶端之間的 HTTP connection 需要由 JWT token 驗證，而產生 JWT token 的方式有許多種，例如：</p><ul><li>Use a utility like OpenSSL to create the token via command: openssl rand -hex 32 | tr -d &quot;\n&quot; &gt; &quot;jwt.hex&quot;.</li><li>Use an execution client to generate the jwt.hex file.</li><li>Use Prysm to generate the jwt.hex file:</li></ul><p>我們將 jwt.hex 這個 file 放在 ethereum/consensus/prysm 資料夾中。</p><h4>Step 2: Installing EL Client</h4><p>到 ethereum/execution 這個資料夾中：</p><pre>$ brew tap nethermindeth/nethermind<br>$ brew install nethermind</pre><h4>Step 3: Running EL Client</h4><pre>$ nethermind \<br>--config sepolia \<br>--JsonRpc.Enabled true \<br>--HealthChecks.Enabled true \<br>--HealthChecks.UIEnabled true \<br>--JsonRpc.JwtSecretFile=../consensus/prysm/jwt.hex \<br>--Merge.TerminalTotalDifficulty 17000000000000000<br>&gt;<br>======================== Nethermind initialization completed ========================<br>This node    : enode://49573c3ede0f35acef54303e11df7ad79ca979cb66fa1a8a7748ea4732030b2d31efaf38b23a501257d65abf3d34463b8a9ab6e83c1b66dfdf4ba103b380af84@36.227.225.253:30303<br>RPC modules  : Eth, Health, Net, Parity, Personal, Proof, Rpc, Subscribe, Trace, TxPool, Web3<br>Node address : 0x629f29d3574e88e22f0f4b1c68dd4cf5300a15e4 (do not use as an account)<br>Mem est tx   :     41MB<br>Mem est DB   :      4MB<br>JSON RPC     : http://127.0.0.1:8545 ; http://localhost:8551<br>Genesis hash : 0x25a5cc106eea7138acab33231d7160d69cb777ee0c2c553fcddf5138993e6dd9<br>External IP  : 36.227.225.253<br>Ethereum     : tcp://36.227.225.253:30303<br>Discovery    : udp://36.227.225.253:30303<br>Client id    : Nethermind/v1.19.3+e8ac1da4/macos-arm64/dotnet7.0.8<br>Chainspec    : chainspec/sepolia.json<br>Chain head   : 0 (0x25a5cc...3e6dd9)<br>Chain ID     : Sepolia<br>===================================================================================== <br>2023-07-07 22:01:43.9652|Waiting for Forkchoice message from Consensus ...</pre><p>若出現錯誤：</p><pre>2023-07-07 21:58:28.8959|Step StartRpc                 failed after 385ms System.IO.IOException: Failed to bind to address http://127.0.0.1:8545: address already in use.</pre><p>則可：</p><pre>$ lsof -i:8545<br>$ kill -9 &lt;process_id&gt;</pre><p>就可以殺掉佔用的進程，再重新執行指令就可以跑了。</p><h4>Step 4: Running CL Client(Run a beacon node using Prysm)</h4><p>首先下載 Sepolia genesis state（<a href="https://github.com/eth-clients/merge-testnets/blob/main/sepolia/genesis.ssz">Github</a>）到 consensus/prysm。</p><p>到 ethereum/consensus/prysm 這個資料夾中：</p><pre>$ ./prysm.sh beacon-chain \<br>--execution-endpoint=http://localhost:8545 \<br>--sepolia \<br>--jwt-secret=jwt.hex \<br>--genesis-state=genesis.ssz</pre><ul><li>如果出現這個問題 gpg is not available. Either install it or run with PRYSM_ALLOW_UNVERIFIED_BINARIES=1.，可以跑 $ export PRYSM_ALLOW_UNVERIFIED_BINARIES=1</li><li>這邊不跑 Validator，需要的人可以參考<a href="https://docs.prylabs.network/docs/install/install-with-script#step-5-run-a-validator-using-prysm">此文件</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=54d0b472e7ac" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swf-lab/%E5%A6%82%E4%BD%95%E8%B7%91%E8%B5%B7%E4%BB%A5%E5%A4%AA%E5%9D%8A%E5%9F%B7%E8%A1%8C%E5%B1%A4%E8%88%87%E5%85%B1%E8%AD%98%E5%B1%A4%E5%AE%A2%E6%88%B6%E7%AB%AF-54d0b472e7ac">如何跑起以太坊執行層與共識層客戶端</a> was originally published in <a href="https://medium.com/swf-lab">SWF Lab</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[機器學習分類器在沈浸式環境之應用 — — 0. Intro]]></title>
            <link>https://medium.com/swf-lab/%E6%A9%9F%E5%99%A8%E5%AD%B8%E7%BF%92%E5%88%86%E9%A1%9E%E5%99%A8%E5%9C%A8%E6%B2%88%E6%B5%B8%E5%BC%8F%E7%92%B0%E5%A2%83%E4%B9%8B%E6%87%89%E7%94%A8-0-intro-106c4e61e026?source=rss----50e7f2f831ca---4</link>
            <guid isPermaLink="false">https://medium.com/p/106c4e61e026</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[vr]]></category>
            <category><![CDATA[data]]></category>
            <dc:creator><![CDATA[QQAI]]></dc:creator>
            <pubDate>Tue, 06 Jun 2023 05:32:06 GMT</pubDate>
            <atom:updated>2023-06-06T05:32:06.407Z</atom:updated>
            <content:encoded><![CDATA[<h3>機器學習分類器在沈浸式環境之應用 — — 0. Intro</h3><h3>Goal</h3><p>隨著 VR 的蓬勃發展，越來越多 VR 相關的遊戲和互動應用都在崛起，而如何能讓使用者在體驗 VR 環境時負擔最少，最能完全沈浸，以及裝置收集到的資訊是否準確，都是很好的研究課題。</p><p>這次我們在瀏覽了幾項技術以後，試著描繪了未來可能實現的技術藍圖。</p><p>以下是我和 <a href="https://medium.com/u/89a2002621e">ExcitedMail</a> 共同撰寫並完成的這次小研究的整體介紹，也謝謝 <a href="https://medium.com/u/f49f5493848d">Corn</a> 為我們 Review 及給予許多意見、幫助！</p><h3>Wii</h3><p>相信大家小時候或多或少都接觸過任天堂在 2006 年推出的 Wii 這款遊戲機，這款遊戲機除了發行了許多任天堂相關的電玩遊戲，例如馬力歐賽車、馬力歐棒球，還有近期大紅大紫的薩爾達傳說等，也有其他遊戲商發行的多元遊戲類別能供使用者選擇，配合著能多人遊玩的特色，在當時是極為盛行的家庭遊戲機。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*4dJsLAjXI8-wyLdbY8b1jA.png" /><figcaption>Wii 遊戲主機、控制手把，與其中一款光碟片。<a href="https://www.google.com/url?sa=i&amp;url=https%3A%2F%2Fwww.amazon.com%2F-%2Fzh_TW%2Fdp%2FB07BZS1566&amp;psig=AOvVaw36_TJPeOTcDlLDsQNTM9iN&amp;ust=1685959042862000&amp;source=images&amp;cd=vfe&amp;ved=0CBQQ3YkBahcKEwjYm6Xoran_AhUAAAAAHQAAAAAQCg">圖源連結</a>。</figcaption></figure><p>但 Wii 除了可以插入額外挑選的光碟片，也可以透過 Wii 的內建系統設置自己的人物，並且在廣場中跟其他使用者透過表情與揮手等姿勢進行互動。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*WWCPNOEUul0tF2NTggsxSw.png" /><figcaption>Wii 人物與廣場示意圖。<a href="https://www.google.com/url?sa=i&amp;url=http%3A%2F%2Fgames.sina.com.cn%2Ft%2Fn%2F2006-11-30%2F1846177718.shtml&amp;psig=AOvVaw2AaNjZ4pCLi9_R9c5wzs-B&amp;ust=1685959196244000&amp;source=images&amp;cd=vfe&amp;ved=0CBQQ3YkBahcKEwjQjdDJran_AhUAAAAAHQAAAAAQBA">圖源連結</a>。</figcaption></figure><p>而同樣經歷過 Wii 主機輝煌時期的我們，這次就想到了，像這樣的廣場互動，若是以 VR 技術來實行，配合動作捕捉與表情辨識等技術，是否能夠達到更貼近現實，讓使用者只要在家就能在虛擬世界和朋友談天說地的願景呢？</p><h3>Method</h3><p>為了實現發想，我們針對以下幾項技術進行了調查與研究。</p><h3>肌音圖 MMG</h3><p>首先是如何偵測出使用者的手部動作，我們一開始獲得的資料較多是肌電圖（Electromyography，簡稱為 EMG）與影像辨識的實行方法，但在後續的資料查找中，發現工研院曾經開發出一款利用肌肉震動的訊號來獲得更精確手部動作，成本也便宜許多的方法，稱為肌音圖（Mechanomyography，簡稱為 MMG）手勢辨識系統，不僅辨識準確度高，在配戴時也能減少使用者的負擔，因此選為這次技術介紹的文章之一。</p><h3>Gesture Recognitio</h3><p>了解到肌音圖這門技術以後，我們開始思考手勢辨識除了能用在判別使用者目前的動作以外，是否也能讓使用者拋棄手把，達到更沈浸的 VR 體驗。而在此目標下，需要解決的是常用的打字輸入問題，目前肌音圖的應用較多為判別手勢，針對更微小的動作，例如在虛擬的鍵盤上打字等輸入需求是否也能一併貼合應用，是待解決與研究的課題，其中一項可能的辦法是訓練更好的機器學習模組，並且改良目前的訊號裝置，讓訊號更加的穩定，連細小的手指動作也能被捕捉並記錄。</p><p>文章連結： <a href="https://medium.com/swf-lab/%E6%A9%9F%E5%99%A8%E5%AD%B8%E7%BF%92%E5%88%86%E9%A1%9E%E5%99%A8%E5%9C%A8%E6%B2%88%E6%B5%B8%E5%BC%8F%E7%92%B0%E5%A2%83%E4%B9%8B%E6%87%89%E7%94%A8-3-%E6%89%8B%E5%8B%A2%E8%BE%A8%E8%AD%98%E6%8A%80%E8%A1%93-482855c772f"><strong>機器學習分類器在沈浸式環境之應用 — — 3. 手勢辨識技術</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SpTGA-e7420Cl5uY2rf98Q.png" /><figcaption>目前的 VR 應用若是遇到需要使用虛擬鍵盤的情形，大多還是透過手把的射線點擊鍵盤打字，費時也費力。<a href="https://www.google.com/url?sa=i&amp;url=https%3A%2F%2Foptocrypto.com%2Fpunchkeyboard-virtual-reality-keyboard%2F&amp;psig=AOvVaw0shoYm-LnKpeU3AtDLyOul&amp;ust=1685959957432000&amp;source=images&amp;cd=vfe&amp;ved=0CBQQ3YkBahcKEwiwsN60sKn_AhUAAAAAHQAAAAAQFw">圖源連結</a>。</figcaption></figure><h3>Motion Capture</h3><p>大部分的 VR 遊戲都是透過遊戲手把操作，雖然舉起手拿東西操作的部分自由度很高，但行走過程中的動作都是透過公司預設好的姿勢。</p><p>目前做到 Motion Capture 的方式通常是在人體身上裝許多的 Sensor ，把資料傳回去 Server 進行重建，或是架設多個攝影機，收集多個角度的畫面之後重建。</p><p>如果能做到更少的裝置就能重建動作，甚至雙方能進行更多的互動，例如能在虛擬世界中尬舞或是拳擊之類的，勢必能增加廠商及玩家投入 VR 的意願。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uBAdQDI1OYlcfKGvRz_JRQ.png" /><figcaption>利用 VR 進行拳擊訓練。<a href="https://www.insidethegames.biz/articles/1133052/usa-boxing-virtual-reality-game">圖源連結</a>。</figcaption></figure><h3>Facial Expression</h3><p>不論是近年來的動物森友會或是很久以前的楓之谷，都是透過按鍵選擇表情，同樣也是只能使用遊戲公司建立好的有限表情包。</p><p>如果未來更自由的 Facial Expression 方式推出，讓我們能夠更自在的展現臉部表情，例如扮鬼臉等等，並且能夠在捏角色的時候有更自由的選擇，虛擬世界的角色多樣性就能大幅提高，讓我們能展現各自豐富的想像力。（想像力是你的超能力 雄獅文具</p><p>文章連結： <a href="https://medium.com/swf-lab/%E6%A9%9F%E5%99%A8%E5%AD%B8%E7%BF%92%E5%88%86%E9%A1%9E%E5%99%A8%E5%9C%A8%E6%B2%88%E6%B5%B8%E5%BC%8F%E7%92%B0%E5%A2%83%E4%B9%8B%E6%87%89%E7%94%A8-1-unity-face-capture-tutorial-ebf5a76f1a28"><strong>機器學習分類器在沈浸式環境之應用 — — 1. Unity Face Capture Tutorial</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8KqOAhBdY1GnlPacPgMQuQ.png" /><figcaption>動物森友會的表情包。<a href="https://www.polygon.com/animal-crossing-new-horizons-switch-acnh-guide/2020/3/24/21191060/unlock-reactions-emotes-gestures-joy-delight-greetings-surprise">圖源連結</a>。</figcaption></figure><h3>Assisted by ML</h3><p>這幾年 ML 蓬勃發展，我們可以利用 ML 來輔助上述應用，關於圖片的 ML 已經發展多年，從簡單的 Image Classifier 到能這一兩年來產生各種奇形怪狀圖片的 Diffusion Model 都算是圖片相關 ML 的發展領域。</p><p>我們可以訓練各種不同功能的 Classifier 來進行不同領域的分類，比如說手勢的分類器、動作的分類器以及表情的分類器。既然已經有許多學者發想出這麼多好用的 ML 技術，我們當然要拿來好好的利用，並且期待未來能夠開發出更強大的技術。</p><p>文章連結： **<a href="https://medium.com/swf-lab/%E6%A9%9F%E5%99%A8%E5%AD%B8%E7%BF%92%E5%88%86%E9%A1%9E%E5%99%A8%E5%9C%A8%E6%B2%88%E6%B5%B8%E5%BC%8F%E7%92%B0%E5%A2%83%E4%B9%8B%E6%87%89%E7%94%A8-2-pytorch-custom-dataset-cf4234353af9"><strong>機器學習分類器在沈浸式環境之應用 — — 2. Pytorch Custom Dataset</strong></a><strong> </strong><a href="https://medium.com/swf-lab/%E6%A9%9F%E5%99%A8%E5%AD%B8%E7%BF%92%E5%88%86%E9%A1%9E%E5%99%A8%E5%9C%A8%E6%B2%88%E6%B5%B8%E5%BC%8F%E7%92%B0%E5%A2%83%E4%B9%8B%E6%87%89%E7%94%A8-4-predefined-model-and-data-augmentation-5e761316fff2"><strong>機器學習分類器在沈浸式環境之應用 — — 4. Predefined Model and Data Augmentation</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*epJRbyj9oGhi1wKDbCc22g.png" /><figcaption>用 Stable Diffusion 把名畫的風格進行再創造。<a href="https://stealthoptional.com/tech/how-to-run-stable-diffusion/">圖源連結</a>。</figcaption></figure><h3>Conclusion</h3><p>這篇文章只是對後續的系列文做個開頭，後面的文章會針對這些項目做較為詳細的介紹。包括如何透過 Unity 捕捉表情；介紹工研院如何利用 MMG 做到手勢辨識；關於 ML 的部分也會有 coding 的示範，讓想自己試試看的各位可以跟著指示進行操作。</p><p>希望各位能在接下來的文章中收穫滿滿，可以的話也請為我們拍拍手&gt; &lt;</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=106c4e61e026" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swf-lab/%E6%A9%9F%E5%99%A8%E5%AD%B8%E7%BF%92%E5%88%86%E9%A1%9E%E5%99%A8%E5%9C%A8%E6%B2%88%E6%B5%B8%E5%BC%8F%E7%92%B0%E5%A2%83%E4%B9%8B%E6%87%89%E7%94%A8-0-intro-106c4e61e026">機器學習分類器在沈浸式環境之應用 — — 0. Intro</a> was originally published in <a href="https://medium.com/swf-lab">SWF Lab</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Byacco]]></title>
            <link>https://medium.com/swf-lab/byacco-edb6194fe9ff?source=rss----50e7f2f831ca---4</link>
            <guid isPermaLink="false">https://medium.com/p/edb6194fe9ff</guid>
            <category><![CDATA[money]]></category>
            <category><![CDATA[japan]]></category>
            <category><![CDATA[digital-currency]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[UN SWEET]]></dc:creator>
            <pubDate>Tue, 06 Jun 2023 05:31:27 GMT</pubDate>
            <atom:updated>2023-06-06T05:31:26.940Z</atom:updated>
            <content:encoded><![CDATA[<h3>利用區塊鏈技術的數位通貨 — Byacco</h3><blockquote><em>Author : UN SWEET</em></blockquote><blockquote><em>感謝 </em><a href="https://medium.com/u/8d055ac3c090"><em>Chung Fu-Chuan</em></a> 、 <a href="https://medium.com/u/199b3d97c60d"><em>王昱淮</em></a> <em>review 此篇文章</em></blockquote><p>在這個日新月異的數位時代，區塊鏈技術正以驚人的速度改變著我們的生活和商業模式。而在這股風潮中，數位地區通貨正躍上舞台，為人類帶來嶄新的支付和價值交流方式。本篇文將介紹日本的數位地區通貨『Byacco/白虎』。</p><h3>什麼是 Byacco</h3><p>「Byacco/白虎」是日本<a href="https://u-aizu.ac.jp/">會津大學</a>（其為日本第一所專注於計算機科學及技術的研究型大學）首創的地方性數位貨幣。目前它基於區塊鏈技術，提供更安全可靠的支付方式。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/0*l6a3VxWLmvVa7f3y.png" /><figcaption>Byacco/白虎 logo (Source: <a href="https://soramitsu.co.jp/byacco">Byacco</a>)</figcaption></figure><p>Byacco 使用方法與其他無現金支付服務（如日本 <a href="https://paypay.ne.jp/">Pay Pay</a>）相似。使用者需在智慧手機上安裝專用應用程式並儲值金額。儲值後的金額以「元」的形式儲存，可用於付款和轉帳。Byacco 與一般的無現金支付不同之處在於，其交易數據具有與現金相同的價值，接收款項的商店或個人可以立即將接收帳款用作資金，讓 Byacco 在地區內循環使用。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/0*QcFdy2uQoTGO5itM.png" /><figcaption>Byacco App 示意圖 (Source: <a href="https://soramitsu.co.jp/eng/byacco/manual">Byacco</a>)</figcaption></figure><p>Byacco 於 2020 年 7 月在校內正式啟動運作，根據一年後的註冊數據顯示， 1300 名學生中約有三分之一（即460人）正在使用。而截至最近報導 Byacco 仍限定於校內運作，尚未開通其他地區使用。</p><h3>誰在營運 Byacco？</h3><p>Byacco 的團隊是由三個不同的單位串連而成：SoraMitsu、AiYUMU、以及 Student Life Support Ltd. (SLS)</p><p><strong>■ SoraMitsu</strong></p><p><em>Byacco 的設計、開發和技術支援</em></p><p>SoraMitsu 是一家位於日本的金融科技企業，擁有區塊鏈技術開發、Fintech 的專業知識，主要服務企業、大學和政府提供基於區塊鏈的解決方案。旗下的產品除了 Byacco 之外，還包括與柬埔寨國家銀行合作的跨境支付系統「<a href="https://medium.com/tokyo-fintech/soramitsu-builds-cambodian-digital-currency-payments-system-137a06d341f0">BAKONG</a>」、<a href="https://soramitsu.co.jp/iroha"><em>DLT 框架 Hyperledger Iroha</em></a>．．．等。</p><p><strong>■ 株式会社AiYUMU</strong></p><p><em>Byacco App的開發、店舖導入協助</em></p><p>AiYUMU 是一家由位於福島縣會津若松市的公司組成的民營運營企業，負責推進該市的 ICT 相關基礎設施建設計畫。其利用會津大學作為 ICT 專業大學的地理優勢，旨在以 ICT 作為社會基礎設施，提升市民生活的品質，並同時探索地區與新創公司結合的可能性。 此外，AiYUMU 也致力於加強會津若松市、會津大學和當地的民間（教育、醫療、工業等）之間的協作。</p><p>■ <strong>Student Life Support Ltd.</strong></p><p><em>Byacco App 的實際管理者、店鋪經營者</em></p><p>Student Life Support Ltd.（SLS）是由會津若松商工會議所的活動所創立的公司，旨在支援會津大學的學生生活，同時促進大學和地區之間的相互瞭解。 目前，SLS 在會津大學經營著食堂、雜貨店、書店、咖啡廳以及留學生宿舍，在會津大學短期大學部則經營著食堂和雜貨店。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GPicLONT_HG-5K_C-CRbVg.png" /><figcaption>Baycco 營運團隊示意圖</figcaption></figure><h3>Byacco 有什麼特別？</h3><p>以下為 SoraMitsu<a href="https://prtimes.jp/main/html/rd/p/000000018.000019078.html"> 官方新聞稿</a>列出的 Byacco 特點：</p><ol><li>利用區塊鏈技術「<a href="https://soramitsu.co.jp/iroha">Hyperledger Iroha</a>」，防止雙重支付和偽造，實現 2 秒內支付和每秒數千筆交易。(註：「<a href="https://soramitsu.co.jp/iroha">Hyperledger Iroha</a>」是 SoraMitsu 自 2016 年開始與會津若松市和會津大學合作開發的區塊鏈技術，Hyperledger Iroha 是一個框架，可以在其上建立自己的私有區塊鏈。）</li><li>利用區塊鏈上的交易無法被篡改特性，使數據本身具有現金等同的價值和確定性（Finality），並與日圓連動，作為日本首個在商店等實際運作中的數位通貨（XST-JPY）。</li><li>實現非接觸支付、常規無現金支付無法實現的流通性、個人間和企業間的支付、轉賬和企業內的費用清算等，提高業務效率，應對人口減少和改善資金運營。</li><li>將 SoraMitsu 過去與柬埔寨國家銀行共同開發的「<a href="https://medium.com/tokyo-fintech/soramitsu-builds-cambodian-digital-currency-payments-system-137a06d341f0">BAKONG</a>」的成果運用在 Byacco 上，將 BAKONG 運用到的技術最適化為日本的數位地區通貨，而 Byacco 的最適化工作在約三個月內完成，成功實現了快速運營開始和降低開發成本。</li><li>是具有極低成本、強大安全性、高處理能力和高穩定性，可在各地快速提供服務。</li><li>取代現金，無需使用紙介質，以非接觸方式進行支付，可以安全、確實和迅速地向個人和企業提供現金支付和支援。</li></ol><h3>Byacco （數位通貨）與一般無現金支付差異</h3><p>無現金支付和數位通貨成為了時下熱門的趨勢。這兩者在使用上非常相似，都依賴於智慧手機的應用程式進行金錢交易。然而，儘管它們看起來相似，無現金支付和數位通貨的運作方式卻截然不同。在使用上我們將解釋無現金支付（例如日本 Pay Pay）以及數位地區通貨（例如 Byacco）之間的主要差異。</p><blockquote>無現金支付</blockquote><p>「無現金支付」是一種基於帳戶的支付方式，在月末結算日，支付機構和商家之間進行資金清算，支付機構在之後將銷售款項匯入商家的銀行帳戶，商家需要進行收款確認。</p><p>許多「無現金支付」無法進行流通，因此商家無法立即將接收的電子貨幣等用於下一筆付款（例如進貨）。在銷售款項匯入之前（可能需要大約一個月的時間），商家無法將銷售款項用於進貨等，這使得中小型商家的資金周轉變得困難。此外，支付系統複雜，且由於需要在多個銀行帳戶之間進行匯款，因此容易產生高成本的問題。</p><blockquote>數位通貨</blockquote><p>數位通貨是一種<strong>可以流通的代幣型數位支付方式</strong>，透過區塊鏈技術能夠防止數據的篡改和複製，並為用戶提供數學上可證明的所有權，使用戶能夠轉移數位通貨的所有權，讓數位通貨也具有與現金等值的價值，且具有最終性（最<em>終性 finality：指交易完成後，確保該交易不可逆轉或修改，即無法撤銷或更改該交易的狀態</em>）。因此，當數位通貨在商家付款或企業間轉賬時，可以像現金支付一樣立即收到數位通貨，不需要像月末結算或轉賬指示和收款確認等後續資金清算的流程，從而大幅減少了企業的業務負擔。</p><p>此外，由於數位通貨具有可流通的特性（即可以多次轉移給不特定的人），因此可以在個人之間、企業之間進行直接轉賬、支付，或用於企業內部的費用結算等。商家一旦收到數位通貨，即可立即進行下一筆付款（如進貨），從而提高整個經濟活動中資金的流動性。</p><h3>Byacco 的未來展望與挑戰</h3><p>以下為 SoraMitsu <a href="https://prtimes.jp/main/html/rd/p/000000018.000019078.html">官方新聞稿</a>列點對 Byacco 的未來願景：</p><ol><li>透過低成本和快速開發、地區化，逐步展開數位地區通貨在不同地區和智慧城市的應用。</li><li>區塊鏈技術的互聯互通，實現數位地區通貨之間的互聯互通，使不同地區和智慧城市的數位地區通貨能夠實現「相互運作」。</li><li>與柬埔寨的數位貨幣「Bakong」（XST-USD, XST-KHR）等海外數位通貨連接，實現跨境轉賬和支付。</li><li>利用智能合約，實現稅金和使用費用的自動支付，以及數位資產和加密資產的所有權轉移和支付同時進行的處理。</li><li>未來與日本和海外的中央銀行數位通貨的合作連接。</li></ol><p>而筆者這邊也列出幾點 Byacco 現在或未來可能遇到的挑戰：</p><ol><li>Byacco 目前尚無其他附加價值，僅像另外一種普通貨幣，缺乏誘因誘導新使用者加入使用。</li><li>由於需要 Byacco 支付需要學習使用特定的設備，而商家店主可能不想付出成本來學習使用不熟悉的設備，因此對使用 Byacco 支付的接受度較低。</li></ol><h3>總結</h3><p>Byacco 的出現代表了區塊鏈技術和無現金支付在支付領域的前沿發展，並為我們開啟了一扇通向更便捷、高效和安全支付方式的大門。隨著持續的創新和應用，期待數位地區通貨的發展在全球範圍內得到實現，逐漸擴大到其他地區，提升人類的福祉。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=edb6194fe9ff" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swf-lab/byacco-edb6194fe9ff">Byacco</a> was originally published in <a href="https://medium.com/swf-lab">SWF Lab</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[三分鐘給新手小白瞭解 Footprint Analytics  & 網站導覽]]></title>
            <link>https://medium.com/swf-lab/%E4%B8%89%E5%88%86%E9%90%98%E7%B5%A6%E6%96%B0%E6%89%8B%E5%B0%8F%E7%99%BD%E7%9E%AD%E8%A7%A3-footprint-analytics-%E7%B6%B2%E7%AB%99%E5%B0%8E%E8%A6%BD-40396ddea921?source=rss----50e7f2f831ca---4</link>
            <guid isPermaLink="false">https://medium.com/p/40396ddea921</guid>
            <category><![CDATA[footprints]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[marketing]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[data]]></category>
            <dc:creator><![CDATA[UN SWEET]]></dc:creator>
            <pubDate>Mon, 29 May 2023 07:44:04 GMT</pubDate>
            <atom:updated>2023-05-29T07:44:04.599Z</atom:updated>
            <content:encoded><![CDATA[<h3>三分鐘給新手小白瞭解 Footprint Analytics &amp; 網站導覽</h3><blockquote><em>Author : UN SWEET</em></blockquote><blockquote><em>感謝 </em><a href="https://medium.com/u/8d055ac3c090"><em>Chung Fu-Chuan</em></a> 、 <a href="https://medium.com/u/199b3d97c60d"><em>王昱淮</em></a> <em>review 此篇文章</em></blockquote><p>本文快速簡介<a href="https://www.footprint.network/"> Footprint Analytics </a>以及其網站導覽，文末放置個人對使用此網頁的感想。關於 Footprint Analytics 更詳細的相關資訊還請左轉<a href="https://github.com/footprintanalytics">官方文件</a>。</p><p>大綱如下：</p><ul><li>Footprint Analytics 在幹麻？</li><li>我不會打code，也可以操作嗎？</li><li>Footprint Analytics 網站指引</li><li>個人感想</li></ul><h4>Footprint Analytics 在幹麻？</h4><p>Footprint Analytics 是一個可將鏈上資料視覺化的平台，協助開發者、分析師和投資者進行 GameFi、DeFi 和 NFT 洞察。用戶可以使用SQL、或平台自身不須coding的視覺化介面來建立圖表分析數據。類似的鏈上資料平台還有 Dune、Messari等。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*keOb4aIkuCdNx70NtKPzTQ.png" /><figcaption>Footprint Analytics 官方網站</figcaption></figure><p>Footprint Analytics 將廣大的鏈上數據轉換成有系統的資料，並分為三個階層：</p><ul><li>BRONZE (原始資料)</li><li>SILVER (從 BRONZE 階層整理的資料)</li><li>GOLD (從 SILVER 階層精粹的資料)</li></ul><p>由於 SILVER 階層、GOLD 階層為精鍊過後的資料，其能大幅減少處理資料的時間，讓使用者在撈取資料時能迅速獲得結果。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b1ffBpJ3D5VPAwDgt5izdw.png" /><figcaption>Footprint Analytics 資料轉換圖 Source : <a href="https://github.com/footprintanalytics">Footprint Analytics</a> )</figcaption></figure><p>根據官方的白皮書，Footprint Analytics平台擁有以下特點和優勢：</p><ul><li>支援多達 26 個不同鏈的資料</li><li>處理資料時間更快速（因為擁有精粹過的資料層）</li><li>提供統一的 NFT、GameFi 和 DeFi 數據 API（延伸閱讀：<a href="https://medium.com/codingbar/api-%E5%88%B0%E5%BA%95%E6%98%AF%E4%BB%80%E9%BA%BC-%E7%94%A8%E7%99%BD%E8%A9%B1%E6%96%87%E5%B8%B6%E4%BD%A0%E8%AA%8D%E8%AD%98-95f65a9cfc33">什麼是 API</a>）</li><li>提供視覺化介面，無須 coding</li></ul><h4>我不會打code，也可以操作嗎？</h4><p>當然可以！能夠在不使用 SQL 的情況下輕鬆提取數據，是 Footprint Analytics 最重要的特點之一，也是與其他數據平台差異化的地方。</p><p>Footprint Analytics 提供了<a href="https://docs.footprint.network/docs">官方文件</a>指引如何使用資料，以下提供一些快捷傳送門：</p><ul><li><a href="https://docs.footprint.network/docs/no-code">不用 coding 的資料分析</a></li><li><a href="https://docs.footprint.network/docs/no-code-sql">用非 coding 介面輔助生成 SQL 程式碼</a></li><li><a href="https://docs.footprint.network/docs/sql">SQL 資料分析</a></li></ul><h4>Footprint Analytics 網站指引</h4><p>以下為網站功能的部分索引（備註：有關透過網站資料來製作 dashboard 的教學官方文件已有闡述，故不再多做說明）。</p><p><strong>查看官方數據看板</strong></p><p><a href="https://www.footprint.network/growth">Growth Analytics</a> 為官方提供的數據分析平台，主要提供項目經營者操作數據替自身項目進行分析。此平台最大特點為可<strong>同時觀看鏈上數據以及 Web 2 行銷數據</strong>，除了鏈上的交易紀錄外，可以連結 Twitter、Discord、Google Analytics 等平常使用的行銷數據平台，一同進行數據整合。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9vIcWetQdpHLQFfiKAtAKA.png" /><figcaption>Growth Analytics 項目鏈上數據示意圖</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ycpe5lA2fXQoI9fHh5fbDA.png" /><figcaption>Growth Analytics 項目 Twitter 分析是意圖</figcaption></figure><p>此外，在 Acquisition 分類整合了擴大客群、目標用戶建檔等功能，Footprint Analytics 透過鏈上的購買紀錄，將各錢包地址分群建檔（備註：官方並未詳述其如何替錢包地址分群）。項目經營者可透過已整理好的類別，挖掘自身項目的目標潛在客戶、以及觀察客戶 profile 等。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EhmDNwEwFQTF78kuTGFlPg.png" /><figcaption>Growth Analytics Acquisition 示意圖</figcaption></figure><p><strong>查看其他用戶建立的數據看板</strong></p><p>除了官方提供的數據分析看板外，用戶也可選擇自行製作看板。點選網站首頁左上方的 <a href="https://www.footprint.network/dashboards">Analytics App</a>，即可進入看板區觀察其他用戶製作的公開資料看板。可以使用官方的分類尋找其他用戶已製作出的數據，幫助節省尋找資料的時間。另外，更有提供 <strong>Template</strong> 的分類，方便其他用戶參照不同資料分析的寫法。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*72RY9S8eD4qO1Rc7kclGTQ.gif" /><figcaption>網站首頁到瀏覽看板示意</figcaption></figure><p><strong>參閱資料分析報導</strong></p><p>點選右上角的 “Learn” 選單 “Blog”，即可觀看不同主題的文章。目前尚未開放每名用戶於網站上發布文章，若想要在 Footprint Analytics 上發布分析文章，目前僅有與<a href="https://www.footprint.network/news/write-for-us">官方聯繫</a>的選項。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yKgIet7xi9Ss2Mghr6x3NQ.gif" /><figcaption>網站首頁至文章區域示意</figcaption></figure><p><strong>主頁下方 bar</strong></p><p>網站最下方有分類更明確的欄位，特別是 “Analytics” 的部分替用戶概括好了 Footprint Analytics 各分析的傳送門。仔細一瞧，會發現好像有非常重複的分類（如 Chains Analytics 和 Chains Research）。究竟 “<a href="https://www.footprint.network/research/chain">Chain Research</a>” 和 “<a href="https://www.footprint.network/chains">Chains Analytics</a>” 有甚麼區別呢？</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*huc2Yhs8ejTmRotPNb0llA.png" /><figcaption>主頁下方 bar</figcaption></figure><ul><li><a href="https://www.footprint.network/chains">Chains Analytics</a>：</li></ul><p>將鏈分類並附上相關簡介，同時附有此鏈社群帳號、其他 Footprint Analytics 用戶製作與此鏈相關的看板。對各鏈瞭解還不深、想要知道其質化特色的使用者可以先從 Chains Analytics 開始認識。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gt7AaUeZ77VaFIRZnGZizA.png" /><figcaption>Chains Analytics 示意圖</figcaption></figure><ul><li><a href="https://www.footprint.network/research/chain">Chain Research</a>：</li></ul><p>Footprint Analytics 官方提供的分析看板，除了支援單鏈的數據分析，比起前者，它多提供<strong>整合所有鏈的統計數據</strong>（例如 Top Chains Ranking等），相較前擁有更完整的資料呈現。對想要分析、比較不同鏈差異的使用者更為方便。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AXmB-s4B_3ZZkBHSyZQbvw.png" /><figcaption>Chain Research 示意圖</figcaption></figure><h4>個人感想</h4><p>以下為我在使用網站後的簡短個人感想：</p><h4><strong>優點</strong></h4><p><strong>整合 Web2 平台</strong></p><p>企業用戶可以串聯過去習慣使用的平台進行數據操作和客戶分析，此功能方便原本熟悉 Web2 行銷方面的工作者更無痛的轉換到 Web3 平台，同時將數據整合在同一平台也大幅提升工作的效率。</p><p><strong>不須 coding</strong></p><p>在客製化資料時不用選擇對於沒有程式背景的用戶較為友善，且另有附帶將<a href="https://docs.footprint.network/docs/no-code-sql">無程式碼製作的資料轉換為 SQL 程式碼的功能</a>，讓不同背景的用戶也有協作的可能性<em>。</em></p><h4><strong>缺點</strong></h4><p><strong>網站分類複雜</strong></p><p>體網站的設計在使用上並不直觀，許多分類繁瑣且重複（例如），甚至讓人感到雜亂的地步。生出本篇文章的部分原因也是因為在摸索平台時碰到許多疑問，故決議寫了非常簡單的索引來引導需要的人使用。</p><p><strong>數據操作缺乏索引</strong></p><p>在初探 Growth Analytics 時，除了在介紹 Acquisition 時提及對於客戶分類未做說明外，整體的看板操作官方也未提供明確指引。另外，在製作客製化資料看板時，也並沒有對看板功能相關的說明，在只能自行摸索的狀況下，個人認為若要從零開始生成一張圖表，並非易事。</p><h4>總結</h4><p>在 Web3 產品處處萌芽的時代，各項目若能先設計好在 Web2 已經談到爛掉的使用者體驗，降低使用者的入門門檻將是再好不過。而我認為 Footprint Analytics 這個產品擁有極大的優勢，也有做出和其他競品的差異化，但若能在使用者體驗上（尤其對於新用戶）更加用心，我相信對推廣自身產品能更加容易，用戶也操作的開心，創造雙贏的局面。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=40396ddea921" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swf-lab/%E4%B8%89%E5%88%86%E9%90%98%E7%B5%A6%E6%96%B0%E6%89%8B%E5%B0%8F%E7%99%BD%E7%9E%AD%E8%A7%A3-footprint-analytics-%E7%B6%B2%E7%AB%99%E5%B0%8E%E8%A6%BD-40396ddea921">三分鐘給新手小白瞭解 Footprint Analytics  &amp; 網站導覽</a> was originally published in <a href="https://medium.com/swf-lab">SWF Lab</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[機器學習分類器在沈浸式環境之應用 — — 3. 手勢辨識技術]]></title>
            <link>https://medium.com/swf-lab/%E6%A9%9F%E5%99%A8%E5%AD%B8%E7%BF%92%E5%88%86%E9%A1%9E%E5%99%A8%E5%9C%A8%E6%B2%88%E6%B5%B8%E5%BC%8F%E7%92%B0%E5%A2%83%E4%B9%8B%E6%87%89%E7%94%A8-3-%E6%89%8B%E5%8B%A2%E8%BE%A8%E8%AD%98%E6%8A%80%E8%A1%93-482855c772f?source=rss----50e7f2f831ca---4</link>
            <guid isPermaLink="false">https://medium.com/p/482855c772f</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[gesture-recognition]]></category>
            <dc:creator><![CDATA[QQAI]]></dc:creator>
            <pubDate>Sat, 27 May 2023 13:34:55 GMT</pubDate>
            <atom:updated>2023-05-27T13:34:55.066Z</atom:updated>
            <content:encoded><![CDATA[<h3>機器學習分類器在沈浸式環境之應用 — — 3. 手勢辨識技術</h3><h4>前言</h4><p>隨著元宇宙的發展，Virtual Reality（虛擬實境）與 Augmented Reality（擴增實境）也受到越來越多的關注。當商業性 VR 頭盔的開發逐漸輕便且價格親民，VR 遊戲也遍地開花的局勢下，投入 VR 研究的學者也理所當然地增加。</p><p>而今天要跟大家介紹的技術是台灣的工業技術研究院先前開發出的肌音圖（Mechanomyography，簡稱為 MMG）手勢辨識系統，能不依賴 VR 手把實體操作遊戲。研究成果除了發表到 IEEE Sensors Journal 上，也受到多項國際獎項肯定。</p><p>這項技術很適合搭配 VR 頭盔或 AR 眼鏡使用，因此選為將機器學習技術應用到沈浸式環境這項主題的第三篇文章。</p><p>也在這裡謝謝 <a href="https://medium.com/u/89a2002621e">ExcitedMail</a> 跟 <a href="https://medium.com/u/f49f5493848d">Corn</a> 幫我 review 這篇文章！(^○^)</p><h4><strong>現有技術</strong></h4><p>當時常用的手勢控制大多是採用影像偵測或是肌電圖（Electromyography，簡稱為 EMG）的方法達成。</p><p>影像偵測的實現方法與優缺點跟其他影像識別的應用大同小異，缺點就是當場景中人數較多或是環境干擾大（例如戶外環境陽光、紅外線強烈）時，偵測所需要的運算資源龐大，品質也備受挑戰。同時也需要考慮到相機擺放的位置，若是在 VR 場景中活動，很容易因為活動過程中身體面向的不同、或是鏡頭與手之間遇到遮蔽等原因，導致相機難以捕捉使用者現在的動作。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*SSeawbSXaXFOToKDU0GkXA.png" /><figcaption>圖為 Microsoft 的產品 Kinect，是採用影像辨識進行手部判斷的偵測裝置。</figcaption></figure><p>而肌電圖簡單而言，是一種用於測量肌肉活動的技術，當肌肉收縮時，肌肉纖維產生微弱的電訊號，EMG 技術通過將表面電極附著到肌肉上，檢測並且記錄這些隨之產生的訊號，分析肌肉收縮的強度與模式，從而識別使用者的動作意圖。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*J-HaiauISdosY6zFP3xRZQ.png" /><figcaption>肌電圖裝置示意圖，取自 Meta Quest 發佈會演示。</figcaption></figure><p>目前在 VR 的人機互動設備當中，有較高的比率是採用 EMG 來實現，不過 EMG 的生產成本十分高昂，準確率更只有 85% 左右。與此同時，透過肌電圖測量時，由於偵測的是電訊號，使用者一旦出汗，汗水改變肌膚的膚電電位值，就會需要重新校正模型，不適合長時間或是劇烈活動中運用。</p><h4><strong>肌音圖 MMG</strong></h4><p>而工研院這次開發出的技術，就是透過肌音圖的原理，測量手部肌肉組織在運動時，肌肉纖維的收縮與摩擦等產生的振動訊號，配合三種機器學習的演算法分析數據，判斷出使用者的手勢。</p><p>在發表的研究中採用的三種模型方法分別是 KNN（K-Nearest Neighbors）、SVM（Support Vector Machine）跟 LDA（Linear Discriminant Analysis），都是 Supervised 的學習方法，利用以上去做八種手勢的分類。</p><ol><li>KNN 是透過尋找離新特徵點最接近的 K 個鄰近特徵點各自的類別，預測這個新特徵點應該會落在哪個類別中。常應用於圖像識別、文本分類，優點是簡單，缺點是計算量龐大，對大數據和高為數據的處理效率差。</li><li>SVM 是能應用在 Binary 和 Multi-class 的算法，利用尋找特徵空間裡的最佳平面，分割出不同類別的特徵點，常用的函數有知名的線性、多項式、高斯和 Sigmoid 函數，常用於圖像識別、文本分類、生物醫學，優點是效率高、對小樣本數據的泛用能力高，缺點是對大數據集和干擾多的數據環境敏感，也較難以調整出最佳參數。</li><li>LDA 是透過將原始特徵空間 mapping 到較低維的子空間，最大化不同類別的特徵點彼此之前的分散度，最小化同一類別特徵點間的距離，也就是努力把他們分成各自的聚落，常常用在人臉識別和手寫識別，優點是減少特徵維度，能有效降噪，但在類別數多時效果較不佳。</li></ol><p>同時，也採用感測器所記錄的時域特徵作為 training 時的輔助資料，最終，所有訓練模型中的最佳辨識率是 94.56%。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*cSVYGNE2FtehHkgJY7DeCA.png" /><figcaption>發表中採用的八種手勢，取自 Hand Gesture Recognition by a MMG-based Wearable Device。</figcaption></figure><p>這種方式的好處是感應器的成本低廉，同時也不會像影像辨識受到環境噪音的影響，即便是戶外也能順利使用，更不會因為汗水造成數據的頻繁校正。</p><p>目前開發出的系統以偵測猜拳作為例子，準確率能達到 99%。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*9Q2g5gCfcWn8gmRq7hJlfg.png" /><figcaption>肌音圖裝置示意，取自工業技術研究院官方網站。</figcaption></figure><p>往後也期待能夠延伸應用，取代 VR 遊戲時玩家還要手持控制器的不便感，或是讓配戴 AR 眼鏡的使用者不需要抬起手觸控眼鏡邊框，即能輸入命令給系統，提供更直覺的操作體驗，愈趨地貼近刀劍神域裡頭直接用單手叫出功能列表和面板的未來了對吧！ (＞人＜;)</p><h4>總結</h4><p>先前發布的兩篇主題文章，<a href="https://medium.com/swf-lab/%E6%A9%9F%E5%99%A8%E5%AD%B8%E7%BF%92%E5%88%86%E9%A1%9E%E5%99%A8%E5%9C%A8%E6%B2%88%E6%B5%B8%E5%BC%8F%E7%92%B0%E5%A2%83%E4%B9%8B%E6%87%89%E7%94%A8-1-unity-face-capture-tutorial-ebf5a76f1a28">一篇介紹了 Unity 裏面 Face Capture 的應用</a>，而目前許多 VR 裝置都有內建的攝影機，像是 Oculus Quest 2，HTC VIVE Cosmos Elite 以及 PlayStation 的 VR 頭盔。當擁有面部的表情資料以後，透過肌音圖的偵測取得手部的動作資訊，就能夠重建出元宇宙裡使用者的虛擬人物，並且去掉手持操作器的異物感，能更好地貼近生活體驗。</p><p><a href="https://medium.com/swf-lab/%E6%A9%9F%E5%99%A8%E5%AD%B8%E7%BF%92%E5%88%86%E9%A1%9E%E5%99%A8%E5%9C%A8%E6%B2%88%E6%B5%B8%E5%BC%8F%E7%92%B0%E5%A2%83%E4%B9%8B%E6%87%89%E7%94%A8-2-pytorch-custom-dataset-cf4234353af9">另外一篇文章提到 Custom Dataset 的製作與 CNN 訓練</a>，可以應用在手勢偵測的加強，也能用在檢測使用者周遭環境等創意應用。</p><p>同時，現有的 VR 遊戲與研究也有多項利用 EEG、Emotiv 等腦機介面、情緒感測的裝置，近年的發表研究中，NeRF 的 3D 建模也如火如荼地發展，例如 Nvidia 推出的 <a href="https://github.com/NVlabs/instant-ngp">Instant-NGP</a>，能讓一般的使用者在輕巧的設備與需求下即時渲染出 3D 模型。</p><p>透過多項技術的結合，將我們的所見現實與人體的各式資料都上傳到雲端網路，編織出真正的虛擬元宇宙，已經有越來越多樣的可能性。（距離刀劍神域又近了一步，哇苦哇苦）</p><h4>References</h4><ol><li><a href="https://doi.org/10.1109/JSEN.2020.3011825">https://doi.org/10.1109/JSEN.2020.3011825</a></li><li><a href="https://www.itri.org.tw/ListStyle.aspx?DisplayStyle=01_content&amp;SiteID=1&amp;MmmID=1036233376062425763&amp;MGID=1036737743744631053">https://www.itri.org.tw/ListStyle.aspx?DisplayStyle=01_content&amp;SiteID=1&amp;MmmID=1036233376062425763&amp;MGID=1036737743744631053</a></li><li><a href="https://news.nweon.com/101462">https://news.nweon.com/101462</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=482855c772f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swf-lab/%E6%A9%9F%E5%99%A8%E5%AD%B8%E7%BF%92%E5%88%86%E9%A1%9E%E5%99%A8%E5%9C%A8%E6%B2%88%E6%B5%B8%E5%BC%8F%E7%92%B0%E5%A2%83%E4%B9%8B%E6%87%89%E7%94%A8-3-%E6%89%8B%E5%8B%A2%E8%BE%A8%E8%AD%98%E6%8A%80%E8%A1%93-482855c772f">機器學習分類器在沈浸式環境之應用 — — 3. 手勢辨識技術</a> was originally published in <a href="https://medium.com/swf-lab">SWF Lab</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[機器學習分類器在沈浸式環境之應用 — — 4. Predefined Model and Data Augmentation]]></title>
            <link>https://medium.com/swf-lab/%E6%A9%9F%E5%99%A8%E5%AD%B8%E7%BF%92%E5%88%86%E9%A1%9E%E5%99%A8%E5%9C%A8%E6%B2%88%E6%B5%B8%E5%BC%8F%E7%92%B0%E5%A2%83%E4%B9%8B%E6%87%89%E7%94%A8-4-predefined-model-and-data-augmentation-5e761316fff2?source=rss----50e7f2f831ca---4</link>
            <guid isPermaLink="false">https://medium.com/p/5e761316fff2</guid>
            <category><![CDATA[pretrained-model]]></category>
            <category><![CDATA[pytorch]]></category>
            <category><![CDATA[data-augmentation]]></category>
            <category><![CDATA[cnn]]></category>
            <category><![CDATA[data]]></category>
            <dc:creator><![CDATA[ExcitedMail]]></dc:creator>
            <pubDate>Wed, 24 May 2023 14:48:03 GMT</pubDate>
            <atom:updated>2023-05-24T14:48:03.263Z</atom:updated>
            <content:encoded><![CDATA[<h3>機器學習分類器在沈浸式環境之應用 — — 4. Predefined Model and Data Augmentation</h3><p>之前寫過如何<a href="https://medium.com/swf-lab/%E6%A9%9F%E5%99%A8%E5%AD%B8%E7%BF%92%E5%88%86%E9%A1%9E%E5%99%A8%E5%9C%A8%E6%B2%88%E6%B5%B8%E5%BC%8F%E7%92%B0%E5%A2%83%E4%B9%8B%E6%87%89%E7%94%A8-2-pytorch-custom-dataset-cf4234353af9">自己寫 Custom Dataset</a>，以及怎麼<a href="https://medium.com/swf-lab/%E8%87%AA%E5%B7%B1%E8%A8%93%E7%B7%B4-cnn-%E4%BE%86%E9%80%B2%E8%A1%8C-image-classification-pytorch-739825dfa487">建立 CNN Model</a>，有興趣可以點連結過去看看，透過這兩篇已經能做出堪用的 Classification Model 了。</p><p>如果要做到更好的結果，通常需要花蠻多時間調整參數並測試，所以這篇文章會介紹怎麼使用別人建立好甚至訓練過的 Model 直接對自己的資料進行訓練。</p><p>小小補充一下，通常從頭開始訓練會稱為 Training，而用別人訓練好的 Model 丟入自己的資料調整成適合特定任務的行為會稱為 Fine-tuning。</p><p>感謝 <a href="https://medium.com/u/f49f5493848d">Corn</a> 以及 <a href="https://medium.com/u/f8c72d772bad">QQAI</a> 幫我 Review 這篇文章！</p><h3>Table of Contents</h3><ul><li>Intro.</li><li>Predefined Model</li><li>Data Augmentation</li><li>Conclusion</li><li>Reference</li></ul><h3>Intro.</h3><p>雖然我們可以自己建 Model 並且透過調整 layer 以及參數達到不錯的準確度，不過這樣子的 Model 通常只適合當前訓練的任務。如果今天換了另一組資料需要分類，不但需要重新訓練，layer 的組合也不一定適合新的資料。</p><p>除此之外，有許多研究機器學習的學者會不斷的研究最適合各種領域的 Model 組合，例如語音辨識、字句生成以及圖形辨識等等。沒有花大把時間進行實驗以及研究，很難超越這些學者的成果。秉持打不過就加入的想法，我們可以直接抓他們組合出來的 Model 來用。</p><p>除此之外，我們自己抓資料時，很難抓到非常大量的資料，不夠多的資料導致難以成功訓練模型，所以這篇另外會介紹怎麼把少量的資料數翻倍。</p><h3>Predefined Model</h3><p>CNN Model 較為有名的是 Residual Network 這個架構，通常先由 2 個 CNN layer 組成一個 Residual Block，資料傳到任何 Residual Block 後有兩個行為，一個是經過該 Block 提取出重要資訊，另一個行為是跳過該 Block，增加提取資料的變化，而多個 Residual Block 組成出來的 Network 就稱為 Residual Network，最終簡稱為 ResNet，ResNet 後面接的數字就代表 CNN layer 的層數，例如 ResNet50、ResNet152 等等。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rVcTz8bE-zuGxYnBt63KlQ.png" /><figcaption>K. Chen, K. Chen, Q. Wang, Z. He, J. Hu and J. He, “Short-Term Load Forecasting With Deep Residual Networks,” in IEEE Transactions on Smart Grid, vol. 10, no. 4, pp. 3943–3952, July 2019, doi: 10.1109/TSG.2018.2844307.</figcaption></figure><p>以下會以 <a href="https://pytorch.org/vision/main/models/generated/torchvision.models.resnet50.html#torchvision.models.resnet50">ResNet50</a> 來做示範，他的 input image size 定為 224*224，Rescale 成 0~1 之後還要 Normalize 到 mean=[0.485, 0.456, 0.406] 及 std=[0.229, 0.224, 0.225] ，一般來說都會在 Document 提及，要記得在 transform 的時候跟著調整，Model 的表現才會更好。</p><p>通常 Model 都會有 cnn layer output vector 的長度，以 ResNet50 來說，cnn layer output vector 的長度為 2048 ，所以我們修改 fc layer 時要記得先取得長度才能讓 Model 正常運作。</p><pre>from torchvision import models<br>import torchvision.transfomrs as T<br><br># 訓練的種類數量<br>num_classes = 10<br><br># Transform 成符合 Model 的樣子 之後會丟入 Dataset 中運作<br>transform_set = T.Compose([<br>  T.Resize(224),<br>  T.ToTensor(),<br>  T.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),<br>])<br><br># 如果想要用調整好的參數<br># model = models.resnet50(models.ResNet50_Weights.DEFAULT)<br>model = models.resnet50()<br>num_feat = model.fc.in_features  # 取得 Model 的 fc layer input 長度<br>model.fc = nn.Linear(in_features, num_classes)  # 修改 fc layer</pre><p>如果想要使用別人 Train 好的 Model ，就要使用註解掉的那一行，反之如果只是要拿架構來使用，並且用自己的 Dataset 進行訓練，就用底下沒有註解掉的那行。</p><p>為了解決不夠多資料進行訓練的問題，我們需要 Data Augmentation 的幫忙。</p><h3>Data Augmentation</h3><p>Data Augmentation 直翻的意思是資料強化，行為上是把資料經過一些轉換，可以讓 Model 訓練的更好（像上面的例子一樣），或是可以讓資料的變化更多元（旋轉、翻轉、改變色調之類的），下面會介紹幾種 Augmentation 的方式，另外還有許多方式，可以在<a href="https://pytorch.org/vision/stable/transforms.html">這裡</a>找到。</p><p><strong>Resize<br></strong>會把圖片的解析度重新設定，通常丟入 Model 之前會用到這個或是底下兩個裁切的功能。要提供 Resize 的大小，可以使用 int 或是 tuple。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*8P_DjzCcleD-Eth5-y_Alg.png" /></figure><p><strong>RandomCrop<br></strong>從圖片中擷取隨機一塊，通常會先 Resize 之後再做這件事，並且大小不會差太多，以防圖片的重點被裁掉導致訓練效果差。不過下圖只是為了示範，沒有先做 Resize 直接做 RandomCrop。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*FDu9gvjlvSNGvtgfBoYbqA.png" /></figure><p><strong>CenterCrop<br></strong>從中間擷取一塊圖片，比 RandomCrop 還要常用，通常不用擔心圖片重點被裁掉的問題。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*ld7FAMSj-7yCvOOj5jKTUQ.png" /></figure><p><strong>RamdomRotation<br></strong>對圖片做隨機旋轉，旋轉以及底下兩個翻轉都要考慮圖片是否適合做這個操作，比如說文字辨識就不太適合這麼處理。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*3s3vrMBi6cGAL2932Ep0kw.png" /></figure><p><strong>RandomHorizontalFlip<br></strong>對圖片做水平翻轉，和底下的垂直翻轉都只要給執行的機率即可。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*1w-eqx_8naE4Znb3Xc6zGA.png" /></figure><p><strong>RandomVerticalFlip<br></strong>對圖片做垂直翻轉。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*PdzPJISULE8i76HZ6YIPYQ.png" /></figure><p><strong>ColorJitter</strong><br>調整圖片的色調，可以調整的參數相對複雜，對於某些圖片可能不太適合這麼調整，比如說把蛋黃調整成綠色的會導致 Model 難以訓練。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*29Xa_XdWZiuK5UCN171ZeQ.png" /></figure><p><strong>GaussianBlur</strong><br>中文翻譯為高斯模糊，行為是把圖片調整得較為模糊，由於原始圖片比較難看出來，這邊放大了煙囪的部分，可以看到右邊的圖片比較模糊。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*efKLGGj9Nf4GPmLfSrc8Zw.png" /></figure><p><strong>RandomApply</strong><br>可以設定單一或多個行為的執行機率，透過 RandomApply 可以讓每個 epoch 拿到的圖片都不一樣，把上面的操作都包起來，每個執行機率設定為 0.5 ，可以看到底下執行出來的結果。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*WvChECn-H3dutVPBYBiJUQ.png" /></figure><h3>Implementation</h3><p>因為大部分的 code 都跟<a href="https://medium.com/swf-lab/%E8%87%AA%E5%B7%B1%E8%A8%93%E7%B7%B4-cnn-%E4%BE%86%E9%80%B2%E8%A1%8C-image-classification-pytorch-739825dfa487">這篇</a>差不多，這邊就不細講了，稍微不一樣的地方有兩處，一個是 Model 這次用 ResNet50，另一個是 Dataset 這次使用 CIFAR10 ，由於整個資料量太大，只取了其中的 10% 來使用。</p><p>另外把 Resize 以及 RandomCrop 搬到外面進行，習慣上會把每張圖都要做的事情跟隨機要做的事情分開，以便日後修正。</p><pre><br>import torch<br>from torchvision import models, datasets<br>import torchvision.transforms as T<br>from torch.utils.data import DataLoader<br>import torch.utils.data as data<br>from tqdm.auto import tqdm<br>from tqdm import tqdm<br>import torch.nn as nn<br>import torch.nn.functional as F<br><br>input_size = 224<br>num_classes = 10<br><br>transform_set = [<br>    T.RandomApply([T.RandomRotation(90)], p=0.5),<br>    T.RandomApply([T.ColorJitter(brightness=(0, 5), contrast=(0, 5), saturation=(0, 5), hue=(-0.1, 0.1))], p=0.5),<br>    T.RandomApply([T.GaussianBlur(101)], p=0.5),<br>    T.RandomApply([T.RandomHorizontalFlip(1)], p=0.5),<br>    T.RandomApply([T.RandomVerticalFlip(1)], p=0.5),<br>]<br><br>train_tfm = T.Compose([<br>    T.Resize(256),<br>    T.RandomCrop((input_size, input_size)),<br>    T.RandomApply(transform_set, p=1),<br>    T.ToTensor(),<br>    T.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])<br>])<br><br>def accuracy(outputs, labels):<br>    _, preds = torch.max(outputs, dim=1)<br>    return torch.tensor(torch.sum(preds == labels).item() / len(preds))<br><br>device = &quot;cuda&quot; if torch.cuda.is_available() else &quot;cpu&quot;<br>print(&#39;Training on&#39;, device)<br><br># get dataset<br>full_data = datasets.CIFAR10(<br>    root=&quot;data&quot;,<br>    train=True,<br>    download=True,<br>    transform=train_tfm<br>)<br><br>trash_data_size = int(len(full_data)*0.9)<br>partial_data_size = int(len(full_data) - trash_data_size)<br>train_data_size = int(partial_data_size * 0.9)<br>val_data_size = partial_data_size - train_data_size<br>trash_data, partial_data = data.random_split(full_data, [trash_data_size, partial_data_size])<br>train_data, val_data = data.random_split(partial_data, [train_data_size, val_data_size])<br><br># set batch size and load dataset into dataloader<br>batch_size = 16<br><br>print(f&quot;Length of Train Data : {len(train_data)}&quot;)<br>print(f&quot;Length of Val Data : {len(val_data)}&quot;)<br><br>train_dl = DataLoader(train_data, batch_size, shuffle = True, num_workers = 4, pin_memory = True)<br>val_dl = DataLoader(val_data, batch_size*2, num_workers = 4, pin_memory = True)<br><br><br>model = models.resnet50(weights=models.ResNet50_Weights.DEFAULT)<br>num_features = model.fc.in_features<br>model.fc = nn.Linear(num_features, num_classes)<br><br>model = model.to(device)<br><br>num_epochs = 10<br>lr = 0.001<br>optimizer = torch.optim.Adam(model.parameters(), lr)<br><br># start training<br>for epoch in range(num_epochs):<br>    train_list = []<br>    val_list = []<br>    # training<br>    model.train()<br>    for images, labels in tqdm(train_dl):<br>        optimizer.zero_grad()<br>        images = images.to(device)<br>        labels = labels.to(device)<br>        out = model(images)                  # Generate predictions<br>        train_loss = F.cross_entropy(out, labels) # Calculate loss<br>        train_acc = accuracy(out, labels)<br>        train_list.append(train_acc.item())<br>        train_loss.backward()<br>        optimizer.step()<br><br>    # validation<br>    model.eval()<br>    for images, labels in tqdm(val_dl):<br>        images = images.to(device)<br>        labels = labels.to(device)<br>        out = model(images)                    # Generate predictions<br>        val_loss = F.cross_entropy(out, labels)   # Calculate loss<br>        val_acc = accuracy(out, labels)           # Calculate accuracy<br>        val_list.append(val_acc.item())<br><br>    mean_train_acc = sum(train_list) / len(train_list)<br>    mean_val_acc = sum(val_list) / len(val_list)<br><br>    print(&#39;Epoch&#39;, epoch, &#39;\nTrain Loss&#39;, f&#39;\t{train_loss.item():.4f}&#39;, &#39;Train Acc&#39;, f&#39;\t{mean_val_acc:.4f}&#39;, &#39;\nVal Loss  &#39;, f&#39;\t{val_loss.item():.4f}&#39;, &#39;Val Acc  &#39;, f&#39;\t{mean_val_acc:.4f}&#39;)</pre><p>底下左側是執行 10 個 epoch 的結果，右側是我另外用一個簡單的 CNN 來比較，可以看到有 pre-trained model 的結果明顯的比較好，如果能多訓練幾個 epoch 相信能有更多的成長。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CFEjrQ0L_LsqOqwEKSdPqg.png" /></figure><h3>Conclusion</h3><p>以前修課的時候常常都要自己調整 Model 以及參數，常常都是把 Model 放著跑就去忙別的事情，過了幾個小時回來發現訓練的效果太差，再重複的做一樣的事。助教通常會禁止使用 pre-trained model ，希望我們能自己學習如何調整架構，以至於會花非常多的時間做作業。</p><p>實驗室的學長曾經跟我說，ML 是一種 life-style ，經過了幾個嚴酷的作業後，終於理解了學長的意思了QQ</p><p>包括前面的文章，Image Classification 的介紹應該算是蠻完整的，如果有哪裡寫的不清楚或是少講了什麼內容，請再留言跟我說！！</p><h3>Reference</h3><ul><li><a href="https://pytorch.org/vision/main/models/generated/torchvision.models.resnet50.html#torchvision.models.resnet50">resnet50 - Torchvision main documentation</a></li><li><a href="https://pytorch.org/vision/stable/transforms.html">Transforming and augmenting images - Torchvision 0.18 documentation</a></li><li><a href="https://pytorch.org/vision/stable/generated/torchvision.datasets.CIFAR10.html#torchvision.datasets.CIFAR10">CIFAR10 - Torchvision 0.15 documentation</a></li><li><a href="https://medium.com/swf-lab/%E8%87%AA%E5%B7%B1%E8%A8%93%E7%B7%B4-cnn-%E4%BE%86%E9%80%B2%E8%A1%8C-image-classification-pytorch-739825dfa487">自己訓練 CNN 來進行 Image Classification (Pytorch)</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5e761316fff2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swf-lab/%E6%A9%9F%E5%99%A8%E5%AD%B8%E7%BF%92%E5%88%86%E9%A1%9E%E5%99%A8%E5%9C%A8%E6%B2%88%E6%B5%B8%E5%BC%8F%E7%92%B0%E5%A2%83%E4%B9%8B%E6%87%89%E7%94%A8-4-predefined-model-and-data-augmentation-5e761316fff2">機器學習分類器在沈浸式環境之應用 — — 4. Predefined Model and Data Augmentation</a> was originally published in <a href="https://medium.com/swf-lab">SWF Lab</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DeFi 2.0: Olympus DAO (3,3) Research & Summary]]></title>
            <link>https://medium.com/swf-lab/defi-2-0-olympus-dao-3-3-research-summary-cf1858a38660?source=rss----50e7f2f831ca---4</link>
            <guid isPermaLink="false">https://medium.com/p/cf1858a38660</guid>
            <category><![CDATA[defi]]></category>
            <category><![CDATA[olympus-dao]]></category>
            <category><![CDATA[game-theory]]></category>
            <category><![CDATA[finance]]></category>
            <dc:creator><![CDATA[Jack Chai]]></dc:creator>
            <pubDate>Wed, 17 May 2023 14:05:58 GMT</pubDate>
            <atom:updated>2023-05-17T14:05:57.092Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><em>在希臘神話中， Olympus 是一座神聖的山脈，天堂的眾神和他們的僕人都居住在這裡；而在 DeFi 的世界中，Olympus 是 DeFi 領域最有趣的經濟實驗之一，同時也是 </em><a href="https://coinmarketcap.com/alexandria/article/what-is-defi-2-0"><em>DeFi 2.0</em></a><em> 的開山始祖。</em></blockquote><p><em>Author: </em><a href="http://linkedin.com/in/wei-chieh-chai"><em>Wei-Chieh(Jack), Chai</em></a></p><blockquote><strong>Olympus DAO 是第一個年化收益率超過 1000% 的去中心化儲備貨幣協議。</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QvYdR9sC0GkPhRaUUAbXCg.png" /></figure><h3><strong>Executive Summary</strong></h3><p>本報告主要介紹 Olympus DAO，2021 年 3 月 Olympus DAO 在 Discord 發跡，並自此成為 Web3 最具革命性的協議之一，重塑了我們所知的去中心化金融，作為 DeFi 2.0 的開山始祖，它是一種算法非穩定幣，並且目標是成為加密貨幣界首屈一指的去中心化<strong>儲備貨幣</strong>。</p><p><strong>債券機制</strong>是 OHM 成功的關鍵。它允許用戶以折扣價購買債券，等待五天的鎖倉期後收到 OHM 代幣。每個 OHM 代幣都由 Olympus 國庫中的資產支持（Backed not pegged），使用通過債券和抵押獲得的有價值資產儲備來發行和支持其原生代幣，創造了一個地板價以維護用戶購買力的模型。透過債券機制替代流動性挖礦模型，並以折扣價發行 OHM 和創建 LP 代幣來提供流動性，創造了協議擁有流動性（Protocol Owned Liquidity）的概念，解決了 Pool2 結束時流動性損失的問題，在 DeFi 領域是一個重大的發展。</p><p>Olympus DAO 的目標是創建一個去中心化、自由浮動但購買力穩定的記帳單位。<strong>Olympus DAO 運營著一個由其他加密貨幣（例如 ETH、Frax 和 DAI）以及 LP Token（OHM-DAI LP、OHM-FRAX LP等等）組成的金庫（Treasury）</strong>，原因是 DAO 決定每個發行的 OHM 必須有 1 美元或等值的抵押品支援，因此金庫的加密貨幣用於支撐 OHM 代幣的價值。目標是讓 OHM 成為未來所有 DeFi 產品的基礎貨幣，類似於美元等<strong>全球儲備貨幣，因此也有人稱這協議為幣圈美聯儲。</strong></p><p>OHM 的持有者有權投票決定 Olympus DAO 系統未來的命運，從而構建一個以社區為主導、以社區為基礎的金融平台，確保透明度和穩定性。OHM 曾經是一個成功的項目，提供高 APY 利率，並且有無數仿盤和土礦。Olympus DAO 透過這有趣的（3，3）迷因與創新的經濟實驗進入 DeFi 2.0 領域，通過創新的<strong>債券機制引入了Protocol Owned Liquidity</strong>解決了傳統 DeFi 流動性挖礦模型的問題，使其成為 DeFi 生態系統中最受關注的協議之一。</p><h3>Background</h3><blockquote><em>「最被使用的加密貨幣其實只是數位化的美元，這是一種奇妙的諷刺。雖然穩定幣可以實現穩定的美元價格，但這並不意味著它們在購買力上穩定。它們的真實價值就像銀行帳戶中的美元一樣會變動…」- Zeus</em></blockquote><blockquote><em>“There’s a strange irony to the fact that the most utilized cryptocurrency is really just a digitized dollar. While functional stablecoins may achieve a stable USD value, that does not mean they’re stable in purchasing power. Their real value changes just like dollars in a bank account…” — Zeus</em></blockquote><p>在加密貨幣領域中，像比特幣和以太坊等資產的價格波動很大，因此人們需要穩定幣。然而穩定幣通常與法定貨幣如美元相關聯，而這些法定貨幣可能因政府大量印製紙幣而貶值，進而影響其購買力。在這樣的背景下，Olympus DAO 創建了一種新算法非穩定幣，目標類似於金本位制貨幣體系，金本位制在現代貨幣政策中雖已不復存在，但大眾將 Olympus DAO 譽為加密世界的美聯儲，為一種全新的儲備貨幣體系 $OHM。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jzeBz5Y6E-bgd3ffbrQ9TA.png" /><figcaption><a href="https://twitter.com/OlympusDAO/status/1478859915418652677?s=20">Olympus — The future decentralized reserve currency (olympusdao.finance)https://twitter.com/OlympusDAO/status/1478859915418652677?s=20</a></figcaption></figure><h3>Intro</h3><h4>Olympus DAO</h4><blockquote>$OHM 是以太坊上的 ERC-20 代幣，All Time High 曾達到 $1415.26 USD，但目前已縮水 99.27%。該網路作為 DAO 進行管理，並不斷推出新的 OIP（Olympus Improvement Proposals），目前已進展到 Olympus V3。Olympus 協議的目標是為 Web3 生態創建一種去中心化的、抗審查的儲備貨幣，而這理念很重要，因為 Web3 金融運動的一個基本目標是培養滿足其各種利益相關者需求的去中心化替代經濟生態系統。</blockquote><p>流動性對於價格和市場穩定性都有很大的影響，然而不是每一種代幣或協議都幸運到擁有健康良好的流動性。原先 DeFi 1.0 租用流動性，參與者們可以把流動性借給協議以賺取收益或代幣獎勵再賣出，這就是傳統 DeFi 的挖提賣，但參與者們心態都是投機，因此回報率開始放緩之時，人們會將他們的資產並轉向收益更高的協議，對於項目方來說，流動性損失的打擊是致命的，同一時間其他公鏈崛起創造了一個多鏈的世界，進而分割了僅剩的流動性，最終可能會造成惡性循環的枯竭。</p><blockquote>這時候「 Protocol Owned Liquidity 協議自有流動性」這個概念就橫空出世，既然流動性來來去去會影響價格和市場穩定性，那協議透過機制去「擁有」流動性。</blockquote><p>因此 DeFi 2.0 <strong>透過各種機制去「擁有」流動性</strong>，進而改變了與資本持有者的關係，本協議不是租用流動性，而是旨在透過債券換取協議流動性，擁有資金的用戶將他們的資產出售給 Olympus DAO 購買債券以獲得打折的 OHM 代幣。</p><p>質押和債券機制使 Olympus 成為其自身流動性的所有者，這與許多（但不是全部）DeFi 1.0 項目有顯著區別，後者在將獎勵分配給農民時流動性會減少。</p><h4>Risk Free Value &amp; Treasury</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M_35cmYqoYSsBsLPTUPQrw.png" /><figcaption><a href="https://www.olympusdao.finance/">Olympus — The future decentralized reserve currency (olympusdao.finance)</a></figcaption></figure><p>Olympus DAO 是完全抵押並有一個 PCV 機制，PCV 是協議控制價值（Protocol Controlled Value），這比 TVL（Total Value Locked）這種唯利是圖的僱傭資本來說，可能更能夠當作是項目或者協議的保障。通過協議控制國庫儲備金，進而實現 OHM 增發回購、債券機制，進而推動 OHM 價值穩定，這裡的穩定和穩定幣的價格穩定不一樣，協議不會要求一個 OHM 要等於一個 DAI，但協議會要求一個 OHM 背後要至少有一個 DAI 同等價值的抵押物來支撐（Backed），賦予其一定程度的內在價值，因此 OHM 被大眾普遍認為具有一個底價（Floor Price）或無風險價值（Risk Free Value），其價值相當於支持每個代幣發行的資產數量，有點類似金本位貨幣制度的概念。國庫的當前 RFV 相當於穩定幣、wETH 以及 LP Token 的價格合計，由於 LP Token 在市場上的價值是有風險的，且由於針對 LP Token 鑄造 OHM 需要確保它始終可以支持該 OHM，因此 LP Token 的估值定為最低值並且為了考慮風險，LP 代幣還套入一個公式來計算溢價。</p><p>在 Uniswap v2 等 AMM 中，我們有價格公式 P(X)= k/x²。對於穩定幣來說，P(X) 與 P(Y) 始終等於 1，所以我們可以得到 x²=y²=k，也就是 x=y=sqrt(k)，進而得出 x+y=2.sqrt(k)。</p><p>對於 OHM，其協議內在價值是 1 美元，為了估計 OHM-DAI 流動性池的價值，可以假設 1 OHM 的價值等於 1 DAI，所以 x=y，所以我們池的價值等於 2x（以 OHM 為單位）。另外根據前面提到的 x²=k，所以 x= sqrt(k)，可以得知流動性池的價值就等於 2. sqrt(k)，而根據 OHM 價格的浮動，乘積也會有所不同。</p><blockquote><strong><em>Risk Free Value = 2sqrt（Constant Product） * （% ownership of the pool）</em></strong></blockquote><blockquote><strong><em>Delta = Market Value — Risk Free Value</em></strong></blockquote><blockquote><strong><em>無風險價值 = 2sqrt（恆定乘積）*（礦池所有權百分比）</em></strong></blockquote><blockquote><strong><em>Delta = 市場價值 — 無風險價值</em></strong></blockquote><p>溢價越高，市場價值與無風險價值之間的差異就越大（這差距稱為“delta”）。例如，具有 1 OHM 和 400 DAI（市值 800 美元）的 LP Token，這時可以由公式算出無風險價值為 40 美元（2*sqrt（400 * 1））delta 值為 760 美元。協議強調不要將 delta 視為失去價值，而是將他視為捐贈給市場的量化風險，換句話說就是協議願意為用戶和市場承擔這個 LP Token 的 95%（760/800*100%）損失，因此一開始的計算方式就像協議早就承擔了那個損失一樣。</p><blockquote>因此協議控制價值（Protocol Control Value）讓代幣有了可以讓更多人信服的基礎，因此假設當前每個 OHM 有 20 美元的支持，如果用戶 FUD 導致突然對 OHM 失去信心，每個 OHM 仍然會有底價 20 美元。</blockquote><p>因此有了上述的 PCV 機制以及國庫運作，他也有獨特的發行機制，用戶不能直接通過協議鑄造 OHM，也不能銷毀 OHM 贖回等值的資產，而是當它的交易價格高於其 1 DAI 的價格下限時，它會自動鑄造增發新的 OHM 壓低價格並分配給質押者當作獎勵，而當它的交易價格低於該價格下限時，會回購且銷毀 OHM 來抬價，我們可以發現不論是通貨膨脹還是通貨緊縮，協議其實都能夠獲利，假設當 1 OHM = 100 DAI 時，協議會增發 OHM，並以 100 DAI 的價格出售，由於協議只要求 1 OHM 背後有 1 DAI 來支撐，那多出來的 99 DAI 就是協議的收益了，在多了 99 DAI的儲備金之後，又可以再增發新的OHM 然後分配給質押者當獎勵。1 OHM = 0.5 DAI 時，協議會回購 OHM，付出價格為 0.5 DAI 而非 1 DAI，DAI 的儲備率這時就獲得提高。</p><h4>High APY</h4><p>大家注意到 Olympus 這個協議的原因可能或多或少是因為他超高額（曾經達到 8000%）的 APY ， APY 是「年化收益率」（Annual Percentage Yield）的縮寫，這裡我們可以當成是複利的衡量標準，這與 APR 或年度百分比回報率不同，而後者通常是單利的衡量標準，APY 是一年內投資收益的總額的衡量標準並考慮到複利效應。如果一位投資者有 1000 美元的資金，並且可以選擇每天獲得 2％ 的單利或每天 1.5％ 的複利，最初的傾向可能是選擇 2％ 的單利，因為在一周的時間裡，單利將淨賺 14 % （0.02 * 7），而複利將淨賺 11% （1.01⁵⁷－1），在一個月的時間裡，單利將淨賺 60%，而複利將淨賺 56%。，然而隨著時間的推移，複利實則可以帶來更高的回報。在一年內，2％ 的單利收益率將帶來回報 730％，而每天 1.5％ 的複利收益率則將帶來回報 22814％。</p><p><strong>Olympus 協議的高 APY 很大程度上歸功於複利的力量</strong>，每 2200 個以太坊區塊，也就是大約 8 小時左右的時間 Olympus DAO 就會自動複利，每次複利都會發放能跟 OHM 1：1 兌換的 sOHM，整年來看我們就會經歷大約 <strong>3*365=1095</strong>次的 Rebase，因此 APY 會如下面的公式，而這就是誇張 APY 的來源。</p><pre>&gt; $APY = (1+Reward Yield)^{1095}$</pre><p>回到國庫機制，假設 Olympus DAO 國庫中有 1000 萬美元等值的加密貨幣以及 100 萬個 OHM 流通，這代表每個 OHM 都有 10 美元價值的加密貨幣支持，這遠遠超過每個 OHM 承諾的 1 美元價值。為了解決這個問題，Olympus DAO 將額外鑄造 900 萬 OHM，你可能會認為大量增加代幣供應將導致價格下跌甚至是惡性通貨膨脹，然而Olympus DAO 鑄造的大部分 OHM 都分發給質押 OHM 的人當作推高 APY 的代幣獎勵，這邊便創造了一個納許均衡，因為 OHM 質押後有超高的收益率，並且只要大家都質押那麼市場上流動的 OHM 會變少，那麼代幣價格就會上升，上升後協議還會增發代幣繼續通貨膨脹，通貨膨脹後的代幣在分配給質押者，造成 APY 螺旋上升，一飛沖天，所以市場上 OHM 的持有者都會選擇質押而不是出售。</p><h4>（３，３）Meme</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nU_BYKAzLZW_4r-Vq_KkBA.png" /><figcaption><a href="https://olympusdao.medium.com/the-game-theory-of-olympus-e4c5f19a77df">The Game (Theory) of Olympus. The simplest model of Olympus has two… | by OlympusDAO | Medium</a></figcaption></figure><p>承接上述高額 APY 是因為大家都選擇質押代幣，Olympus 的經濟模型支持三種類型的用戶操作：質押、買債券和出售（後續會詳細說明），我們可以知道當所有使用者都參與質押時，即達到了協議用戶雙贏的狀態，這個狀態甚至形成了一個流行的meme：（3，3）。</p><ul><li>質押對所有 Olympus 參與者最有利，因為顯著提高了 OHM 的價值，用戶通過購買代幣產生積極的購買壓力，流通被鎖定導致其稀缺性增加，質押收益高是吸引用戶參與協議的主因。長期來看，Olympus DAO 社群有一句話叫 Time in OHM &gt; Timing OHM （待的時間長短比入場時間更重要），即是不斷強調長期質押才能享受到上萬的 APY 收益，因為要相信時間和複利的力量。</li><li>債券購買也是好的，雖然不如質押為協議創造的好處，但債券可以為 Olympus 國庫提供資產，並接收 LP Token 捕獲流動性。</li><li>出售被認為是負面的，因為它給 OHM 的價格帶來了下降的壓力，價格下跌可能會帶來拋壓，市場一旦出現大量賣出操作，OHM 的價格和協議質押的 APY 也會螺旋式下降。</li></ul><p>簡單來說（3，3）meme 就是用來說服用戶長期鎖倉質押以享有上述提到的超高 APY，當用戶持續質押並且在過程中協議也會賣出債券，這使協議掌握大量流動性並有了十足的底氣，不用擔心吸血鬼攻擊，雖然（3，3）meme 就是個沒那麼嚴謹的賽局，但他很有趣，接下來會仔細介紹質押和債券機制為這協議帶來什麼改變和創新？</p><h3>Protocol Owned Liquidity</h3><p><strong>流動性是協議存在的必要條件</strong>，沒有流動性，協議就不會有好的交易深度，因此建立代幣流動性對於新協議來說至關重要。原先幾乎所有協議都建立在以太坊上，然而其他公鏈崛起以及其他擴容方案的提出使我們<strong>進入了多鏈的時代，原本的資產流動性也進一步被分散到各大鏈上</strong>。另一方面，許多協議為了獲得流動性，他們提供 Yield Farming，這時流動性提供者被高利率吸引而來，願意承擔風險以換取收益，然而存入 Yield Farming 的流動性通常可以隨時提取，對於那些唯利是圖的「農夫」們，追求最高的獎勵才是唯一目的，因此如果獎勵下降或出現提供更高獎勵的協議，他們的離開肯定會隨之而來。 因此，許多協定與其流動性提供者的關係是不健康並且常會造成流動性枯竭以及破碎。</p><p>為了解決這種問題，Olympus DAO 提出一個全新概念＂Protocol Owned Liquidity＂（協議自有流動性），首先用戶可以用 DAI 或 wETH 以及 OHM-DAI、OHM-Frax 等 LP tokens ，來購買打折的 OHM ，這被稱為「折價債券」（discount bonds）或是零息債券（Zero coupon bond），透過流動性債券讓用戶把 LP Token 轉移給國庫並將 OHM 代幣給用戶，使用這種機制即可在鑄造代幣當下支付一次性成本，而不是無限期地租用流動性，這使協議一直擁有大量的OHM流動性，而且作為 LP 所有者的國庫會收到通過交易產生的費用。</p><p>協議出售這些債券賺取協議資金後，可以使內在 1DAI 的 OHM 擁有高出幾百倍的市場價格，這些會用於鑄造和分配更多的 OHM 給在協議上質押代幣的用戶，由於質押收益相當高，更多的用戶會受到高度激勵，進而向 OlympusDAO 再度質押這些代幣，避免了挖提賣的操作。</p><p>上述 LP Token 的獲取以及質押功能都可以使 Olympus DAO 掌握 99.8% 的 OHM 流動性。</p><p>以下將詳細說明質押和債券策略差別：</p><h4>質押：</h4><p>質押是一種被動的長期策略，也是（3，3）機制的主導策略，Olympus DAO 的主要價值累積機制就是透過質押，Time in OHM &gt; Timing OHM ，時間和每天自動複利三次的力量能讓用戶享受到上萬的 APY 收益。用戶質押他們的 OHM 以在固定時間間隔（8 小時為一個週期 epoch）獲得 rebase 獎勵，rebase 獎勵來自前面提到債券銷售進入國庫的收益，隨著國庫價值的增長，鑄造 OHM 並向質押用戶支付高收益的能力也在增長，因為協議用能夠使用那些多餘的資產來發行更多的代幣，而這裡的代幣是 sOHM（Staked OHM） ，是協議的利潤累積代幣。（ sOHM 可以 1 : 1 和 OHM 進行兌換，供應量也是1 : 1）用戶這時也可以將獲得的 sOHM 獎勵在各種 DeFi 協議上加以利用跟組合（DeFi 疊疊樂），甚至還能拿去其他協議做為抵押品進行借貸，繼續回頭購買 OHM，進而提升資本利用率來產生更多價值。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*xXRYvKxdEaEzw6WY2uLXXw.png" /><figcaption><a href="https://twitter.com/hellopandadao">https://twitter.com/hellopandadao</a></figcaption></figure><p>先前提到的 meme：（3，3）是 Olympus DAO 非常強勁的宣傳品，簡單說就是購買並質押，然後最好就不要再領出來了，社群用了超不嚴謹的賽局論告訴大家，買了之後長期質押是一個用戶協議雙贏的方法。</p><ul><li>每天自動複利三次的力量能讓用戶享受到上萬的 APY 收益</li><li>獎勵來自前面提到債券銷售進入國庫的收益，隨著國庫價值的增長，協議確實具有支付高收益的能力</li><li>sOHM 能拿去其他協議做為抵押品進行借貸提升資本利用率</li><li>長期質押是一個用戶協議雙贏的方法</li></ul><h4>債券：</h4><p>債券購買算是 Olympus DAO 開創的一種獨特機制，當債券數量較多時，債券折扣會上升，而當債券數量較少時，債券折扣會下降。這是協議的第二個價值累積策略，它允許用戶通過穩定幣、wETH 以及 LP Token 等資產注入國庫，並以「折價債券」（Discount bonds）或是零息債券（Zero coupon bond）的形式購買打折的 OHM，故尋求購買 OHM 的用戶可以避免滑價以及用更便宜的價格獲得代幣，但需要低於五天的解鎖期才能完全獲得購買的OHM，避免直接的拋壓。</p><p>通過債券積累資產與 LP Token 的目標是建立 Olympus 資金庫的實力，同時協議獲得了自己的流動性和儲備資產，避免流動性是在僱傭資本的手上，這也為國庫帶來被動收入的能力，協議擁有 LP Token，因此只要進行交易，他們就會繼續從這些池中賺取收入。</p><ul><li>用戶能獲得折扣的 OHM</li><li>穩定幣、wETH 等資產能增加國庫儲備，同時增加其 RFV，這舉動增加了可發行的 OHM 數量，並維持承諾質押者的高收益</li><li>LP token 保證了國庫可以控制大部分的流動性，並通過 LP token 的方式賺取手續費</li><li>加深自動做市商上面的深度</li><li>債券吸引 Fomo 的新用戶</li></ul><h4>Olympus Pro：Bonds-as-a-Service（BaaS）：</h4><blockquote>OHM Pro Value = (# of Protocols) * (Average Value of Bond Sales) * 3.3%</blockquote><p>Olympus Pro （OP） 於 2021 年 9 月推出，他是一種 Bonds-as-a-Service，就是 Olympus 他們把官方的債券功能抽出來變成一個服務，允許其他 DAO 和項目通過 POL 控制其流動性，採用 Olympus Pro 協議，用戶可以存入 LP Token 後以折扣價獲得該協議原生代幣。由於債券系統的開創性以及成功的先例，許多其協議想要使用這 Olympus 創造的東西，因此 Olympus Pro 創建了一個平台，新的和現有的協議可以將 Olympus 債券系統安裝到他們的平台中以獲得同樣捕獲流動性的能力。Olympus DAO 以賣出債券的 3.3% 的手續費提供這項服務，對其他協議來說，與其一直支付流動性挖礦獎勵，這顯然是筆划算的交易，Olympus 還可以為合作夥伴提供基礎設施、專業知識和大量曝光度，使開發人員能夠花更少的時間構思代幣經濟學，而將更多時間用於構思好產品。對 Olympus 來說，他們能夠去結盟更多的 DeFi 項目，因為任何項目都會需要流動性，有足夠深的流動性才能夠吸引更多的資本和用戶進入，</p><p>這個功能非常受歡迎，短短的上線時間，Olympus DAO 已經在 4 個不同的區塊鏈和 Layer 2 中招募了超過 40 個合作夥伴（Alchemix、Frax Finance、StakeDAO 等等），同時幫助其他項目綁定了超過 4500 萬美元的流動資金，在此過程中，Olympus Pro 也幫國庫創造了超過 200 萬美元的收入，這是一種雙贏。</p><ul><li>允許其他 DAO 和項目通過債券控制其流動性</li><li>Olympus 還可以為合作夥伴提供基礎設施、專業知識和大量曝光度</li><li>每個項目的代幣收取 3.3%，創造一種新的收入形式</li><li>Olympus 能夠結盟更多 DeFi 項目，更多的合作夥伴代表更多收入，更的收入意味著更多國庫資金</li></ul><h3>Olympus V2</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_WUiCAdoGl3AJYfBa86j3w.png" /><figcaption><a href="https://olympusdao.medium.com/">OlympusDAO — Medium</a></figcaption></figure><p>Olympus V2 這次升級考慮了去中心化和跨鏈，Stakers 將通過實施 Compound 的 Governance module（Governor Bravo） 來控制協議合約。這分階段推出，首先是推出多簽錢包制度開始，然後是鏈上治理的債券，同時鏈上治理將通過 gOHM （以前稱為 wsOHM）進行。用戶現在可以直接在 gOHM 中質押，從而節省時間和 Gas fee。</p><blockquote><strong><em>gOHM</em></strong></blockquote><ul><li>gOHM 是 Olympus 升級後的鏈上治理代幣，V1 OHM 和 V1 sOHM 將在 V2 推出後兌換成 gOHM。具有靜態平衡和遞增的贖回價值，期望通過 gOHM 實現跨鏈功能並進行鏈上治理。</li><li>gOHM 對 Olympus Proteus 的作用很重要，Proteus 是 OIP-45 中提出的流動性激勵計劃，目標優化 Olympus 的跨鏈且快速引導新鏈的流動性，並模擬在每條鏈上的表現。</li><li>質押 OHM 換得 gOHM 時，每 8 小時會發生一次 rebase， gOHM 不會像 sOHM 那樣在 rebase 時改變數量，但每次 rebase 都會使 Current Index（影響價格） 上升使 gOHM 更值錢，因為 gOHM 的價格與當前指數掛鉤</li></ul><pre>gOHM = $OHM * Index</pre><p>作為 APY 的直接因素，指數的價值隨著時間的推移而增加，這個指數又稱基本質押率（Basic Staking Rate）。這反映網絡的增長並作為 OHM 的需求驅動因素、參考利率以及構成 OHM 債券的基礎來形成不同到期日的收益率曲線。</p><blockquote><strong><em>債券更新</em></strong></blockquote><p>在 V1 中，用戶選擇一種債券，然後交換代幣並在 5 天內得到它，許多用戶會選擇在這 5 天的時間內領取並重新抵押他們的獎勵，但以太坊上的高 gas fee 使用戶做這些操作的成本很高。V2 引入了一項新功能，能夠自動質押代幣，從而最大限度地提高收益並降低 gas fee。</p><ul><li><strong>債券不再線性贖回</strong></li></ul><p>用戶必須等到期間結束才能贖回，這種非流動性創造了一種鎖定質押形式，消除浪費 gas fee 的交易</p><ul><li><strong>新的債券被創建為獨立的產品</strong></li></ul><p>每張債券都有可支付的最大 OHM 數額或可購買的最大本金數額，一旦超過金額該債券就會退役</p><ul><li><strong>債券可以作為 NFT 持有</strong></li></ul><p>這使得二級債券市場具有流動性</p><ul><li><strong>債券可以是定期的或限定時間到期的。</strong></li></ul><p>原先如果債券期限為 1 週，則到期日將在 1 週後；新的情況是如果債券在第 8 天到期，而你在第 1 天購買，則期限為 7 天；如果您在第 2 天購買相同的債券，則你的期限為 6 天，<strong>定期債券為 ERC1155，固定到期債券為 ERC20</strong>，這有助於組合性，可以被包裝成代幣並像任何 ERC20 一樣進行交易</p><ul><li><strong>債券做為提供前端的獎勵。</strong></li></ul><p>這將激勵第三方為協議運行前端，降低單點故障風險</p><ul><li><strong>債券自動抵押</strong></li></ul><p>自動質押代幣，從而最大限度地提高收益並降低 gas fee</p><h3>Olympus V3</h3><p>2022 年 8 月，Olympus 升級為 V3 版本，而這是當前和最新版本。</p><blockquote><strong><em>債券種類：反向債券</em></strong></blockquote><p>Inverse Bonding 是 Olympus DAO 增加 OHM 流動性和吸收市場波動的新工具，債券一直是 Olympus 出名的主因。反向債券概念源自於 <a href="https://forum.olympusdao.finance/d/1020-oip-76-create-inverse-bond-policy-lever">OIP 76</a> ，允許協議創造一種使 OHM 退出流通的方法，基本機制很簡單，將 OHM 交給國庫以換取一些國庫資產，反向債券的目的不是維持價格，而是跟<a href="https://docs.google.com/document/u/2/d/e/2PACX-1vSIufbgAxAAtZkITd_s57o5AmyhAnk6iYbLYvN-ATL59hQ5nC2t2BTPvA8X9DYzFa-i3PRw9ARrAS9E/pub"><strong>Range Bound Stability</strong></a>搭配去充當吸收市場波動的槓桿。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gscQlr_KRxjpL0kM7FqNHw.png" /><figcaption><a href="https://docs.google.com/document/u/2/d/e/2PACX-1vSIufbgAxAAtZkITd_s57o5AmyhAnk6iYbLYvN-ATL59hQ5nC2t2BTPvA8X9DYzFa-i3PRw9ARrAS9E/pub">Range Bound Stability</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-xXPrPiPc0gkMXdU20uUEw.png" /><figcaption><a href="https://docs.olympusdao.finance/main/overview/range-bound">https://docs.olympusdao.finance/main/overview/range-bound</a></figcaption></figure><p>Olympus Protocol 自動執行市場操作，以吸收 OHM 市價與儲備資產之間的波動性，此系統稱為 Range-Bound Stability （RBS），這是一種具有財政儲備和協議擁有流動性的新型代幣發行機制，該機制創建了一個演算法預測的交易範圍，協議提供一系列的 maker和 taker 競價，創建持續、可預測的市場定價，目標是優化流動性深度和儲備，以實現穩健性和長期市場穩定性。</p><p>Olympus 的財政儲備原先有單向性，資產（如 DAI，FRAX，ETH 等）流入但不流出，大部分協議擁有的資產作為儲備並未進入 OHM 市場。這種結構在一開始是必要的，捕獲的資金不被釋放是合理的，隨著後續財政規模的擴大，關於其利用的問題自然而然地浮現，原先直覺做法是將資產部署到各種有收益的機會中，以產生回報並以股息形式分配給持有人，充當<strong>共同基金或對沖基金</strong>，但這永遠不是這些儲備的主要目的或實用性。朝這個方向發展可能要承擔更多風險。因此後續作法是協議資產應該通過執行市場操作來支持 OHM 市場並應該有明確的、經過溝通的市場目標，以利用其資本來實現，以降低參與者的市場風險。</p><p>RBS 的運作方式包括在下降的市場利用儲備購回 OHM，並在上升市場出售 OHM，以實現價格穩定，效果是在價格大幅上升或下降時，協議提供流動性以阻止市場，目標是創建一個範圍，實現合理且具有吸引力的增長，同時減少不利的波動性，市場可以通過兩種方式引導這個範圍，第一個是範圍由<strong>移動平均線</strong>決定，協議計算並維持 OHM 與指定儲備資產的移動平均價格，並根據移動平均價格計算 OHM 與指定儲備資產的價格上下界，隨著時間的推移，範圍根據市場真實狀況進行調整，並在市場希望移動的方向上提供更大的空間，第二個是範圍可以被打破，市場可以無視協議的緩和措施，但對於協議來說，這是最壞的情況，因為它已經做了錯誤的交易，而且被迫退出市場並允許市場全面承擔風險或減少風險</p><p><strong>價格上下界分為牆和緩衝兩個部分，計算公式為：</strong></p><p>Lower Wall = MA * (1 — Wall Spread) Lower Cushion = MA * (1 — Cushion Spread) Upper Cushion = MA * (1 + Cushion Spread) Upper Wall = MA * (1 + Wall Spread)</p><p>其中，Cushion Spread &lt; Wall Spread。</p><p><strong>對於下限牆 （Lower Wall） 和上限牆（Upper Wall)）的容量配置：</strong></p><ul><li>下限牆的容量應為 Olympus Treasury 中的儲備資產乘以配置的出價因子。 Bid Capacity = Bid Factor * Reserves</li><li>上限牆的容量應為下限牆容量除以上限牆價格，並按下限牆與上限牆的價差比例放大。 Ask Capacity = Bid Capacity * (1 + 2 * Wall Spread)</li><li>容量耗盡時，系統應暫停該方向的兌換，直至容量恢復</li></ul><p>基本機制主要由具上限和下限的價格範圍組成，上限由協議擁有的 OHM 支持的鏈上賣單表示，而下限由儲備資金支持的鏈上買單表示。價格範圍基於交易對手資產的一個設定期間的<strong>移動平均價</strong>。當OHM價格上升時，價格範圍的上限和下限會相應上調。當OHM價格下降時，範圍會向下調整。因此該範圍由市場活動的滯後平均確定。這個機制讓市場參與者在價格波動時有更多的信心，因為他們知道國庫將在某種程度上提供支持，同時也確保了市場的穩定性，因為OHM價格在設定的上下限範圍內波動。</p><p><a href="https://docs.google.com/document/u/2/d/e/2PACX-1vSIufbgAxAAtZkITd_s57o5AmyhAnk6iYbLYvN-ATL59hQ5nC2t2BTPvA8X9DYzFa-i3PRw9ARrAS9E/pub"><strong>白皮書中提供了兩個有趣例子來理解機制：</strong></a></p><ol><li>單行雙車道兩側有護欄。駕駛根據道路走向選擇行駛在左或右車道，然而車道選擇不重要，重點是駕駛應留在道路上，若試圖離開道路，將受到護欄的阻攔，但若有足夠意圖，仍可突破護欄離開道路，然而駕駛員有動機保持在道路上，因為道路將引導他們前往目的地。</li><li>一個人站在兩堵中等深度的牆之間，他與每堵牆之間有一個橡膠彈力帶，這人隨機加速移動，在某個時機，他朝著其中一堵牆加速，當他們靠近時，他們撞到彈力帶，若他的動量小於橡膠的強度，彈力帶有效地改變他們的路線並使他們朝反方向移動，若動量大於橡膠強度，彈力帶會斷裂，他們撞到牆。 <strong>上述例子可以知道範圍模型的功能：駕駛和人代表市場價格，橡膠彈力帶作為買賣價格緩衝，護欄和牆壁作為買賣價格牆，目標是持續調節並扭轉市場動量，使市場價格保持在範圍內。</strong></li></ol><p>範圍模型針對儲備資產進行計算，取決於以下因素：</p><ol><li>移動平均（MA）：來自提供 OHM 與儲備價格的預言機數據</li><li>牆壁間距（SW）：由治理設定或算法計算牆面與MA的距離</li><li>緩衝間距（SC）：由治理設定或算法計算緩衝價與MA的距離</li><li>出價因子（FB）：由治理設定，為財政部持有的儲備資產（R）的百分比</li><li>緩衝因子（FC）：由治理設定，為買賣價格的百分比</li><li>緩衝期間（TC）：由治理設定，為一段時間長度</li></ol><p>利用這些變量計算四個主要因子：總買單（B）、總賣單（A）、範圍牆壁緩衝以及相應的買賣單。具體包括：</p><ol><li>買單（B）：財政部在範圍低點將花費的儲備金額</li><li>賣單（A）：財政部在範圍高點將花費的 OHM 數量</li><li>範圍低點緩衝（CL）：可以創建債券市場以用儲備購回OHM的的最高價格</li><li>範圍低點牆（WL）：國庫將用儲備購回 OHM 的固定價格</li><li>範圍高點緩衝（CH）：可以創建債券市場以用 OHM 購回儲備的最低價格</li><li>範圍高點牆（WH）：國庫將出售 OHM 購回儲備的固定價格</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/487/1*QUnKk1aQIBrXLjJuHKZOow.png" /></figure><p>這些都由簡單的智能合約執行，以 WL/WH 價格報出 BW/AW 大小的永久買賣單，任何人都可以隨時與這些訂單互動，預計只有在市場報價不利時才會有人參與，但它們仍可供參與者自由選擇。</p><p>範圍緩衝由即時交換債券市場執行，實際的市場創建（需要消耗Gas）取決於第三方，他們由套利機會驅使，當市場價格P &lt; CL時，任何人都可以生成一個買單市場，當市場價格P &gt; CH時，任何人都可以生成一個賣單市場。</p><p><strong>顧及篇幅以及難度&gt;&lt;，有興趣的可以</strong><a href="https://youtu.be/uF9vT4HsDWA"><strong>參考此影片</strong></a><strong>以及 </strong><a href="https://docs.google.com/document/u/2/d/e/2PACX-1vSIufbgAxAAtZkITd_s57o5AmyhAnk6iYbLYvN-ATL59hQ5nC2t2BTPvA8X9DYzFa-i3PRw9ARrAS9E/pub"><strong>Reference的文件</strong></a></p><p><strong><em>RBS</em></strong><em> </em><strong><em>總結：</em></strong></p><ul><li><strong>Olympus Protocol 通過 Range-Bound Stability (RBS) 系統，自動執行市場操作以實現價格穩定。</strong></li><li><strong>RBS 系統涉及在不同市場趨勢下利用儲備去購買和出售 OHM。</strong></li><li><strong>根據 RBS V1 系統規範，實現價格穩定的方法包括計算移動平均價格、設定價格上下界、配置上下限牆以及構建債券市場等。</strong></li></ul><blockquote><strong><em>Flex Loans</em></strong></blockquote><ol><li>Flex Loans 是一種白名單產品，幫助協議通過無息貸款擴大其協議擁有的流動性。</li><li>借款人可以將 gOHM 作為抵押品，借款高達 100% 的抵押價值比率的 OHM，並與其他代幣配對創建流動性對。</li><li>由於貸款與抵押品是相同計價，因此沒有清算風險</li><li>經 Olympus 批准後，借款人將 gOHM 和目標 LP 代幣存入 Flex Loan 合約。</li><li>合約根據存入的 gOHM 借款，將得到的 OHM 與提供的代幣配對，並在借款人選擇的指定 DEX 上創建 LP。目前支持 Balancer、Uniswap、Sushiswap 和 Curve</li><li>借款人可以隨時還款，可以通過直接支付 OHM 債務（從 LP 或外部供應）或使用部分 gOHM 抵押品來完成</li></ol><h3>Summary</h3><p>資源分散以及逐利的問題讓我們進入 DeFi 2.0，而創新性的 POL 將流動性從負債轉變為收入來源，由於 Olympus DAO 神奇的模型和隨後對 DeFi 2.0 的催化，也使 Olympus DAO 的 forks 變的超級多，超過 110 種的 OHM forks 為 Uniswap 之後最多 forks的 DeFi 協議，儘管有時候還是會被人說是資金盤，但其獨到的模型讓我想到了一句話＂All models are wrong, but some are useful＂，這厲害的模型也給後續協議創造出了許多的參考價值。或許這個協議會成功有一部分得歸功於 2021 牛市，大家手上資金多，一旦進入熊市，大家手上的資金偏向避險，這種項目的存活率可能會跌落谷底。因此長期來看，這些代幣要真正發展起來，除了嚴謹（或創新）的代幣經濟學之外，可能還需要發展出吸引人的敘事，更要拓展足夠多的應用場景，來滿足大家的真實需求，實現長期的用戶增長。</p><p>延伸閱讀：</p><p><a href="https://youtu.be/djLjdJ7uuX4">Olympus Pro | How to get a bond</a></p><p><a href="https://academy.binance.com/en/articles/what-is-defi-2-0-and-why-does-it-matter">What Is DeFi 2.0 and Why Does it Matter? | Binance Academy</a></p><p><a href="https://learn.bybit.com/defi/what-is-defi-2-0/">What Is DeFi 2.0, How It Improves on DeFi 1.0 — and How to Invest in It</a></p><p><a href="https://people.eecs.berkeley.edu/~ksk/files/Ohm_Liquidity_Management.pdf">https://people.eecs.berkeley.edu/~ksk/files/Ohm_Liquidity_Management.pdf</a></p><p><a href="https://youtu.be/l33vsvNSWyM">https://youtu.be/l33vsvNSWyM</a></p><p><a href="https://youtu.be/sJZ46jbD4b8">https://youtu.be/sJZ46jbD4b8</a></p><h3>Reference</h3><p><a href="https://olympusdao.medium.com/**">https://olympusdao.medium.com/</a></p><p><a href="https://medium.com/olympusdao-chinese**">https://medium.com/olympusdao-chinese</a></p><p><a href="https://twitter.com/OlympusDAO?s=20**">https://twitter.com/OlympusDAO?s=20</a></p><p><a href="https://www.olympusdao.finance/">Olympus — The future decentralized reserve currency (olympusdao.finance)</a></p><p><a href="https://cryptoslate.com/why-olympus-dao-cant-sustain-its-growth/">https://cryptoslate.com/why-olympus-dao-cant-sustain-its-growth/</a></p><p><a href="https://twitter.com/raccoonhkg/">https://twitter.com/raccoonhkg/</a></p><p><a href="https://docs.bondprotocol.finance/">Protocol Overview — Bond Protocol</a></p><p><a href="https://abmedia.io/20211012-spell-ohm-toke-analysis">https://abmedia.io/20211012-spell-ohm-toke-analysis</a></p><p><a href="https://www.blocktempo.com/what-is-olympusddao-is-it-a-defi-myth/">https://www.blocktempo.com/what-is-olympusddao-is-it-a-defi-myth/</a></p><p><a href="https://www.chaincatcher.com/article/2078323">https://www.chaincatcher.com/article/2078323</a></p><p><a href="https://docs.google.com/document/u/2/d/e/2PACX-1vSIufbgAxAAtZkITd_s57o5AmyhAnk6iYbLYvN-ATL59hQ5nC2t2BTPvA8X9DYzFa-i3PRw9ARrAS9E/pub">Range-Bound Stability (google.com)</a></p><p><a href="https://research.thetie.io/olympus-dao/">https://research.thetie.io/olympus-dao/</a></p><ul><li>“Special thanks to 陳品 for his review.”</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cf1858a38660" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swf-lab/defi-2-0-olympus-dao-3-3-research-summary-cf1858a38660">DeFi 2.0: Olympus DAO (3,3) Research &amp; Summary</a> was originally published in <a href="https://medium.com/swf-lab">SWF Lab</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[快速了解 BRC20：比特幣區塊鏈上的新代幣標準與 Ordinals 協議]]></title>
            <link>https://medium.com/swf-lab/%E5%BF%AB%E9%80%9F%E4%BA%86%E8%A7%A3-brc20-%E6%AF%94%E7%89%B9%E5%B9%A3%E5%8D%80%E5%A1%8A%E9%8F%88%E4%B8%8A%E7%9A%84%E6%96%B0%E4%BB%A3%E5%B9%A3%E6%A8%99%E6%BA%96%E8%88%87-ordinals-%E5%8D%94%E8%AD%B0-3917567d7208?source=rss----50e7f2f831ca---4</link>
            <guid isPermaLink="false">https://medium.com/p/3917567d7208</guid>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[brc20]]></category>
            <category><![CDATA[finance]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ordinal]]></category>
            <dc:creator><![CDATA[Jack Chai]]></dc:creator>
            <pubDate>Wed, 17 May 2023 14:04:45 GMT</pubDate>
            <atom:updated>2023-05-19T15:48:56.312Z</atom:updated>
            <content:encoded><![CDATA[<h4>Exploring the Impact and Potential of BRC20: A New Token Standard on the Bitcoin Blockchain with Ordinals Protocol</h4><h3>概要</h3><ul><li>“<strong>Bitcoin Request for Comment</strong>”（BRC20） 是一種新的、實驗性的代幣標準，用於在比特幣區塊鏈上發行和轉移可替代的代幣。</li><li>BRC20 於 2023 年 3 月首次亮相，使用 Ordinals 協議。</li><li>截至 2023 年 5 月 9 日，所有 BRC20 代幣的超過 10 億美元。而截至目前（2023 年 5 月 15日，總市值為 5.2 億美元）</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7mzpP3FHkwqWxV3D.png" /><figcaption><a href="https://brc-20.io/">https://brc-20.io/</a></figcaption></figure><h3>介紹</h3><h3><strong>Ordinal</strong></h3><p>要了解 BRC20 之前，我們必須先了解什麼是 Ordinals protocols，Ordinals 是比特幣的 NFT 實現協議，原先比特幣上是沒有智能合約的，因此要打造 NFT 是有難度的，但 Ordinals 協議允許用戶將 NFT 添加到比特幣交易中，具體的做法源自於比特幣的最小單位 Satoshi（Sats），一顆 Sats = <strong>0.00000001 顆比特幣</strong>，也就是說 1 顆比特幣為 1 億顆 Sats。</p><p>Ordinals 協議將「不同的 Satoshi 按照順序編號」為基礎上再往每個 Satoshi 裡寫入數據（如圖片、字串等），由於是最小單位因此不可分割，加上獨一無二的編號，它就變成了「比特幣 NFT」。然而 Ordinals 協議問世之後，比特幣上發布的銘文（inscription）包括圖片、文字，還是沒被大眾所看見，但 BRC20 這個代幣標準的出現改變這一切。</p><h3>什麼是 BRC20 代幣</h3><p>BRC20 代幣標準在 2023/3/9 被 Domo （@domdata on Twitter）提出，<strong>他是一個基於 Ordinals 協議的新可互換代幣實驗，BRC20 跟以太坊的 ERC20 沒有任何關聯，可以說是蹭熱度，也可以說是該實驗旨在將以太坊的代幣功能帶入到比特幣中。</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fPEvlTPzGRhBibky.png" /><figcaption>部署鑄造銘文，tick 字串用來表示代幣名，max 表示供應量，lim 表示每次轉移最大數額。</figcaption></figure><p><strong>Domo 的設計利用以 Ordinals 的 JSON 數據包為載體（在比特幣區塊鏈上嵌入 JSON 數據），包含 deploy、mint、transfer 等參數，實現部署、鑄造和轉移代幣，並透過中心化</strong>的鏈下管帳平台管理交易，這種管帳方式與技術比以太坊粗糙許多，但一款加密貨幣成功不僅僅依賴於其技術和實際功能，更依賴其有趣的<strong>敘事</strong>進而推升了共識，正所謂共識面前技術不值一提，價格跟技術不一定有正相關。</p><blockquote><em>首個 BRC20 代幣合約部署的是「ordi」代幣，每次鑄幣限制為 1000 個，總量為 2100 萬個。</em></blockquote><p>以下是一些基本的操作</p><pre>##部署<br>{ <br>	&quot;p&quot;: &quot;brc-20&quot;, <br>	&quot;op&quot;: &quot;deploy&quot;, <br>	&quot;tick&quot;: &quot;ordi&quot;, <br>	&quot;max&quot;: &quot;21000000&quot;, <br>	&quot;lim&quot;: &quot;1000&quot; <br>}<br>##部署銘文，tick 字串用來表示代幣名，max 表示供應量，lim 表示每次轉移最大數額##</pre><pre>##鑄造<br>{<br>	&quot;p&quot;: &quot;brc-20&quot;,<br>	&quot;op&quot;: &quot;mint&quot;,<br>	&quot;tick&quot;: &quot;ordi&quot;,<br>	&quot;amt&quot;: &quot;1000&quot;<br>}<br>## amt 不能超過轉移最大數額和餘額 ##</pre><pre>##轉移<br>{<br>	&quot;p&quot;: &quot;brc-20&quot;,<br>	&quot;op&quot;: &quot;transfer&quot;,<br>	&quot;tick&quot;: &quot;ordi&quot;,<br>	&quot;amt&quot;: &quot;100&quot;,<br>}<br>##no ‘to’ address is required<br>##fee and to keys were for demo indexing purposes only. Inclusions have no effect on the function nor do they invalidate it. </pre><p>操作非常的簡單，然而當前的功能和服務由於區塊以及前端的不穩定性，各方面還顯得不是很成熟。</p><h3>如何購買 BRC20 代幣</h3><p>BRC20 的參與方式除了 mint 之外還可以用買的，撇除掉交易所，BRC20 代幣可以在 <a href="https://unisat.io/market">UniSat</a> 購買。UniSat Wallet 是一款非託管錢包，具有與 MetaMask 相似的功能，可以用來管理 Ordinals 和 BRC20 的序號，該錢包以開源的 Chrome 擴展功能形式存在，無需運行完整節點就能達成 Ordinals 和 BRC20 的使用，並允許創建、儲存和傳輸 NFT 序號，此外 UniSat 也支援 BRC20 的 Transfer。</p><p>由於近期使用者數量激增 UniSat 錢包和網頁目前運行可能較為不順暢，但團隊正在努力優化並改善對外部請求的處理能力。</p><p>UniSat 市場目前處於「實驗測試」模式，要求用戶擁有 OG Pass NFT 或累積一定的點數才有資格在平臺上進行交易，手續費也蠻貴的可能會有一些費預期的損耗，使用時需要謹慎。</p><h3>風險</h3><ul><li>這只是一個實驗，代幣本身並無價值與應用場景</li><li>只能 deploy、mint、transfer，無法進行更高級操作</li><li>詐騙與資金盤層出不窮</li><li>BRC20 暴增的交易量大幅增加了比特幣的交易費用</li><li>不可替代性造成比特幣的貨幣性質減少</li><li>需要中心化平台管帳，且佔用區塊空間，違背去中心化、擴容的主流敘事</li><li>去中心化的前提下，BRC20 無法實現智能合約和 DeFi，因為比特幣是沒有智能合約功能的，鏈上的可編程性不足，若要打造在鏈上的金融衍生品，相關的計算操作可能需要透過鏈下的方式來解決，一旦沒有搭配有效的驗證方式，去中心化的特性將被剝奪。</li><li>流動性不夠成熟，且操作的手續費很高</li></ul><h3>總結</h3><ul><li>BRC20 以銘文的形式，在大帳本中設計了一個小帳本，很像是在一個大國家中搞一個地下組織，讓比特幣的核心擁護者有一些異音。</li><li>這只是一個實驗性質的代幣，但各方的積極參與和推動讓其發展性十分具有潛力，我們可以期待有朝一日會有更好的升級出現。</li><li>Ordinals 的敘事十分有趣，圖片或文字刻在比特幣上並永久存在的價值是一個大眾容易買單的敘事。</li><li>Ordinals 有關專案的交易量大增，內存池嚴重擁堵造成實際比特幣的交易受阻，威脅到比特幣作為電子現金的核心理念，或許我們可以把那些作為支付的交易利用閃電網路，將用戶資金轉移到鏈下通道中實時結算，交易結束後將最終狀態轉回鏈上清算，減少鏈上的堵塞情況、避免跟 Ordinals 相關專案搶占網路空間，進而去降低暴增的網路費用。</li><li>Meme Tokens 的交易量比有技術的幣種如 Arbitrum（$ARB） 還大，以資本的角度而言，流量跟敘事才是投資人比較關注的內容，有新故事才能拿到新資金。</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7suVIIRV5dm6cxgx.png" /></figure><h3>總結</h3><blockquote><em>記得自己賺取的必須是理智的財富，而不是短視近利的賭博贏得。</em></blockquote><p>DYOR and don’t ape in out of FOMO，DYOR 不僅僅是一種建議，而是每一位投資者的責任，在投資新的專案或者產品前我們必須了解該專案的核心價值、長遠的發展潛力、和可能存在的風險；同樣的，我們也不能因為害怕錯過而輕易地跟隨大眾的熱潮，不加思索地投入資金，「愚者千慮，必有一得」長期來看，我們要追求的應該是穩健的收益，而不是短暫的激情。</p><ul><li>special thanks to Panda for the support &amp; review.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3917567d7208" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swf-lab/%E5%BF%AB%E9%80%9F%E4%BA%86%E8%A7%A3-brc20-%E6%AF%94%E7%89%B9%E5%B9%A3%E5%8D%80%E5%A1%8A%E9%8F%88%E4%B8%8A%E7%9A%84%E6%96%B0%E4%BB%A3%E5%B9%A3%E6%A8%99%E6%BA%96%E8%88%87-ordinals-%E5%8D%94%E8%AD%B0-3917567d7208">快速了解 BRC20：比特幣區塊鏈上的新代幣標準與 Ordinals 協議</a> was originally published in <a href="https://medium.com/swf-lab">SWF Lab</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Analyzing NFT Market Predictability: Factors and Effects]]></title>
            <link>https://medium.com/swf-lab/analyzing-nft-market-predictability-factors-and-effects-7b78164d069f?source=rss----50e7f2f831ca---4</link>
            <guid isPermaLink="false">https://medium.com/p/7b78164d069f</guid>
            <category><![CDATA[nft]]></category>
            <category><![CDATA[marketing]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[strategy]]></category>
            <category><![CDATA[data]]></category>
            <dc:creator><![CDATA[Corn]]></dc:creator>
            <pubDate>Sun, 07 May 2023 11:22:22 GMT</pubDate>
            <atom:updated>2023-05-07T11:22:22.392Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1kvqb9x6QpnbR6v5BRJZoQ.jpeg" /></figure><h3>Foreword</h3><p>As a master’s student in finance and fintech, I have been reading numerous papers on the subject. Recently, I came across an interesting paper that discusses pricing in the NFT market using traditional financial methodology. In this document, I will share some parts of it.</p><p>The authors created indices for the NFT market, similar to the real estate market indices. They tested whether the NFT market return was influenced by other markets or assets. Additionally, they examined whether volatility and the NFT valuation ratio significantly predicted NFT market returns in time series, and tested for the existence of the size and reversal effect.</p><p>The paper is titled “The Economics of Non-Fungible Tokens”, and the authors are Nicola Borri, Yukun Liu, and Aleh Tsyvinski. It was published in March 2022 and contains abundant and detailed content. The NFT data is rich nowadays, and while I have only shared some topics, it is worth reading the entire paper if you have the time.</p><p>It’s the link to this paper：<a href="https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4052045">https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4052045</a></p><h3>Outline</h3><ol><li>Data</li><li>The NFT market index</li><li>Exposure to the NFT Market</li><li>NFT Market Return Predictability</li><li>Conclusion &amp; Useful Tool</li></ol><h3>Data</h3><p>The data comes from major exchanges such as Cryptokitties, Gods Unchained, Decentraland, Opensea, and Atomic. The dataset includes only transactions that represent the transfer of ownership of NFTs, excluding transactions for the minting of NFTs and auction bids. The data is divided into 52 weeks. If an NFT is traded more than once a week, then the average price is taken. The duration of the data is from the beginning of 2018 to the end of 2021.</p><h3>NFT market index</h3><p>The NFT market index is constructed by using the “repeat sales method”. This method is suitable for items that are heterogeneous and traded infrequently, such as the real estate market.</p><p>The authors assume that the difference in logged prices for two NFT sales is equal to the difference in the corresponding logged NFT market index, plus a random error that captures the idiosyncratic component of the specific NFT.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/428/1*4wVAQQdVCVzm41xrCAafgQ.png" /><figcaption>Repeat Sales Regression（RSR）</figcaption></figure><blockquote><strong>rit’t</strong>：return</blockquote><blockquote><strong>pit’</strong> ：logged sale price</blockquote><blockquote><strong>pit</strong>：logged purchase price</blockquote><blockquote><strong>bt</strong>：logged NFT market index at time t,</blockquote><blockquote><strong>bt’</strong>：logged NFT market index at time t’</blockquote><blockquote><strong>uitt’</strong>：multiplicative error term</blockquote><p>where t’ &gt; t. And removing return at the 99% level each week, price &lt; 1, transaction &lt; 2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gErh9kzoOUFlIzA26nZcQQ.png" /><figcaption>NFT Market Indices</figcaption></figure><p>This figure shows the NFT Market Index, which is constructed by using the baseline repeat sales method. The indices at the beginning are normalized to one.</p><p>After understanding the NFT market index, we can look at the summary statistics of the NFT market return：</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*Glg3l9iIWT1BNnqUzJwJzg.png" /><figcaption>summary statistics</figcaption></figure><p>Panel A presents the overall summary statistics of weekly NFT market returns.</p><blockquote><strong>NFTH</strong> index：the heteroscedasticity-adjusted NFT index</blockquote><blockquote><strong>CMKTRF：</strong>the cryptocurrency market excess return</blockquote><blockquote><strong>MKTRF</strong>：the stock market excess return</blockquote><p>Panel B shows the weekly average NFT index and NFTH index return by quarter.</p><p>It is evident that the NFT market has a larger volatility, with the standard deviation and mean significantly greater than those of other markets. Moreover, the Skewness is 1.098, indicating a right-skewed distribution and most transactions resulting in negative returns. The Kurtosis is 7.732, indicating a fat-tailed distribution with extremely high returns occurring occasionally.</p><p>In panel B, we observe a rapid increase in the index return during 2020Q2, which peaked in 2021Q3. This is consistent with the real market condition based on the real transaction volume.</p><h3>Exposure to the NFT Market</h3><p>This section examines the relationship between NFT market returns and the cryptocurrency market, as well as traditional markets such as stocks, commodities, and currencies.</p><h4>1. Exposures of NFT Market to Cryptocurrency Factors</h4><p>The authors use three factors to examine the relationship between NFT and cryptocurrency:</p><blockquote>CMKTRF：represents the cryptocurrency market,</blockquote><blockquote>CSIZE：represents the size, and</blockquote><blockquote>CMOM：represents momentum. Additionally,</blockquote><blockquote>CVALUE：represents value, which is measured by the price-to-new address ratio.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/603/1*cmgSyQHcaLj2YqItOpFB-Q.png" /><figcaption>Exposures of NFT Market to Cryptocurrency Factors</figcaption></figure><p>In all specifications, CMKTRF is significantly positive at the 1% level, even when controlling for size, momentum, and value factors. This indicates that the excess returns of the NFT market are influenced by excess returns of the cryptocurrency market, and in the same direction.</p><p>For instance, in column (1), a 1% increase in the excess returns of the cryptocurrency market would lead to a 0.789% increase in the excess returns of the NFT market.</p><h4>2. Exposures to Traditional Asset Market Factors</h4><p>In this section, the authors examine the relationship between the NFT market and traditional asset markets, including stocks, commodities, and currencies. To analyze the stock market, they use several models, including the CAPM, Fama-French 3-factor model, Carhart 4-factor model, and Fama-French 5-factor model.</p><p>In panel A, the following variables are introduced:</p><blockquote>MKTRF：represents the excess return of the stock market</blockquote><blockquote>SMB：represents the size effect</blockquote><blockquote>HML：represents value</blockquote><blockquote>MOM：represents momentum</blockquote><blockquote>RMW：represents an investment</blockquote><blockquote>CMA：represents profitability</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*Unx21UvdJiNal3W6ThGfNg.png" /><figcaption>Exposures of NFT Market to Traditional Asset Market Factors</figcaption></figure><p>According to this table, the MKTRF factor has a significant positive impact at the 5% level, while the other factors have no effect except for the value factor (HML). This suggests that the NFT market’s excess return is positively influenced by the stock market’s excess return, but the effect is small due to the low R-squared.</p><p>The variables in panel B：</p><blockquote>Gold</blockquote><blockquote>BBG Commodity：the Bloomberg commodity index</blockquote><blockquote>Dollar：US Currency</blockquote><blockquote>Carry：Carry Trade</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*CybP_ZVQCy51nebW-c8Ulw.png" /><figcaption>Exposures of NFT Market to Traditional Asset Market Factors</figcaption></figure><p>In this section, we found that only the commodity index could influence the excess return of the NFT market. Other factors had no significant effect. The coefficient is significantly positive at a 1% level, but the R-square is very small. This factor is effective but not huge.</p><h4>3. NFT-Related Cryptocurrencies and NFT Market</h4><p>Some companies issue both cryptocurrency and NFT, such as Decentraland’s MANA token, Axie Infinity’s AXS token, and others.</p><p>In this section, we want to examine whether the excess return of NFT-related cryptocurrencies is influenced by their NFT return and study whether the cumulative excess return of NFT-related cryptocurrencies can be predicted by lagged NFT returns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*1JWj_8tHKQuYLgdniyXl5Q.png" /><figcaption>NFT Coins</figcaption></figure><p>CMKTRF is the cryptocurrency market excess return.</p><p>In Table Panel A, we can see that the NFT market excess return is significantly positive at the 1% level. Even after controlling for the CMKTRF factor, it remains significant at the 5% level. This suggests that the excess return of NFT-related cryptocurrencies can be influenced by NFTs themselves. This result is not surprising and simply confirms my expectations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*kC6655HUeEXXqfkgPSgKMw.png" /><figcaption>NFT Coins predictability</figcaption></figure><p>Panel B is a test of predictability that uses the lagged NFT market excess return to predict the future cumulative excess return of NFT-related cryptocurrencies. The results show that the NFT market excess return can predict the future two-week cumulative excess return of NFT-related cryptocurrencies. This predictability is significant at the 5% level. Specifically, a 1% increase in NFT market index excess return leads to a 0.33% increase in NFT-related cryptocurrencies&#39; cumulative excess return at the two-week horizon.</p><h3>NFT Market Return Predictability</h3><p>This section focuses on predictability. First, we studied some variables that are used to predict time-series returns for traditional asset markets such as volatility, valuation ratio, attention, past returns, and volume.</p><p>Second, we studied cross-sectional return predictability and the variables that include size and momentum to test the size effect and reversal effect for NFT returns.</p><h4>1. Time-Series Return Predictability</h4><p>a. Volatility</p><p>Some papers have shown that volatility tends to negatively predict future asset returns. In this section, we test whether the NFT market exhibits the same effect.</p><p>The authors assume that the <strong>volatility of NFT market excess returns is the sum of the trailing squared NFT market excess returns of the past eight weeks.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/1*dprkmn9EvjiIbPtxONq5xg.png" /><figcaption>NFT Time-Series Volatility</figcaption></figure><p>First, Vol represents volatility, We can observe that volatility is significantly negative from the five-week to eight-week horizon. This means that the cumulative excess return of the NFT market can be influenced by volatility in the 8-week horizon. Additionally, if the volatility increases, the future NFT market cumulative excess return will decrease. This result is consistent with previous research.</p><p>b. Valuation Ratio</p><p>In the equity market, the valuation ratio is typically represented by market-to-fundamental ratios, which are calculated by dividing market value by book value or fundamental value. In the NFT market, the market value of NFTs is determined by the NFT market index (repeat sales index), while the fundamental value is based on the total transaction count.</p><p>As a result, the <strong>valuation ratio in the NFT market is measured using the logged index-to-transaction ratio.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*1SAyIfzP9nK0fnTA_MXfIg.png" /><figcaption>NFT Time-Series Valuation Ratio</figcaption></figure><p>In Panel A, we can observe that the valuation ratio has a consistently negative relationship with NFT market excess returns across all horizons. This indicates that the valuation ratio is a strong predictor of the market’s performance, as an increase in the valuation ratio is significantly associated with a decrease in cumulative excess returns.</p><p>Moreover, the R-squared value is quite high, with a value of 0.269 over an eight-week horizon. This suggests that the valuation ratio is an important factor that can be utilized to predict NFT market excess returns.</p><p>c. Attention</p><p>In this subsection, we examine whether investor attention can predict future NFT market returns. To accomplish this, the authors create a metric called the<strong> “Google_NFT” deviation, which measures the difference in Google searches for NFT in a given week compared to the preceding eight-week average.</strong> This metric is calculated by subtracting the average of the preceding eight weeks’ search volume from the search volume in the current week.</p><p>In addition to Google_NFT, other attention metrics such as Google_crypto and Google_bitcoin are also considered.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/839/1*LKKOAuk3kFXA27q03nviGw.png" /><figcaption>NFT Time-Series Attention</figcaption></figure><p>This table confirms that investor attention does not significantly influence future NFT market cumulative excess returns. Therefore, attention is not an important factor in predicting NFT market performance.</p><p>In my opinion, I think only using Google search count to proxy attention may not be quietly appropriate, maybe can include the mention count of social media（e.g Twitter, Reddit） or articles to proxy attention！</p><p>d. Momentum</p><p>The momentum effect has been observed in various markets, such as stocks, bonds, cryptocurrencies, and real estate. In this subsection, we investigate whether this effect is existing in the NFT market.</p><p>To accomplish this, <strong>the authors use current NFT market excess returns to predict future cumulative returns in the NFT market</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/1*b61XTF2x-YYbvZsEeVKGnA.png" /><figcaption>Serial Dependence</figcaption></figure><p>Based on the results presented in the table, it is surprising for me to note that there is no momentum effect observed in the NFT market. Therefore, attempting to chase prices in this market is unlikely to result in profits.</p><p>e. Volume</p><p>In most markets, there is a positive relationship between trading volume and returns. In this subsection, we aim to examine this relationship in the NFT market.</p><p>To achieve this, we construct a <strong>volume metric by measuring the deviation of NFT trading volume in a given week from the average of the preceding eight weeks.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/803/1*wn_X7bvg12OmeB2adT4AlQ.png" /><figcaption>NFT Time-Series Volume</figcaption></figure><p>The table reveals a significant and positive relationship between trading volume and future cumulative NFT market excess returns over one to three-week horizons.</p><p>This result aligns with my expectations, as similar findings have been observed in other markets. Moreover, it is consistent with the demand-supply theory, which suggests that the price is influenced by the traded quantity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*5DaH3HbolCTXfjk6ebFnCw.png" /><figcaption>NFT Time-Series Volume</figcaption></figure><p>However, in panel B, when the valuation ratio and volatility are added as additional factors, the effect of volume becomes considerably weaker. Nevertheless, the valuation ratio remains a significant predictor of NFT market returns.</p><p>In conclusion, the factors of volume, volatility, and valuation ratio (logged index-transactions) are all important in predicting NFT market returns. However, the most crucial factor is the valuation ratio (logged index-transactions), and it can be the primary focus when predicting NFT market returns in time-series analysis.</p><h3>2. Cross-Sectional Return Predictability</h3><p>In this section, we investigate the presence of the size and reversal effects in the cross-section of NFT returns. This analysis involves examining the differences between individual returns.</p><h4>1. Size Effect</h4><p>Previous research has shown that in the cross-section of stock returns, smaller stocks tend to outperform larger stocks. This phenomenon is commonly referred to as the size effect.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/446/1*eWLiMvty8uQZ0HGuZ8-eRA.png" /></figure><p>The authors use the <strong>market price of individual NFT（(t’- t) lnPit）to identify the potential size effect</strong> （higher means big size）and control the market index（bt）to form the equation. γ is the elasticity, which means when the purchase price changes 1% then the return will change γ percent. So we test whether γ is significant, if it’s then the size effect is present.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/588/1*RCiVP55XZ9rl2jQNnJN3mg.png" /><figcaption>Size Effect</figcaption></figure><p>In this table, we can find the coefficient is -0.004 in Full Sample, and the result is significantly negative. That means when the purchase price increases 1% then the average NFT return will decrease 0.004%, and the result suggests that expensive NFTs tend to significantly underperform when compared to the less expensive NFTs. （The possible reason is explained in the paper on page 25.）</p><h4>2. Reversal effect</h4><p>The momentum and reversal effects are commonly examined in asset pricing. In this section, we test these effects using past returns. Additionally, we only consider NFTs that have had at least three transactions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/404/1*HGS5yLasYwOiCPh4sbN6IA.png" /></figure><p><strong>ri,b is the logged average weekly return of NFT i’s previous repeat sales, and γ is the elasticity.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*AwzOM47rJFqk2xPmLAroLw.png" /><figcaption>Reversal Effect</figcaption></figure><p>The results show a significant negative coefficient for past weekly returns in the full sample. Specifically, a 1% increase in past weekly returns results in a 0.014% decrease in future returns. This confirms the existence of the reversal effect, where high average past returns tend to underperform significantly.</p><h3>Conclusion</h3><p>In this study, the authors created an NFT market index using the repeat sales method and found that the cryptocurrency market had the most significant impact on the NFT market.</p><p>They also examined the predictability of the NFT market return and found that the most important factor in time-series return predictability is the valuation ratio.</p><p>In addition, they confirmed the existence of the size effect and reversal effect in the cross-section return predictability. Specifically, small-size NFTs (low price) outperformed big-size NFTs (high price), and high past returns significantly underperformed in the future.</p><p>The paper provides in-depth explanations and details about the methodology and factors used. Therefore, it’s worth reading the whole paper to better understand the research.</p><ul><li><strong><em>All the figures and tables are from the original paper.</em></strong></li></ul><blockquote>BTW, if you are interested in NFTs, I ‘d like to recommend a useful tool to you.</blockquote><blockquote><a href="https://dune.com/corncobbb/swf-lab-nft-analysis">https://dune.com/corncobbb/swf-lab-nft-analysis</a></blockquote><blockquote>It’s the NFT analysis Dune Dashboard, which provides an overview of the NFT market as well as analyses of price, volume, profit, holders, and wash trades. All you need to do is enter the NFT contract address in the space provided in the upper left corner.</blockquote><blockquote>I think it’s helpful for your NFT analysis！！</blockquote><h3>Reviewers</h3><p>Thanks for <a href="https://medium.com/u/199b3d97c60d">王昱淮</a> <a href="https://medium.com/u/66698e481bf9">UN SWEET</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b78164d069f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swf-lab/analyzing-nft-market-predictability-factors-and-effects-7b78164d069f">Analyzing NFT Market Predictability: Factors and Effects</a> was originally published in <a href="https://medium.com/swf-lab">SWF Lab</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[網頁開發常見之 CORS 錯誤原因與 Express 解決辦法]]></title>
            <link>https://medium.com/swf-lab/%E7%B6%B2%E9%A0%81%E9%96%8B%E7%99%BC%E5%B8%B8%E8%A6%8B%E4%B9%8B-cors-%E9%8C%AF%E8%AA%A4%E5%8E%9F%E5%9B%A0%E8%88%87-express-%E8%A7%A3%E6%B1%BA%E8%BE%A6%E6%B3%95-bc5eeedea6dc?source=rss----50e7f2f831ca---4</link>
            <guid isPermaLink="false">https://medium.com/p/bc5eeedea6dc</guid>
            <category><![CDATA[dev]]></category>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[cors]]></category>
            <category><![CDATA[express]]></category>
            <category><![CDATA[modern-web-development]]></category>
            <dc:creator><![CDATA[CookSen]]></dc:creator>
            <pubDate>Sun, 16 Apr 2023 09:56:11 GMT</pubDate>
            <atom:updated>2023-04-16T09:56:11.479Z</atom:updated>
            <content:encoded><![CDATA[<h3>前言</h3><p>相信有在開發前後端的人對 CORS (Cross-Origin Resource Sharing) 絕對不陌生，特別是他跳出的錯誤訊息：</p><blockquote>Access to fetch at ‘<a href="http://localhost:3000/&#39;">https://blablabla:3001/&#39;</a> from origin ‘<a href="http://localhost:8081&#39;/">http://localhost:3000&#39;</a> has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.</blockquote><p>而 CORS 其實是一種安全機制，用於限制在網頁上的跨域請求。雖然這項技術為網站提供了更好的安全性和可靠性，但在實際應用中，有時候會因為 CORS 錯誤而出現各種問題，如請求失敗或跨域資源無法正常載入等。因此，了解 CORS 錯誤的原因和解決辦法對於網頁開發人員來說是非常重要的。在這篇文章中，我們將探討 CORS 錯誤的原因和解決辦法，幫助讀者更好地了解這個議題並解決相關問題。</p><h3>什麼是 CORS 和 CORS 跨域錯誤？</h3><p>這裡就要從 CORS 的全名，Cross-Origin 中的 Origin 說起，Origin 是指發出跨域請求的網頁的源網域。它由協議（http:// 或 https://）、主機名稱和 Port 組成。例如，一個 Origin 可以是 https://example.com 或 http://localhost:3000。</p><p>而跨域請求是指從另一個源（Origin）發出的請求，例如從 https://api.example.com 發出到 https://example.com 的請求，可以看出這裡的主機名稱就不同了；或是從 http://localhost:3000 發送到 http://localhost:3001 也會是跨域請求，因為 Port 不同了。</p><p>而當跨域請求產生時，可以分為簡單請求與非簡單請求：</p><h4>簡單請求：</h4><p>滿足以下所有條件的跨域請求：</p><ul><li>使用GET、POST、HEAD方法之一。</li><li>Content-Type的值只能是text/plain、multipart/form-data、application/x-www-form-urlencoded中的一種。</li><li>請求標頭中沒有使用自定義標頭。</li></ul><p>對於簡單請求，瀏覽器直接發送跨域請求，並在請求標頭中加上一個Origin字段，表示這個請求的發起源，服務器收到這個請求後，在返回的標頭中加上一個Access-Control-Allow-Origin字段，指定允許哪些源發起跨域請求，瀏覽器接收到服務器的回應後，會根據Access-Control-Allow-Origin的值決定是否允許該請求。</p><p>實際舉例的話就例如 get 一個圖片，或是一段 HTML 文字等，這類 api 用法就不會遇到 cors 阻擋。</p><h4>非簡單請求：</h4><p>不滿足簡單請求條件的跨域請求，例如使用PUT、DELETE等方法，或者Content-Type為application/json等自定義類型，或者使用自定義請求標頭等。</p><p>對於非簡單請求，瀏覽器會在發送實際請求之前，會先發送一個預檢請求，即OPTIONS請求，這個請求中包含了Access-Control-Request-Method、Access-Control-Request-Headers等標頭，用於告訴服務器該實際請求中使用的HTTP方法和自定義標頭。服務器接收到這個預檢請求後，檢查該請求是否允許跨域請求，如果允許，就在回應標頭中加上Access-Control-Allow-Origin、Access-Control-Allow-Methods、Access-Control-Allow-Headers等標頭，告訴瀏覽器允許跨域請求。然後瀏覽器才會發送實際的跨域請求。</p><p>有點類似瀏覽器會協助保護被要求資料的一端，並幫忙兩者溝通。</p><p>而若要更進一步討論為什麼要分成簡單請求與非簡單請求，我個人是理解為可以從你是否能讀取這個資料當作判斷依據，像是我用簡單請求網路上的圖片、字型等資料，最後呈現的只會是瀏覽器，前端程式能取用的資源有限，因此就不像非簡單請求一樣需要 CORS 擋在中間。</p><p>開發網站時，常常會遇到前端與後端的Port不同，或是前後端各自擁有獨立的網域的狀況，當呼叫api時，就可能會遇到CORS錯誤。讀完前述內容後，就可以很容易理解這個錯誤出現的原因了吧！</p><h3>為什麼需要 CORS 擋在中間？</h3><p>CORS 的重要性在於它允許瀏覽器強制執行同源策略（Same Origin Policy）。同源策略是一種安全措施，可防止惡意腳本訪問它不應該訪問的資源。</p><p>如果沒有 CORS，惡意腳本可以向另一個網域的服務器發出請求，並訪問該頁面使用者未打算訪問的資源。也就是說今天你可以隨意架設一個前端戳你目標網域的所有 Port，取得被攻擊者所有資料，這當然會衍生出許多問題，因此就需要 CORS 對來源做把關。</p><h3>該如何解決 CORS 錯誤呢？</h3><p>解決 CORS 問題有很多種方法，分別可以從前端與後端下手，但大多從前端解決的方法都無法真正解決這個問題，所以這篇文章會主要介紹後端的解決辦法，並使用 Express 後端架構舉例。</p><p>預設情況下，Express 不允許跨域存取。換句話說，如果未設置 CORS 相關設置，則無法存取。不過，官方提供了一個易用的中介軟體來實作 CORS，讓我們一起來看看如何使用吧！</p><p>首先安裝：</p><pre>npm install cors<br>npm install @types/cors --save-dev</pre><p>再來在 express 專案中引入：</p><pre>var express = require(&#39;express&#39;);<br>var cors = require(&#39;cors&#39;);<br>var app = express();<br><br>app.use(cors());</pre><p>但這時候的 CORS 預設是全部開放，會有點危險，進一步設定可以像以下步驟：</p><pre>const corsOptions = {<br>  origin: [<br>    &#39;https://www.example.com&#39;,<br>    &#39;http://localhost:3001&#39;,<br>  ],<br>  methods: &#39;GET,HEAD,PUT,PATCH,POST,DELETE,OPTIONS&#39;,<br>  allowedHeaders: [&#39;Content-Type&#39;, &#39;Authorization&#39;],<br>};<br><br>app.use(cors(corsOptions));</pre><p>在 origin 這個 array 中新增你要許可的來源。</p><p>在 methods 設置可存取的方法，可以用逗號隔開也可以使用像 origin 的 string array 宣告。</p><p>在 allowedHeaders 中，這裡設定了[&#39;Content-Type&#39;, ‘Authorization’]。這表示只有在請求標頭中包含這兩個標頭時，才會允許跨域請求。</p><h3>結語：</h3><p>CORS 錯誤是我自己本身開發前後端時很常遇到的問題，特別是當先把前後其中一端架到伺服器後，要測試時就會看到這個讓人頭痛的錯誤。</p><p>希望這篇文章可以幫助正在頭痛或是不太懂背後原理的人們，也讓自己以後有個筆記可以回來複習複習。</p><h3>Reference:</h3><ul><li><a href="https://developer.mozilla.org/zh-TW/docs/Web/HTTP/CORS">跨來源資源共用（CORS） - HTTP | MDN</a></li><li><a href="https://expressjs.com/en/resources/middleware/cors.html">cors</a></li><li><a href="https://note.pcwu.net/2017/03/16/nodejs-cors/">[Node.js] 如何在 Node.js 設定 CORS</a></li><li><a href="https://blog.huli.tw/2021/02/19/cors-guide-1/">CORS 完全手冊（一）：為什麼會發生 CORS 錯誤？</a></li><li><a href="https://ithelp.ithome.com.tw/articles/10243077">[今晚我想來點 Express 佐 MVC 分層架構] DAY 09 - Express 安全防護 - iT 邦幫忙::一起幫忙解決難題，拯救 IT 人的一天</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bc5eeedea6dc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swf-lab/%E7%B6%B2%E9%A0%81%E9%96%8B%E7%99%BC%E5%B8%B8%E8%A6%8B%E4%B9%8B-cors-%E9%8C%AF%E8%AA%A4%E5%8E%9F%E5%9B%A0%E8%88%87-express-%E8%A7%A3%E6%B1%BA%E8%BE%A6%E6%B3%95-bc5eeedea6dc">網頁開發常見之 CORS 錯誤原因與 Express 解決辦法</a> was originally published in <a href="https://medium.com/swf-lab">SWF Lab</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>