一.Web3py的一些使用的例子:
1.查询区块:
···
通过number查找
web3.eth.getBlock(12345)
通过address查找
web3.eth.getBlock('0x767c2bfb3bdee3f78676c1285cd757bcd5d8c272cef2eb30d9733800a78c0b6d')
2.得到最近的区块:
web3.eth.getBlock('latest')
获得最近区块的number
web3.eth.blockNumber
3.查询交易信息:
···
web3.eth.getTransaction('0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060')
···
4.查询收据
···
web3.eth.getTransactionReceipt('0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060')
二.web3py还提供几个详细模块的api,具体可上文档查询。
1.Web3.eth :http://web3py.readthedocs.io/en/latest/web3.eth.html
2.Web3.shh :http://web3py.readthedocs.io/en/latest/web3.shh.html
3.Web3.personal :http://web3py.readthedocs.io/en/latest/web3.personal.html
4.Web3.version :http://web3py.readthedocs.io/en/latest/web3.version.html
5.Web3.txpool :http://web3py.readthedocs.io/en/latest/web3.txpool.html
6.Web3.miner :http://web3py.readthedocs.io/en/latest/web3.miner.html
7.Web3.admin :http://web3py.readthedocs.io/en/latest/web3.admin.html