Пример #1
0
parser.add_argument("--sendto", "-s", nargs = 2, help = "Send toaddress amount in ETH. The account must be unlocked.")

parser.add_argument("-u", "--url", dest="url", default="http://localhost:8545", help="Connect to a different URL, instead of your local Ethereum daemon")

parser.add_argument("-v", "--verbose", action = "store_true")

parser.add_argument("-W", "--watts", dest="watts", type=float, help="Power usage of miners for profitability calculation")

parser.add_argument("-w", "--kwhprice", dest="kwhprice", type=float, help="kWh price for profitability calculation")

options = parser.parse_args()

daemon = Server(options.url)

info = {"hashrate": float(int(daemon.eth_hashrate(), 16)),
        "balances": map(get_balance, daemon.eth_accounts()),
        "blocks": int(daemon.eth_blockNumber(), 16),
        "difficulty": float(int(daemon.eth_getBlockByNumber("latest", False)["difficulty"], 16)),
        "peers": int(daemon.net_peerCount(), 16),
        }

info["total balance"] = sum(info["balances"])

if options.classic:
    cur = "ETC"
else:
    cur = "ETH"

if options.account_id > -1:
    aid = options.account_id
    fromaddr = daemon.eth_accounts()[aid]