Home | 簡體中文 | 繁體中文 | 雜文 | 知乎專欄 | Github | OSChina 博客 | 雲社區 | 雲棲社區 | Facebook | Linkedin | 視頻教程 | 打賞(Donations) | About
知乎專欄多維度架構 | 微信號 netkiller-ebook | QQ群:128659835 請註明“讀者”

第 18 章 web3.py - A python interface for interacting with the Ethereum blockchain and ecosystem.

目錄

18.1. 安裝 web3.py 開發環境
18.1.1. CentOS
18.1.2. MAC OS
18.2. 連接到以太坊節點
18.2.1. HTTP
18.2.2. IPC
18.2.3. Websocket
18.3. 交易
18.3.1. 發送 ETH
18.3.2. 簽名發送 ETH
18.4. ERC20 代幣合約
18.4.1. 簽名發送ERC20代幣

文檔地址 http://web3py.readthedocs.io/

18.1. 安裝 web3.py 開發環境

18.1.1. CentOS

			
[root@iZj6c39y62jl5b1wmfv6u8Z ~]# yum install python34-pip

[root@iZj6c39y62jl5b1wmfv6u8Z ~]# pip3 install --upgrade pip
Collecting pip
  Downloading http://mirrors.aliyun.com/pypi/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 68.9MB/s 
Installing collected packages: pip
  Found existing installation: pip 8.1.2
    Uninstalling pip-8.1.2:
      Successfully uninstalled pip-8.1.2
Successfully installed pip-10.0.1
			
			
			
python3.6 -m venv env --without-pip
source env/bin/activate
curl https://bootstrap.pypa.io/get-pip.py | python3
python3.6 -m pip install web3			
			
			

18.1.2. MAC OS

首先去 python.org 官網下載 Python 3.6.5 dmg格式,安裝後進入終端。

			
You should consider upgrading via the 'pip install --upgrade pip' command.
neo@MacBook-Pro ~/ethereum/web3.py % pip3.6 install --upgrade pip
Cache entry deserialization failed, entry ignored
Collecting pip
  Using cached https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 9.0.3
    Uninstalling pip-9.0.3:
      Successfully uninstalled pip-9.0.3
Successfully installed pip-10.0.1
			
neo@MacBook-Pro ~/ethereum/web3.py % pip3.6 install web3