Miner Module

class flexpoolapi.miner

The API’s Miner Module bindings.

Introduction

The API is wrapped into class for better interfacing. First you need to initialize your miner class by calling miner = flexpoolapi.miner(<ADDRESS>), and then you would be able to access the API.

>>> miner = flexpoolapi.miner("0xa598f8fB0a44eF74357815e318dC1C48719Fc3AD")
>>> effective, reported = miner.current_hashrate()
>>> effective
532256937
>>> reported
497730709

Note

If the given address hasn’t mined and doesn’t exist in our database, the flexpoolapi.exceptions.MinerDoesNotExist exception would be risen.

Statistics

miner.balance()
  • Delegates to /miner/<ADDRESS>/balance API Method

Returns miner’s unpaid balance in weis (minimal ETH unit)

>>> flexpoolapi.miner("0xa598f8fB0a44eF74357815e318dC1C48719Fc3AD").balance()
575311819007598793  # 0.57 ETH
miner.current_hashrate()
  • Delegates to /miner/<ADDRESS>/current API Method

Returns miner’s current hashrate in H/s (hashes per second).

>>> effective, reported = flexpoolapi.miner("0xa598f8fB0a44eF74357815e318dC1C48719Fc3AD").current_hashrate()
>>> effective
532256937
>>> reported
497730709
miner.daily_average_stats()
  • Delegates to /miner/<ADDRESS>/daily API Method

Returns miner’s daily average hashrate and the amount of shares submitted during the day.

>>> stats = flexpoolapi.miner("0xa598f8fB0a44eF74357815e318dC1C48719Fc3AD").daily_average_stats()
<flexpoolapi.shared.DailyAverageStats object 486.3 MH/s>
>>> stats.effective_hashrate
486282826.8471824
>>> stats.reported_hashrate
497730709.1734889
>>> stats.valid_shares
10503
>>> stats.stale_shares
58
>> stats.invalid_shares
0

References:

miner.stats()
  • Delegates to /miner/<ADDRESS>/stats API Method

Returns miner’s current and daily average hashrate, and the amount of shares submitted during the day.

>>> stats = flexpoolapi.miner("0xa598f8fB0a44eF74357815e318dC1C48719Fc3AD").stats()
<flexpoolapi.shared.Stats object 486.3 MH/s>
>>> stats.current_effective_hashrate
486282826.8471824
>>> stats.average_effective_hashrate
466831513.7732951
>>> stats.current_reported_hashrate
517639937.54042846
>>> stats.average_reported_hashrate
497730709.1734889
>>> stats.valid_shares
10503
>>> stats.stale_shares
58
>> stats.invalid_shares
0

References:

miner.block_count()
  • Delegates to /miner/<ADDRESS>/blockCount API Method

Returns the count of blocks mined by miner.

>>> flexpoolapi.miner("0xa598f8fB0a44eF74357815e318dC1C48719Fc3AD").block_count()
2
miner.details()
  • Delegates to /miner/<ADDRESS>/details API Method

Returns the miner details.

>>> details = flexpoolapi.miner("0xa598f8fB0a44eF74357815e318dC1C48719Fc3AD").details()
<flexpoolapi.miner.MinerDetails object (0xa598f8fB0a44eF74357815e318dC1C48719Fc3AD)>
>>> details.min_payout_threshold
200000000000000000  # 0.2 ETH
>>> details.pool_donation
0.02
>>> details.first_joined_date
datetime.datetime(2020, 4, 30, 20, 50)
>>> details.censored_email
'mai*@exa****.com'
>>> details.censored_ip
'*.*.*.1'

References:

miner.total_paid()
  • Delegates to /miner/<ADDRESS>/totalPaid API Method

Returns the value of weis paid to the miner.

>>> flexpoolapi.miner("0xa598f8fB0a44eF74357815e318dC1C48719Fc3AD").total_paid()
719802600880251629
miner.total_donated()
  • Delegates to /miner/<ADDRESS>/totalDonated API Method

Returns the value of weis donated by miner. (<3)

