Web3py简单使用方法(三)

一.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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容