學術產出-Theses

Article View/Open

Publication Export

Google ScholarTM

政大圖書館

Citation Infomation

  • No doi shows Citation Infomation
題名 實作區塊鏈交易池狀態快照與模擬工具:以 Uniswap 為例
A Snapshot and Simulation Tool for Ethereum Transaction Pool: Uniswap as an example
作者 林祐丞
Lin, Yu-Cheng
貢獻者 陳恭
Chen, Kung
林祐丞
Lin, Yu-Cheng
關鍵詞 去中心化金融
Uniswap
三明治攻擊
區塊鏈交易池
Decentralized Finance
Uniswap
Sandwich Attack
Transaction Mempool
日期 2023
上傳時間 2-Aug-2023 14:06:22 (UTC+8)
摘要 在區塊鏈技術的普及和去中心化金融(DeFi)的崛起的背景下,區塊鏈交易的安全性、透明度和效率成為人們普遍關注的重要議題。對此,我們的研究專注於開發一款新型的工具,這款工具的目標是對區塊鏈交易池狀態進行全面的快照記錄和模擬,以加深對區塊鏈交易打包順序以及競價攻擊的理解,並進一步提高區塊鏈技術的效率和可靠性。在我們的研究中,一個主要的動機源於區塊鏈交易的批次性質以及其公開透明的特徵,這兩種特性都使得區塊鏈交易更容易受到競價攻擊,如三明治攻擊,進而導致交易池狀態的不穩定性增加。基於這樣的背景,我們在深入研究去中心化交易所,例如Uniswap的運作模式和競價攻擊問題的基礎上,開發出了這款工具。
為了讓讀者對區塊鏈交易有更深入的理解,本研究首先對去中心化金融、去中心化交易所以及價格攻擊等相關概念進行了詳細的回顧與介紹。透過這種方式,我們期望讀者能夠對這些概念有一個基本且全面的理解。然後,我們介紹了我們工具的設計理念和實現方式,其中包括工具的整體架構、框架設計和系統流程設計。為了驗證工具的實際運作效果,我們利用一個已編寫完成的三明治套利機器人來模擬和測試,主要是透過偵測私有區塊鏈網路交易池的變動並模仿用戶的Uniswap交易來檢驗模擬期間是否會受到攻擊。通過這種方式,我們證明了工具快照的交易狀態可用於模擬,進而增進區塊鏈交易的安全性。而我們的研究重點並非在於套利機器人本身,而是在於證明工具取得的快照和模擬能力。
在結論部分,我們對本研究的重要發現進行了總結。透過開發一款專為區塊鏈交易池設計的全新工具,我們為相關研究提供了堅實的技術支援。這款工具的出現,能使我們對區塊鏈交易的本質有更深的理解,提高區塊鏈技術的運作效率,對抗競價攻擊,同時更好地保護使用者的權益。儘管我們目前只開發出了最小可行性產品(Minimum Viable Product,MVP),但我們深信,隨著這款工具的進一步完善和發展,以及其他相關研究的持續推進,對於擴大其功能與應用範疇,這款工具在未來的區塊鏈研究中將扮演更重要的角色,從而推進區塊鏈技術的創新與進步。
With the popularity of blockchain technology and the rise of decentralized finance (DeFi), the safety, transparency, and efficiency of blockchain transactions have become major topics of concern. To address these issues, our study focuses on the development of a novel tool that aims to snapshot and simulate the state of blockchain transaction pools comprehensively. The goal is to deepen the understanding of blockchain transaction sequencing and front-running attacks, and further improve the efficiency and reliability of blockchain technology. A key motivation in our study stems from the batch nature of blockchain transactions and their public transparency, both of which render blockchain transactions more susceptible to front-running attacks, such as sandwich attacks, thus increasing the instability of the transaction pool status. Against this background, we developed this tool based on in-depth study of decentralized exchanges, such as Uniswap, and their vulnerability to front-running attacks.
To deepen readers` understanding of blockchain transactions, we first reviewed and introduced concepts related to decentralized finance, decentralized exchanges, and front-running attacks. Through this approach, we hope that readers will gain a basic and comprehensive understanding of these concepts. We then described the design philosophy and implementation methods of our tool, including its overall architecture, framework design, and system process design. To validate the effectiveness of our tool, we used a sandwich arbitrage bot to simulate and test it. This mainly involved monitoring changes in private blockchain network transaction pools and imitating Uniswap transactions by users to examine whether they would be attacked during the simulation period. Through this approach, we demonstrated that the snapshot status of transactions by our tool can be used for simulation, thereby enhancing the safety of blockchain transactions. It is important to emphasize that the focus of our study is not the arbitrage bot itself, but the demonstration of the snapshot and simulation capabilities of the tool.
In the conclusion, we summarized the significant findings of our study. By developing a new tool specifically designed for blockchain transaction pools, we provide solid technical support for related research. The advent of this tool allows us to have a deeper understanding of the nature of blockchain transactions, improve the operational efficiency of blockchain technology, combat front-running attacks, and better protect user rights. Even though we have currently only developed a Minimum Viable Product (MVP), we are confident that with the further refinement and development of this tool, and with the continuous advancement of other related research, it will play an even more crucial role in future blockchain research, further propelling the innovation and progress of blockchain technology.
參考文獻 1. Bai, T., Hu, Y., He, J., Fan, H., & An, Z. (2022). Health-zkIDM: A Healthcare Identity System Based on Fabric Blockchain and Zero-Knowledge Proof. Sensors, 22(20), 7716.
2. Bautista, J. R., Usman, M., Harrell, D. T., Meyer, E. T., & Khurshid, A. (2022). Clinical, Organizational and Regulatory, and Ethical and Social (CORES) Issues and Recommendations on Blockchain Deployment for Healthcare: Evidence from Experts. Blockchain in Healthcare Today, 5.
3. Daian, P., Goldfeder, S., Kell, T., Li, Y., Zhao, X., Bentov, I., ... & Juels, A. (2019). Flash boys 2.0: Frontrunning, transaction reordering, and consensus instability in decentralized exchanges. arXiv preprint arXiv:1904.05234.
4. Gudgeon, L., Werner, S., Perez, D., & Knottenbelt, W. J. (2020, October). Defi protocols for loanable funds: Interest rates, liquidity and market efficiency. In Proceedings of the 2nd ACM Conference on Advances in Financial Technologies (pp. 92-112).
5. Jensen, J. R., von Wachter, V., & Ross, O. (2021). An introduction to decentralized finance (defi). Complex Systems Informatics and Modeling Quarterly, (26), 46-54.
6. Koroļkovs, N., & Kodors, S. (2022). UNISWAP-A CASE STUDY OF DECENTRALIZED EXCHANGES ON THE BLOCKCHAIN. In HUMAN. ENVIRONMENT. TECHNOLOGIES. Proceedings of the Students International Scientific and Practical Conference (No. 26, pp. 25-30).
7. Lo, Y. C., & Medda, F. (2021). Uniswap and the Emergence of the Decentralized Exchange. Journal of Financial Market Infrastructures, 10(2), 1-25.
8. Manoj, T., Makkithaya, K., & Narendra, V. (2022). A blockchain based decentralized identifiers for entity authentication in electronic health records. Cogent Eng, 9(1), 2035134.
9. Metelski, D., & Sobieraj, J. (2022). Decentralized Finance (DeFi) Projects: A Study of Key Performance Indicators in Terms of DeFi Protocols’ Valuations. International Journal of Financial Studies, 10(4), 108.
10. Qin, K., Zhou, L., Afonin, Y., Lazzaretti, L., & Gervais, A. (2021). CeFi vs. DeFi--Comparing Centralized to Decentralized Finance. arXiv preprint arXiv:2106.08157.
11. Razzaq, A., Mohsan, S. A. H., Ghayyur, S. A. K., Al-Kahtani, N., Alkahtani, H. K., & Mostafa, S. M. (2022, December). Blockchain in Healthcare: A Decentralized Platform for Digital Health Passport of COVID-19 Based on Vaccination and Immunity Certificates. In Healthcare (Vol. 10, No. 12, p. 2453). MDPI.
12. Ren, F., Cai, M. L., Li, S. P., Xiong, X., & Chen, Z. H. (2022). A Multi-market Comparison of the Intraday Lead–Lag Relations Among Stock Index-Based Spot, Futures and Options. Computational Economics, 1-28.
13. Wang, Y., Zuest, P., Yao, Y., Lu, Z., & Wattenhofer, R. (2022, April). Impact and User Perception of Sandwich Attacks in the DeFi Ecosystem. In Proceedings of the 2022 CHI Conference on Human Factors in Computing Systems (pp. 1-15).
14. Zhou, L., Qin, K., Torres, C. F., Le, D. V., & Gervais, A. (2021, May). High-frequency trading on decentralized on-chain exchanges. In 2021 IEEE Symposium on Security and Privacy (SP) (pp. 428-445). IEEE.
描述 碩士
國立政治大學
資訊管理學系
110356046
資料來源 http://thesis.lib.nccu.edu.tw/record/#G0110356046
資料類型 thesis
dc.contributor.advisor 陳恭zh_TW
dc.contributor.advisor Chen, Kungen_US
dc.contributor.author (Authors) 林祐丞zh_TW
dc.contributor.author (Authors) Lin, Yu-Chengen_US
dc.creator (作者) 林祐丞zh_TW
dc.creator (作者) Lin, Yu-Chengen_US
dc.date (日期) 2023en_US
dc.date.accessioned 2-Aug-2023 14:06:22 (UTC+8)-
dc.date.available 2-Aug-2023 14:06:22 (UTC+8)-
dc.date.issued (上傳時間) 2-Aug-2023 14:06:22 (UTC+8)-
dc.identifier (Other Identifiers) G0110356046en_US
dc.identifier.uri (URI) http://nccur.lib.nccu.edu.tw/handle/140.119/146579-
dc.description (描述) 碩士zh_TW
dc.description (描述) 國立政治大學zh_TW
dc.description (描述) 資訊管理學系zh_TW
dc.description (描述) 110356046zh_TW
dc.description.abstract (摘要) 在區塊鏈技術的普及和去中心化金融(DeFi)的崛起的背景下,區塊鏈交易的安全性、透明度和效率成為人們普遍關注的重要議題。對此,我們的研究專注於開發一款新型的工具,這款工具的目標是對區塊鏈交易池狀態進行全面的快照記錄和模擬,以加深對區塊鏈交易打包順序以及競價攻擊的理解,並進一步提高區塊鏈技術的效率和可靠性。在我們的研究中,一個主要的動機源於區塊鏈交易的批次性質以及其公開透明的特徵,這兩種特性都使得區塊鏈交易更容易受到競價攻擊,如三明治攻擊,進而導致交易池狀態的不穩定性增加。基於這樣的背景,我們在深入研究去中心化交易所,例如Uniswap的運作模式和競價攻擊問題的基礎上,開發出了這款工具。
為了讓讀者對區塊鏈交易有更深入的理解,本研究首先對去中心化金融、去中心化交易所以及價格攻擊等相關概念進行了詳細的回顧與介紹。透過這種方式,我們期望讀者能夠對這些概念有一個基本且全面的理解。然後,我們介紹了我們工具的設計理念和實現方式,其中包括工具的整體架構、框架設計和系統流程設計。為了驗證工具的實際運作效果,我們利用一個已編寫完成的三明治套利機器人來模擬和測試,主要是透過偵測私有區塊鏈網路交易池的變動並模仿用戶的Uniswap交易來檢驗模擬期間是否會受到攻擊。通過這種方式,我們證明了工具快照的交易狀態可用於模擬,進而增進區塊鏈交易的安全性。而我們的研究重點並非在於套利機器人本身,而是在於證明工具取得的快照和模擬能力。
在結論部分,我們對本研究的重要發現進行了總結。透過開發一款專為區塊鏈交易池設計的全新工具,我們為相關研究提供了堅實的技術支援。這款工具的出現,能使我們對區塊鏈交易的本質有更深的理解,提高區塊鏈技術的運作效率,對抗競價攻擊,同時更好地保護使用者的權益。儘管我們目前只開發出了最小可行性產品(Minimum Viable Product,MVP),但我們深信,隨著這款工具的進一步完善和發展,以及其他相關研究的持續推進,對於擴大其功能與應用範疇,這款工具在未來的區塊鏈研究中將扮演更重要的角色,從而推進區塊鏈技術的創新與進步。
zh_TW
dc.description.abstract (摘要) With the popularity of blockchain technology and the rise of decentralized finance (DeFi), the safety, transparency, and efficiency of blockchain transactions have become major topics of concern. To address these issues, our study focuses on the development of a novel tool that aims to snapshot and simulate the state of blockchain transaction pools comprehensively. The goal is to deepen the understanding of blockchain transaction sequencing and front-running attacks, and further improve the efficiency and reliability of blockchain technology. A key motivation in our study stems from the batch nature of blockchain transactions and their public transparency, both of which render blockchain transactions more susceptible to front-running attacks, such as sandwich attacks, thus increasing the instability of the transaction pool status. Against this background, we developed this tool based on in-depth study of decentralized exchanges, such as Uniswap, and their vulnerability to front-running attacks.
To deepen readers` understanding of blockchain transactions, we first reviewed and introduced concepts related to decentralized finance, decentralized exchanges, and front-running attacks. Through this approach, we hope that readers will gain a basic and comprehensive understanding of these concepts. We then described the design philosophy and implementation methods of our tool, including its overall architecture, framework design, and system process design. To validate the effectiveness of our tool, we used a sandwich arbitrage bot to simulate and test it. This mainly involved monitoring changes in private blockchain network transaction pools and imitating Uniswap transactions by users to examine whether they would be attacked during the simulation period. Through this approach, we demonstrated that the snapshot status of transactions by our tool can be used for simulation, thereby enhancing the safety of blockchain transactions. It is important to emphasize that the focus of our study is not the arbitrage bot itself, but the demonstration of the snapshot and simulation capabilities of the tool.
In the conclusion, we summarized the significant findings of our study. By developing a new tool specifically designed for blockchain transaction pools, we provide solid technical support for related research. The advent of this tool allows us to have a deeper understanding of the nature of blockchain transactions, improve the operational efficiency of blockchain technology, combat front-running attacks, and better protect user rights. Even though we have currently only developed a Minimum Viable Product (MVP), we are confident that with the further refinement and development of this tool, and with the continuous advancement of other related research, it will play an even more crucial role in future blockchain research, further propelling the innovation and progress of blockchain technology.
en_US
dc.description.tableofcontents 致謝 i
摘要 ii
Abstract iii
目次 v
圖次 vi
表次 vii
第一章 緒論 1
1.1 研究背景 1
1.2 研究動機 2
1.3 研究目的 2
1.4 論文結構 3
第二章 技術背景及文獻回顧 5
2.1去中心化金融(Decentralized Finance) 5
2.2 去中心化交易所(Decentralized Exchange) 9
2.3 去中心化交易所的價格攻擊 – 三明治攻擊 11
第三章 工具設計與架構 14
3.1 工具設計理念 14
3.2 工具架構概觀 14
3.3 框架設計與介紹 15
3.4 系統流程設計 16
第四章 工具驗證與可應用性分析 24
4.1 工具驗證 24
4.2 三明治套利機器人介紹與分析 26
4.3 工具的可應用性探討 31
第五章 結論與未來研究方向 38
5.1 工具總結 38
5.2 貢獻與限制 38
5.3未來研究方向 39
參考文獻 41
附錄 43
zh_TW
dc.format.extent 1434050 bytes-
dc.format.mimetype application/pdf-
dc.source.uri (資料來源) http://thesis.lib.nccu.edu.tw/record/#G0110356046en_US
dc.subject (關鍵詞) 去中心化金融zh_TW
dc.subject (關鍵詞) Uniswapzh_TW
dc.subject (關鍵詞) 三明治攻擊zh_TW
dc.subject (關鍵詞) 區塊鏈交易池zh_TW
dc.subject (關鍵詞) Decentralized Financeen_US
dc.subject (關鍵詞) Uniswapen_US
dc.subject (關鍵詞) Sandwich Attacken_US
dc.subject (關鍵詞) Transaction Mempoolen_US
dc.title (題名) 實作區塊鏈交易池狀態快照與模擬工具:以 Uniswap 為例zh_TW
dc.title (題名) A Snapshot and Simulation Tool for Ethereum Transaction Pool: Uniswap as an exampleen_US
dc.type (資料類型) thesisen_US
dc.relation.reference (參考文獻) 1. Bai, T., Hu, Y., He, J., Fan, H., & An, Z. (2022). Health-zkIDM: A Healthcare Identity System Based on Fabric Blockchain and Zero-Knowledge Proof. Sensors, 22(20), 7716.
2. Bautista, J. R., Usman, M., Harrell, D. T., Meyer, E. T., & Khurshid, A. (2022). Clinical, Organizational and Regulatory, and Ethical and Social (CORES) Issues and Recommendations on Blockchain Deployment for Healthcare: Evidence from Experts. Blockchain in Healthcare Today, 5.
3. Daian, P., Goldfeder, S., Kell, T., Li, Y., Zhao, X., Bentov, I., ... & Juels, A. (2019). Flash boys 2.0: Frontrunning, transaction reordering, and consensus instability in decentralized exchanges. arXiv preprint arXiv:1904.05234.
4. Gudgeon, L., Werner, S., Perez, D., & Knottenbelt, W. J. (2020, October). Defi protocols for loanable funds: Interest rates, liquidity and market efficiency. In Proceedings of the 2nd ACM Conference on Advances in Financial Technologies (pp. 92-112).
5. Jensen, J. R., von Wachter, V., & Ross, O. (2021). An introduction to decentralized finance (defi). Complex Systems Informatics and Modeling Quarterly, (26), 46-54.
6. Koroļkovs, N., & Kodors, S. (2022). UNISWAP-A CASE STUDY OF DECENTRALIZED EXCHANGES ON THE BLOCKCHAIN. In HUMAN. ENVIRONMENT. TECHNOLOGIES. Proceedings of the Students International Scientific and Practical Conference (No. 26, pp. 25-30).
7. Lo, Y. C., & Medda, F. (2021). Uniswap and the Emergence of the Decentralized Exchange. Journal of Financial Market Infrastructures, 10(2), 1-25.
8. Manoj, T., Makkithaya, K., & Narendra, V. (2022). A blockchain based decentralized identifiers for entity authentication in electronic health records. Cogent Eng, 9(1), 2035134.
9. Metelski, D., & Sobieraj, J. (2022). Decentralized Finance (DeFi) Projects: A Study of Key Performance Indicators in Terms of DeFi Protocols’ Valuations. International Journal of Financial Studies, 10(4), 108.
10. Qin, K., Zhou, L., Afonin, Y., Lazzaretti, L., & Gervais, A. (2021). CeFi vs. DeFi--Comparing Centralized to Decentralized Finance. arXiv preprint arXiv:2106.08157.
11. Razzaq, A., Mohsan, S. A. H., Ghayyur, S. A. K., Al-Kahtani, N., Alkahtani, H. K., & Mostafa, S. M. (2022, December). Blockchain in Healthcare: A Decentralized Platform for Digital Health Passport of COVID-19 Based on Vaccination and Immunity Certificates. In Healthcare (Vol. 10, No. 12, p. 2453). MDPI.
12. Ren, F., Cai, M. L., Li, S. P., Xiong, X., & Chen, Z. H. (2022). A Multi-market Comparison of the Intraday Lead–Lag Relations Among Stock Index-Based Spot, Futures and Options. Computational Economics, 1-28.
13. Wang, Y., Zuest, P., Yao, Y., Lu, Z., & Wattenhofer, R. (2022, April). Impact and User Perception of Sandwich Attacks in the DeFi Ecosystem. In Proceedings of the 2022 CHI Conference on Human Factors in Computing Systems (pp. 1-15).
14. Zhou, L., Qin, K., Torres, C. F., Le, D. V., & Gervais, A. (2021, May). High-frequency trading on decentralized on-chain exchanges. In 2021 IEEE Symposium on Security and Privacy (SP) (pp. 428-445). IEEE.
zh_TW