用于Etheroll智能合约的Python库
项目描述
pyetheroll
用于Etheroll智能合约的Python库
用法
在掷骰子之前,简单地设置赌注大小、几率和钱包设置
from pyetheroll.etheroll import Etheroll
etheroll = Etheroll()
bet_size_ether = 0.1
bet_size_wei = int(bet_size_ether * 1e18)
chances = 50
wallet_path = 'wallet.json'
wallet_password = 'password'
transaction = etheroll.player_roll_dice(
bet_size_wei, chances, wallet_path, wallet_password)
也可以设置不同的合约地址和链ID
from pyetheroll.constants import ChainID
from pyetheroll.etheroll import Etheroll
chain_id = ChainID.ROPSTEN
contract_address = '0xe12c6dEb59f37011d2D9FdeC77A6f1A8f3B8B1e8'
etheroll = Etheroll(chain_id, contract_address)
更多信息请参阅docs/Examples.md。
API密钥
Etherscan和Infura都要求API密钥,这些密钥可以从以下环境变量中获取
ETHERSCAN_API_KEY
(由pyetheroll直接使用)WEB3_INFURA_PROJECT_ID
(由web3.py使用)
安装
pip install pyetheroll
开发分支:
pip install --process-dependency-links \
https://github.com/AndreMiras/pyetheroll/archive/develop.zip
项目详情
下载文件
下载适合您平台的文件。如果您不确定选择哪个,请了解更多关于安装软件包的信息。
源代码分发
此版本没有提供源代码分发文件。有关生成分发存档的教程。
构建分发
etheroll-20200322-py3-none-any.whl (12.3 kB 查看哈希值)
关闭
etheroll-20200322-py3-none-any.whl的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | d1ccb0dd74b970a7e0fc20f0bb66c91e089ec920ed01e11b1ca6b9550517016b |
|
MD5 | f50f73c17ca8949ac76d3c68a379fd3f |
|
BLAKE2b-256 | 936c0ce2763903f852bafbb773031fa1b7745cace89e69adf2d862ba3a7e06f5 |