---
title: "Python 開發者的以太坊"
description: "了解如何使用基於 Python 的專案與工具在以太坊上進行開發"
lang: zh-tw
incomplete: true
---

<FeaturedText>了解如何使用基於 Python 的專案與工具在以太坊上進行開發</FeaturedText>

使用以太坊建立去中心化應用程式 (dapp)，利用加密貨幣與區塊鏈技術的優勢。這些 dapp 是值得信賴的，這意味著一旦它們被部署到以太坊，就會始終按照程式設計的方式運行。它們可以控制數位資產，以建立新型態的金融應用程式。它們可以是去中心化的，這意味著沒有單一實體或個人控制它們，且幾乎不可能被審查。

## 開始使用智能合約與 Solidity 語言 {#getting-started-with-smart-contracts-and-solidity}

**邁出將 Python 與以太坊整合的第一步**

需要先了解更基礎的入門知識嗎？請查看 [ethereum.org/learn](/learn/) 或 [ethereum.org/developers](/developers/)。

- [區塊鏈解釋](https://kauri.io/article/d55684513211466da7f8cc03987607d5/blockchain-explained)
- [了解智能合約](https://kauri.io/article/e4f66c6079e74a4a9b532148d3158188/ethereum-101-part-5-the-smart-contract)
- [撰寫你的第一個智能合約](https://kauri.io/article/124b7db1d0cf4f47b414f8b13c9d66e2/remix-ide-your-first-smart-contract)
- [了解如何編譯與部署 Solidity](https://kauri.io/article/973c5f54c4434bb1b0160cff8c695369/understanding-smart-contract-compilation-and-deployment)
- [2023 年區塊鏈中的 Python 狀態報告](https://tradingstrategy.ai/blog/the-state-of-python-in-blockchain-in-2023)

## 初學者文章 {#beginner-articles}

- [Web3.py 概覽](https://web3py.readthedocs.io/en/latest/overview.html)
- [以太坊 Python 生態系導覽](https://snakecharmers.ethereum.org/python-ecosystem/)
- [給 (Python) 開發者的以太坊指南](https://snakecharmers.ethereum.org/a-developers-guide-to-ethereum-pt-1/)
- [值得獲獎：以太坊 Python 黑客松指南](https://snakecharmers.ethereum.org/prize-worthy/)
- [使用 Vyper 的智能合約簡介](https://kauri.io/#collections/Getting%20Started/an-introduction-to-smart-contracts-with-vyper/)
- [如何使用 Python Flask 開發以太坊合約？](https://medium.com/coinmonks/how-to-develop-ethereum-contract-using-python-flask-9758fe65976e)
- [Web3.py 簡介 · Python 開發者的以太坊](https://www.dappuniversity.com/articles/web3-py-intro)
- [如何使用 Python 與 Web3.py 呼叫智能合約函式](https://stackoverflow.com/questions/57580702/how-to-call-a-smart-contract-function-using-python-and-web3-py)

## 中階文章 {#intermediate-articles}

- [Web3.py 之友：Ape 簡介](https://snakecharmers.ethereum.org/intro-to-ape/)
- [給 Python 程式設計師的 dapp 開發](https://www.youtube.com/watch?v=tE-8bG35VNw)
- [建立 Python 以太坊介面：第 1 部分](https://hackernoon.com/creating-a-python-ethereum-interface-part-1-4d2e47ea0f4d)
- [Python 中的以太坊智能合約：(算得上) 全面的指南](https://hackernoon.com/ethereum-smart-contracts-in-python-a-comprehensive-ish-guide-771b03990988)

## 進階使用模式 {#advanced-use-patterns}

- [Web3.py 模式：即時事件訂閱](https://snakecharmers.ethereum.org/subscriptions/)
- [Web3.py 模式：WebSocketProvider](https://snakecharmers.ethereum.org/websocketprovider/)
- [使用 Python 編譯、部署與呼叫以太坊智能合約](https://yohanes.gultom.id/2018/11/28/compiling-deploying-and-calling-ethereum-smartcontract-using-python/)
- [使用斯立瑟分析 Solidity 智能合約](https://kauri.io/#collections/DevOps/analyze-solidity-smart-contracts-with-slither/#analyze-solidity-smart-contracts-with-slither)
- [區塊鏈金融科技教學：使用 Python 進行借貸與借款](https://blog.chain.link/blockchain-fintech-defi-tutorial-lending-borrowing-python/)

## 封存文章 {#archived-articles}

- [使用 Python 與 Brownie 部署你自己的 ERC-20 代幣](https://betterprogramming.pub/python-blockchain-token-deployment-tutorial-create-an-erc20-77a5fd2e1a58)
- [使用 Brownie 與 Python 部署智能合約](https://dev.to/patrickalphac/using-brownie-for-to-deploy-smart-contracts-1kkp)
- [使用 Brownie 在 OpenSea 上建立 NFT](https://www.freecodecamp.org/news/how-to-make-an-nft-and-render-on-opensea-marketplace/)

## Python 專案與工具 {#python-projects-and-tools}

- [Web3.py](https://github.com/ethereum/web3.py) - _用於與以太坊互動的 Python 函式庫_
- [Vyper](https://github.com/ethereum/vyper/) - _適用於 EVM 的 Python 風格智能合約語言_
- [Titanoboa](https://github.com/vyperlang/titanoboa/) - _Vyper 的原生測試工具；一個具備主網分叉、除錯與美觀追蹤回溯 (tracebacks) 功能的直譯器_
- [Moccasin](https://github.com/Cyfrin/moccasin) - _基於 Titanoboa 建構，適用於 Vyper 與 Python 的智能合約開發與測試框架_
- [Ape](https://github.com/ApeWorX/ape) - _專為 Python 開發者、資料科學家與安全專家打造的智能合約開發工具_
- [py-evm](https://github.com/ethereum/py-evm) - _以太坊虛擬機的實作_
- [eth-tester](https://github.com/ethereum/eth-tester) - _用於測試基於以太坊之應用程式的工具_
- [eth-utils](https://github.com/ethereum/eth-utils/) - _用於處理以太坊相關程式碼庫的公用函式_
- [py-solc-x](https://pypi.org/project/py-solc-x/) - _支援 0.5.x 版本的 solc Solidity 編譯器 Python 包裝器_
- [pymaker](https://github.com/makerdao/pymaker) - _用於 Maker 合約的 Python API_
- [siwe](https://github.com/signinwithethereum/siwe-py) - _適用於 Python 的以太坊登入 (SIWE)_
- [Web3 DeFi for Ethereum integrations](https://github.com/tradingstrategy-ai/web3-ethereum-defi) - _一個包含 ERC-20、尤尼斯瓦普與其他熱門專案現成整合的 Python 套件_
- [Wake](https://getwake.io) - _用於合約測試、模糊測試、部署、漏洞掃描與程式碼導覽的多合一 Python 框架 (語言伺服器 - [Tools for Solidity](https://marketplace.visualstudio.com/items?itemName=AckeeBlockchain.tools-for-solidity))_
- [DeFiPy](https://github.com/defipy-devs/defipy) - _用於去中心化金融 (DeFi) 分析以及跨尤尼斯瓦普 V2/V3、Balancer 與 Curve 進行自動做市商 (AMM) 模擬的 Python SDK_
### 封存 / 不再維護： {#archived--no-longer-maintained}

- [Trinity](https://github.com/ethereum/trinity) - _以太坊 Python 客戶端_
- [Mamba](https://github.com/arjunaskykok/mamba) - _用於撰寫、編譯與部署以 Vyper 語言撰寫之智能合約的框架_
- [Brownie](https://github.com/eth-brownie/brownie) - _用於部署、測試與互動以太坊智能合約的 Python 框架_
- [pydevp2p](https://github.com/ethereum/pydevp2p) - _以太坊 P2P 堆疊的實作_
- [py-wasm](https://github.com/ethereum/py-wasm) - _WebAssembly 直譯器的 Python 實作_

正在尋找更多資源嗎？請查看 [ethereum.org/developers](/developers/)。

## 使用 Python 工具的專案 {#projects-using-python-tooling}

以下基於以太坊的專案使用了本頁面提及的工具。相關的開源儲存庫可作為範例程式碼與最佳實務的良好參考。

- [Yearn Finance](https://yearn.finance/) 與 [Yearn 金庫合約儲存庫](https://github.com/yearn/yearn-vaults)
- [Curve](https://www.curve.finance/) 與 [Curve 智能合約儲存庫](https://github.com/curvefi/curve-contract)
- [BadgerDAO](https://badger.com/) 與 [使用 Brownie 工具鏈的智能合約](https://github.com/Badger-Finance/badger-system)
- [Sushi](https://sushi.com/) 使用 [Python 來管理與部署他們的歸屬合約](https://github.com/sushiswap/sushi-vesting-protocols)
- [Alpha Finance](https://alphaventuredao.io/) (以 Alpha Homora 聞名) 使用 [Brownie 來測試與部署智能合約](https://github.com/AlphaFinanceLab/alpha-staking-contract)

## Python 社群討論 {#python-community-contributors}

- [以太坊 Python 社群 Discord](https://discord.gg/9zk7snTfWe)，用於 Web3.py 與其他 Python 框架討論
- [Vyper Discord](https://discord.gg/SdvKC79cJk)，用於 Vyper 智能合約程式設計討論

## 其他彙整清單 {#other-aggregated-lists}

Vyper wiki 有一份[極佳的 Vyper 資源清單](https://github.com/vyperlang/vyper/wiki/Vyper-tools-and-resources)