>>> flexpoolapi.miner("0xa598f8fB0a44eF74357815e318dC1C48719Fc3AD").total_paid()
35990130044012584
miner.estimated_daily_revenue()
  • Delegates to /miner/<ADDRESS>/estimatedDailyRevenue API Method

Returns miner’s approximate daily profit (in weis).

>>> flexpoolapi.miner("0xAB1a87C524b5B302954a3ceE2685445C38b6B916").estimated_daily_revenue()
128129842556298557
miner.round_share()
  • Delegates to /miner/<ADDRESS>/roundShare API Method

Returns miner’s round share (%).

>>> flexpoolapi.miner("0x25bC7A927ff4a2C4243752e0C577c6aFB740c291").round_share()
0.024  # 0.024%

Payments

miner.payment_count()
  • Delegates to /miner/<ADDRESS>/paymentCount API Method

Returns the amount of payments done.

>>> stats = flexpoolapi.miner("0xa598f8fB0a44eF74357815e318dC1C48719Fc3AD").payment_count()
47
miner.payments_paged(page: int)
  • Delegates to /miner/<ADDRESS>/payments API method

Returns paged response wrapped into PagedResponse class (descending order, latest first).

Hint

There are 10 payments per one page.

>>> payments_page_0 = flexpoolapi.miner("0xa598f8fB0a44eF74357815e318dC1C48719Fc3AD").payments_paged(page=0)
<flexpoolapi.shared.PageResponse object [<flexpoolapi.miner.Transaction object  1.61075 ETH (2020 Jun 06 14:12)>, <flexpoolapi.miner.Transaction object  1.38525 ETH (2020 May 30 00:20)>, ...]>
>>> blocks_page_0.contents
[<flexpoolapi.miner.Transaction object  1.61075 ETH (2020 Jun 06 14:12)>, <flexpoolapi.miner.Transaction object  1.38525 ETH (2020 May 30 00:20)>, ...]
blocks_page_0.total_items
47
>>> blocks_page_0.total_pages
5
>> blocks_page_0.items_per_page
10

References:

Blocks

miner.blocks_paged(page: int)
  • Delegates to /miner/<ADDRESS>/blocks API method

Returns paged response wrapped into PagedResponse class (descending order, latest first).

Hint

There are 10 blocks per one page

>>> payments_page_0 = flexpoolapi.miner("0xa598f8fB0a44eF74357815e318dC1C48719Fc3AD").blocks_paged(page=0)
<flexpoolapi.shared.PageResponse object [<flexpoolapi.shared.Block object Uncle #10156606 (0x262bb…1134d)>, <flexpoolapi.shared.Block object Block #9994360 (0x1251a…6dad9)>, ...]>
>>> blocks_page_0.contents
[<flexpoolapi.shared.Block object Uncle #10156606 (0x262bb…1134d)>, <flexpoolapi.shared.Block object Block #9994360 (0x1251a…6dad9)>]]
blocks_page_0.total_items
2
>>> blocks_page_0.total_pages
1
>> blocks_page_0.items_per_page
10

References:

Other

miner.chart()
  • Delegates to /miner/<ADDRESS>/chart API Method

Returns history of miner hashrate and shares wrapped into flexpoolapi.shared.StatChartItem classes.

Example

[
   <flexpoolapi.shared.StatChartItem (T)>,
   <flexpoolapi.shared.StatChartItem (T - 10m)>,
   <flexpoolapi.shared.StatChartItem (T - 20m)>,
   <flexpoolapi.shared.StatChartItem (T - 30m)>,
   ...
]
>>> chart = flexpoolapi.miner("0xa598f8fB0a44eF74357815e318dC1C48719Fc3AD").chart()
[<flexpoolapi.shared.StatChartItem object (2020 Jun 17 12:40)>, <flexpoolapi.shared.StatChartItem object (2020 Jun 17 12:30)>, ...]

>>> chart[0]
<flexpoolapi.shared.StatChartItem object (2020 Jun 17 12:40)>
>>> hashrate_chart[0].effective
497730709
>>> hashrate_chart[0].reported
532256937
>>> hashrate_chart[0].valid_shares
72
>>> hashrate_chart[0].stale_shares
1
>>> hashrate_chart[0].invalid_shares
0

References: