Skip to main content

Atlas: Mining Pool Dominance

For much of its history, the Bitcoin mining industry has been notoriously opaque. Luckily, it has become a common practice for many BTC mining pools to leave a subtle "miner signature" in each block's coinbase transaction (not to be confused with the popular crypto exchange by the same name). This transaction contains the miner reward— currently 6.25 BTC per block—but also leaves some extra space for arbitrary data, allowing the pool to publicly assert their claim. Using ATLAS v2, we're able to extract this miner signature, enabling us to derive a variety of mining pool metrics.

Resources​

This notebook demonstrates basic functionality offered by the Coin Metrics Python API Client and ATLAS blockchain search engine.

Coin Metrics offers a vast assortment of data for hundreds of cryptoassets. The Python API Client allows for easy access to this data using Python without needing to create your own wrappers using requests and other such libraries.

To understand the data that Coin Metrics offers, feel free to peruse the resources below.

File Download​

Download the entire notebook as either a jupyter notebook to run yourself or as a pdf from the two links below

Download ATLAS_miner_signatures.pdf

PDF Version of notebook for easy offline viewing

Download ATLAS_miner_signatures.ipynb

Jupyter notebook to run code locally

Notebook Setup​

from os import environ
import sys
import pandas as pd
import numpy as np
import logging
from datetime import date, datetime, timedelta
from coinmetrics.api_client import CoinMetricsClient
import json
import logging
import matplotlib.dates as mdates
import matplotlib.pyplot as plt
import matplotlib.ticker as mtick
from matplotlib.ticker import FormatStrFormatter, FuncFormatter
from matplotlib import font_manager
import cmasher as cmr
import re
# %matplotlib inline
import plotly
from plotly.subplots import make_subplots
logging.basicConfig(
format='%(asctime)s %(levelname)-8s %(message)s',
level=logging.INFO,
datefmt='%Y-%m-%d %H:%M:%S'
)
# We recommend privately storing your API key in your local environment.
try:
api_key = environ["CM_API_KEY"]
logging.info("Using API key found in environment")
except KeyError:
api_key = ""
logging.info("API key not found. Using community client")

client = CoinMetricsClient(api_key)
2024-10-04 13:46:00 INFO Using API key found in environment
colors = np.unique(cmr.take_cmap_colors('Set3', 15, return_fmt='hex'))
colors
array(['#80B1D3', '#8DD3C7', '#B3DE69', '#BC80BD', '#BEBADA', '#CCEBC5',
'#D9D9D9', '#FB8072', '#FCCDE5', '#FDB462', '#FFED6F', '#FFFFB3'],
dtype='<U7')

ATLAS V2​

Retrieve Block Info​

block_info = client.get_list_of_blocks_v2(
asset='btc',
start_time=datetime.now()-timedelta(days=365),
page_size=10000
).parallel(time_increment=timedelta(days=1)).to_dataframe()
block_info['extra_data'] = block_info['extra_data'].astype(str)
Exporting to dataframe type: 100%|██████████| 366/366 [00:06<00:00, 58.56it/s]
block_info.head()
block_hashheightconsensus_timeminer_timen_transactionsn_balance_updatesparent_block_hashnonceextra_dataversiondifficultyphysical_sizeconsensus_sizeconsensus_size_limit
000000000000000000003cd8c9919b1073bab32cee67bfb...8107612023-10-05 13:54:00+00:002023-10-05 15:21:03+00:0036582266800000000000000000002667c723b1a1f559ed920504ab6...3789b28703095f0c1b4d696e656420627920416e74506f6f6c3830...54525952057321508229258.039062154371339933964000000
1000000000000000000000d070d5b4fb5c69ee6bae4bab6...8107622023-10-05 14:04:54+00:002023-10-05 15:26:11+00:0026891873200000000000000000003cd8c9919b1073bab32cee67bfb...388afcd5030a5f0c45022f62696e616e63652f323139fabe6d6d6d...53699379257321508229258.039062149485639935474000000
200000000000000000004090783eb83951d6d9c91dd88f3...8107632023-10-05 14:28:43+00:002023-10-05 15:33:08+00:00252817306000000000000000000000d070d5b4fb5c69ee6bae4bab6...9b7ba148030b5f0c192f5669614254432f4d696e6564206279207a...53692825657321508229258.039062142261339933224000000
300000000000000000004cd165ee9f93e68460c37173027...8107642023-10-05 14:36:46+00:002023-10-05 15:40:56+00:0032272033500000000000000000004090783eb83951d6d9c91dd88f3...003804fb030c5f0c194d696e656420627920416e74506f6f6c20f8...80529817657321508229258.039062157275539932784000000
400000000000000000000fb654d8199a1fc240af3bbc173...8107652023-10-05 14:57:48+00:002023-10-05 15:50:03+00:0030781935200000000000000000004cd165ee9f93e68460c37173027...903b489a030d5f0c2cfabe6d6d0d426074ccdd9e3b0fe208ab9af1...53896806457321508229258.039062151572639976984000000
# Assign 'empty' to rows where n_transactions == 1
block_info.loc[block_info['n_transactions'] == 1, 'category'] = 'Empty'

# Assign 'not empty' to remaining rows
block_info.loc[block_info['n_transactions'] != 1, 'category'] = 'Not Empty'
block_info['extra_data'][0]
'03095f0c1b4d696e656420627920416e74506f6f6c383036f800c8022ace0b75fabe6d6d7a90b864b377b7d7de125f87ab7890c46a47d58edcd9d602a6758485a2d7a7c2020000000000000026bb0000d455000000000000'
def convert_to_human_readable_ascii(s):
# Check if the input string is a valid hexadecimal string
if all(c in '0123456789abcdefABCDEF' for c in s):
# Convert the input string to bytes
b = bytes.fromhex(s)
# Decode the bytes using the ISO-8859-1 encoding
result = b.decode('ISO-8859-1')
return result
else:
# Return an error message if the input string is not a valid hexadecimal string
return 'Error: input is not a valid hexadecimal string'
block_info['miner_tag'] = block_info['extra_data'].apply(convert_to_human_readable_ascii)
block_signed = pd.DataFrame(block_info[['miner_tag','height','consensus_time','category']])
block_signed
miner_tagheightconsensus_timecategory
0\t_ Mined by AntPool806ø�È*Î uú¾mmz¸d³w·×Þ...8107612023-10-05 13:54:00+00:00Not Empty
1\n_ E/binance/219ú¾mmm¡¾¼a04Vy>‚IC°˜Jgò ¡Ð0...8107622023-10-05 14:04:54+00:00Not Empty
2 _ /ViaBTC/Mined by z180203/,ú¾mmžñÊ1ä¾Ú!³K...8107632023-10-05 14:28:43+00:00Not Empty
3 _ Mined by AntPool ø�¢1ê%-ú¾mm»âHjéZ¾®¨!M...8107642023-10-05 14:36:46+00:00Not Empty
4\r_ ,ú¾mm\rB`tÌݞ;⫚ñ\tÆ¢èür¹³a\rmá\rÚ...8107652023-10-05 14:57:48+00:00Not Empty
...............
53385’/\r< OCEAN.XYZ >3OD�ã.ˆ–³Lð\n������8641462024-10-04 15:50:04+00:00Not Empty
53386“/\r,ú¾mm‘…÷$@oȗ$~œ¸ÑÆn‘¹Ô3 ñîõ䈑 ¼‘���...8641472024-10-04 15:51:50+00:00Not Empty
53387”/\rc�g/Foundry USA Pool #dropgold/+J�½­�...8641482024-10-04 15:56:39+00:00Not Empty
53388•/\rMined by AntPool èA”x®øú¾mm6úœq2i’F...8641492024-10-04 15:56:44+00:00Not Empty
53389–/\rMined by AntPool �ž„µóú¾mm¹ýŒ½kØ]Œ"...8641502024-10-04 16:22:20+00:00Not Empty

53390 rows × 4 columns

# List of strings included in coinbase signature
miners = ['AntPool', 'ViaBTC', 'binance', 'Binance', 'Foundry', 'Luxor',
'SlushPool', 'slush', 'BTC.com','BTC.COM','btc.com','btccom',
'bitdeer','btcpool', 'F2Pool', 'poolin','xxxxxx.com','CKPool',
'BTC.TOP', 'BTCC', 'MARA Pool', 'Mara Pool', 'SpiderPool']
def detect_keywords(df, column, keywords):
# Create a new column called 'miner'
df['miner'] = None
# Iterate over the miner names
for miner in miners:
# Use the update method to detect the miner name in the specified column
# df['miner'].update(df[column].str.extract(rf'({miner})', expand=False))
df.update({'miner':df[column].str.extract(rf'({miner})', expand=False)})
# Replace any rows where the 'miner' column is None with 'Unknown'
df['miner'] = df['miner'].replace({None: 'Other'})
return df
miners_tagged = detect_keywords(block_signed, 'miner_tag', miners)
miners_tagged = miners_tagged.set_index('consensus_time')
miners_tagged
miner_tagheightcategoryminer
consensus_time
2023-10-05 13:54:00+00:00\t_ Mined by AntPool806ø�È*Î uú¾mmz¸d³w·×Þ...810761Not EmptyAntPool
2023-10-05 14:04:54+00:00\n_ E/binance/219ú¾mmm¡¾¼a04Vy>‚IC°˜Jgò ¡Ð0...810762Not Emptybinance
2023-10-05 14:28:43+00:00 _ /ViaBTC/Mined by z180203/,ú¾mmžñÊ1ä¾Ú!³K...810763Not EmptyViaBTC
2023-10-05 14:36:46+00:00 _ Mined by AntPool ø�¢1ê%-ú¾mm»âHjéZ¾®¨!M...810764Not EmptyAntPool
2023-10-05 14:57:48+00:00\r_ ,ú¾mm\rB`tÌݞ;⫚ñ\tÆ¢èür¹³a\rmá\rÚ...810765Not EmptyF2Pool
...............
2024-10-04 15:50:04+00:00’/\r< OCEAN.XYZ >3OD�ã.ˆ–³Lð\n������864146Not EmptyOther
2024-10-04 15:51:50+00:00“/\r,ú¾mm‘…÷$@oȗ$~œ¸ÑÆn‘¹Ô3 ñîõ䈑 ¼‘���...864147Not EmptyF2Pool
2024-10-04 15:56:39+00:00”/\rc�g/Foundry USA Pool #dropgold/+J�½­�...864148Not EmptyFoundry
2024-10-04 15:56:44+00:00•/\rMined by AntPool èA”x®øú¾mm6úœq2i’F...864149Not EmptyAntPool
2024-10-04 16:22:20+00:00–/\rMined by AntPool �ž„µóú¾mm¹ýŒ½kØ]Œ"...864150Not EmptyAntPool

53390 rows × 4 columns

def transform_index_to_date(index):
datetime_index = pd.to_datetime(index)
date_index = [datetime.date(datetime_obj) for datetime_obj in datetime_index]
return date_index
date_index = transform_index_to_date(miners_tagged.index)
miners_tagged.index = pd.to_datetime(date_index)
miners_tagged
miner_tagheightcategoryminer
2023-10-05\t_ Mined by AntPool806ø�È*Î uú¾mmz¸d³w·×Þ...810761Not EmptyAntPool
2023-10-05\n_ E/binance/219ú¾mmm¡¾¼a04Vy>‚IC°˜Jgò ¡Ð0...810762Not Emptybinance
2023-10-05 _ /ViaBTC/Mined by z180203/,ú¾mmžñÊ1ä¾Ú!³K...810763Not EmptyViaBTC
2023-10-05 _ Mined by AntPool ø�¢1ê%-ú¾mm»âHjéZ¾®¨!M...810764Not EmptyAntPool
2023-10-05\r_ ,ú¾mm\rB`tÌݞ;⫚ñ\tÆ¢èür¹³a\rmá\rÚ...810765Not EmptyF2Pool
...............
2024-10-04’/\r< OCEAN.XYZ >3OD�ã.ˆ–³Lð\n������864146Not EmptyOther
2024-10-04“/\r,ú¾mm‘…÷$@oȗ$~œ¸ÑÆn‘¹Ô3 ñîõ䈑 ¼‘���...864147Not EmptyF2Pool
2024-10-04”/\rc�g/Foundry USA Pool #dropgold/+J�½­�...864148Not EmptyFoundry
2024-10-04•/\rMined by AntPool èA”x®øú¾mm6úœq2i’F...864149Not EmptyAntPool
2024-10-04–/\rMined by AntPool �ž„µóú¾mm¹ýŒ½kØ]Œ"...864150Not EmptyAntPool

53390 rows × 4 columns

other_miners = miners_tagged.loc[miners_tagged['miner'] == 'Other']
other_miners
miner_tagheightcategoryminer
2023-10-05 _ F°,ñ¿����/NiceHash/810784Not EmptyOther
2023-10-06¬_ /ultimus/783p�?�DòuÄú¾mm(0„³4yï@×ì7HWlù»...810924Not EmptyOther
2023-10-06Ë_  \t\t\t \t\t \t_‡‰[����810955Not EmptyOther
2023-10-06Ö_ /ultimus/787p�\ÏD­ú¾mmàÀ.,±r}?^º¿ŸrE¨æ...810966Not EmptyOther
2023-10-07` w !e/SBICrypto.com Pool/ø³bS�����811027Not EmptyOther
...............
2024-10-03/\rMined by SecPool›�)Õ Ÿ­ú¾mmÑÀ”)Ñgò2e...864005Not EmptyOther
2024-10-03/\rMined by SecPool›�9ÕuRíú¾mm(5L,±kÏä½...864006Not EmptyOther
2024-10-04C/\r \t\t\t \t\t \tÉ��„\n���864067Not EmptyOther
2024-10-04l/\rdÏÿf/SBICrypto.com Pool/\r$²v������864108Not EmptyOther
2024-10-04’/\r< OCEAN.XYZ >3OD�ã.ˆ–³Lð\n������864146Not EmptyOther

3060 rows × 4 columns

miners_tagged['miner'] = miners_tagged['miner'].replace('xxxxxx.com', 'Poolin')
miners_tagged['miner'] = miners_tagged['miner'].replace('poolin', 'Poolin')
miners_tagged['miner'] = miners_tagged['miner'].replace('btccom', 'BTC.com')
miners_tagged['miner'] = miners_tagged['miner'].replace('btc.com', 'BTC.com')
miners_tagged['miner'] = miners_tagged['miner'].replace('btcpool', 'BTC.com')
miners_tagged['miner'] = miners_tagged['miner'].replace('bitdeer', 'BTC.com')
miners_tagged['miner'] = miners_tagged['miner'].replace('slush', 'Braiins Pool')
miners_tagged['miner'] = miners_tagged['miner'].replace('binance', 'Binance Pool')
miners_tagged['miner'] = miners_tagged['miner'].replace('Binance', 'Binance Pool')
miners_tagged['miner'] = miners_tagged['miner'].replace('Mara Pool', 'MARA Pool')
# Group the data by the date and calculate the relative proportions of each category
data = miners_tagged.groupby(miners_tagged.index.date)['miner'].value_counts(normalize=True)
data = data.unstack()

averages = data.sum()
averages = pd.DataFrame(averages.sort_values(ascending=False))
averages = averages.index.tolist()
data = data[averages]
data
minerFoundryAntPoolViaBTCF2PoolOtherBinance PoolMARA PoolLuxorSpiderPoolBraiins PoolBTC.comPoolin
2023-10-050.1785710.3035710.1607140.1607140.0178570.1250000.0178570.035714NaNNaNNaNNaN
2023-10-060.2375000.2562500.1125000.1437500.0187500.0812500.0625000.043750NaN0.0062500.0125000.025000
2023-10-070.2631580.2807020.0877190.1228070.0467840.0467840.0409360.035088NaN0.0116960.0467840.017544
2023-10-080.3108110.2500000.1216220.1081080.0337840.0675680.0270270.027027NaN0.0337840.0135140.006757
2023-10-090.2692310.2500000.1153850.1153850.0384620.1089740.0384620.019231NaN0.0128210.0192310.012821
.......................................
2024-09-300.3576640.2554740.0656930.1313870.0583940.0218980.0218980.0072990.0583940.007299NaN0.014599
2024-10-010.3248410.3057320.1337580.0955410.0573250.0127390.0191080.0191080.0063690.025478NaNNaN
2024-10-020.2709680.2193550.1741940.0838710.0645160.0322580.0645160.0258060.0322580.0129030.0129030.006452
2024-10-030.2341770.3164560.1012660.1075950.0822780.0379750.0379750.0126580.0316460.0253160.012658NaN
2024-10-040.3000000.2818180.1818180.0545450.0272730.0272730.0090910.0363640.0181820.0454550.018182NaN

366 rows × 12 columns

# Plot the data as an area chart
ax = data.plot.area(figsize=(8, 6),fontsize=13.5,color=colors)
ax.xaxis.set_major_formatter(mdates.DateFormatter('%b'))
ax.set_title('\nBitcoin Mining Pool \nDominance (2023 - 2024)\n',fontsize=22,fontdict={'font':'arial'})
ax.axhline(0.5, linestyle='--', color='black')
plt.xlim([miners_tagged.index[0],miners_tagged.index[-1]])
plt.ylim(0,1)
plt.yticks([0.2, 0.4, 0.6, 0.8, 1.0], ['20%','40%','60%','80%','100%'],fontdict={'font':'arial','size':15})
plt.legend(bbox_to_anchor=(1,1),frameon=False)
plt.annotate('Source: Coin Metrics ATLAS',weight='book',font='arial',xy=(1.001, 0.001), xycoords='axes fraction',color='black',xytext=(-8, 6), textcoords='offset pixels',horizontalalignment='right',verticalalignment='bottom')
plt.savefig('./Pool-Dominance.png',facecolor='white',dpi=100)
plt.show()
total_blocks = pd.DataFrame(miners_tagged.index.value_counts())
total_blocks.rename(columns={total_blocks.columns[0]: 'Total Blocks'}, inplace=True)
total_blocks
Total Blocks
2024-02-02188
2024-01-25181
2024-03-07180
2024-07-22179
2024-02-12179
......
2024-01-15114
2024-06-23112
2024-10-04110
2024-09-11108
2023-10-0556

366 rows × 1 columns

empty_blocks = miners_tagged.groupby([miners_tagged.index.date,miners_tagged.miner])['category'].value_counts()
empty_blocks = empty_blocks.unstack()
empty_blocks = pd.DataFrame(empty_blocks.reset_index()).fillna(0).set_index('level_0')
empty_blocks
categoryminerEmptyNot Empty
level_0
2023-10-05AntPool0.017.0
2023-10-05Binance Pool0.07.0
2023-10-05F2Pool1.08.0
2023-10-05Foundry0.010.0
2023-10-05Luxor0.02.0
............
2024-10-04Luxor0.04.0
2024-10-04MARA Pool0.01.0
2024-10-04Other0.03.0
2024-10-04SpiderPool0.02.0
2024-10-04ViaBTC0.020.0

4004 rows × 3 columns

df_pivot = empty_blocks.pivot_table(index=empty_blocks.index, columns="miner", values="Empty")
df_pivot = df_pivot.join(total_blocks[['Total Blocks']])
df_pivot = df_pivot.fillna(0)
df_pivot
AntPoolBTC.comBinance PoolBraiins PoolF2PoolFoundryLuxorMARA PoolOtherPoolinSpiderPoolViaBTCTotal Blocks
level_0
2023-10-050.00.00.00.01.00.00.00.00.00.00.00.056
2023-10-060.00.00.00.00.00.00.00.00.00.00.00.0160
2023-10-070.00.00.00.00.00.00.00.00.00.00.00.0171
2023-10-080.00.00.00.00.00.00.00.00.00.00.00.0148
2023-10-091.00.00.00.00.00.00.00.00.00.00.00.0156
..........................................
2024-09-300.00.00.00.00.00.00.00.00.00.00.00.0137
2024-10-011.00.00.00.00.00.00.00.00.00.00.00.0157
2024-10-021.00.00.00.00.00.01.00.00.00.01.00.0155
2024-10-030.00.00.00.00.00.00.00.00.00.00.00.0158
2024-10-040.00.00.00.00.00.00.00.00.00.00.00.0110

366 rows × 13 columns

df_empty = df_pivot.iloc[:,0:].div(df_pivot['Total Blocks'], axis=0)
df_empty = df_empty.drop(df_empty.columns[-1:], axis=1)
df_empty = df_empty[averages]
df_empty
FoundryAntPoolViaBTCF2PoolOtherBinance PoolMARA PoolLuxorSpiderPoolBraiins PoolBTC.comPoolin
level_0
2023-10-050.00.0000000.00.0178570.00.00.00.0000000.0000000.00.00.0
2023-10-060.00.0000000.00.0000000.00.00.00.0000000.0000000.00.00.0
2023-10-070.00.0000000.00.0000000.00.00.00.0000000.0000000.00.00.0
2023-10-080.00.0000000.00.0000000.00.00.00.0000000.0000000.00.00.0
2023-10-090.00.0064100.00.0000000.00.00.00.0000000.0000000.00.00.0
.......................................
2024-09-300.00.0000000.00.0000000.00.00.00.0000000.0000000.00.00.0
2024-10-010.00.0063690.00.0000000.00.00.00.0000000.0000000.00.00.0
2024-10-020.00.0064520.00.0000000.00.00.00.0064520.0064520.00.00.0
2024-10-030.00.0000000.00.0000000.00.00.00.0000000.0000000.00.00.0
2024-10-040.00.0000000.00.0000000.00.00.00.0000000.0000000.00.00.0

366 rows × 12 columns

fig, ax = plt.subplots(figsize=(8, 6))
cumval = 0
i = 0
for col in df_empty.columns:
plt.bar(df_empty.index, df_empty[col], bottom=cumval, label=col, color=colors[i])
cumval = cumval+df_empty[col]
i += 1
ax.xaxis.set_major_locator(mdates.MonthLocator())
ax.xaxis.set_major_formatter(mdates.DateFormatter('%b'))
plt.title('\nEmpty Blocks\nTotal Percentage (2023 - 2024)\n', fontdict = {'size':18, 'font': 'arial'})
plt.xticks(rotation=0)
plt.xlabel('')
plt.legend(bbox_to_anchor=(1,1),frameon=False)
plt.yticks([0.005, 0.010, 0.015, 0.02, 0.025], ['0.5%','1.0%','1.5%','2.0%','2.5%'],fontdict={'size':14})
plt.grid(True, axis='y',linestyle='--',alpha=0.5)
plt.annotate('Source: Coin Metrics ATLAS',weight='book',font='arial',xy=(1.00, 0.953), xycoords='axes fraction',color='black',xytext=(-8, 6), textcoords='offset pixels',horizontalalignment='right',verticalalignment='bottom')
plt.savefig('./Empty-Blocks-Total-2023-2024.png',facecolor='white',dpi=100)
plt.xlabel('');
empty_blocks_total = pd.DataFrame(miners_tagged.groupby([miners_tagged.miner])['category'].value_counts(normalize=True))
empty_blocks_total = empty_blocks_total.unstack().fillna(0)
empty_blocks_total.columns = empty_blocks_total.columns.droplevel(0)
empty_blocks_total = empty_blocks_total.reindex(averages)
empty_blocks_total
categoryEmptyNot Empty
miner
Foundry0.0000001.000000
AntPool0.0058850.994115
ViaBTC0.0023950.997605
F2Pool0.0032080.996792
Other0.0035950.996405
Binance Pool0.0029930.997007
MARA Pool0.0000001.000000
Luxor0.0050000.995000
SpiderPool0.0359960.964004
Braiins Pool0.0023310.997669
BTC.com0.0040710.995929
Poolin0.0046400.995360
pool_total_blocks = pd.DataFrame(miners_tagged['miner'].value_counts())
pool_total_blocks = pool_total_blocks.drop('Other')
pool_total_blocks.rename(columns={pool_total_blocks.columns[0]: 'Total Blocks Mined'}, inplace=True)
pool_total_blocks
Total Blocks Mined
miner
Foundry15492
AntPool13595
ViaBTC6680
F2Pool5923
Binance Pool2339
MARA Pool1986
Luxor1400
SpiderPool889
Braiins Pool858
BTC.com737
Poolin431
row_num = empty_blocks_total.index.get_loc('Other')
colors_no_other = np.delete(colors, row_num)
empty_blocks_total = empty_blocks_total.drop('Other')
pool_total_blocks.reset_index()
minerTotal Blocks Mined
0Foundry15492
1AntPool13595
2ViaBTC6680
3F2Pool5923
4Binance Pool2339
5MARA Pool1986
6Luxor1400
7SpiderPool889
8Braiins Pool858
9BTC.com737
10Poolin431
ax = empty_blocks_total['Empty'].plot.bar(figsize=(8, 6),stacked=True,fontsize=12,color=colors_no_other,width=0.8,zorder=2)
def format_percent(x, pos):
return '{:.2%}'.format(x)
formatter = FuncFormatter(format_percent)
ax.yaxis.set_major_formatter(formatter)
plt.xticks(rotation=45,size=12)
plt.yticks(rotation=0,size=12)
plt.title('\nEmpty Blocks vs. Total Blocks\nby Mining Pool (Oct 2023 - Oct 2024)\n', fontdict = {'size':18, 'font': 'arial'})
plt.xlabel('');
plt.ylabel('Empty Blocks (%)',fontsize=14,labelpad=10);
plt.tick_params(axis='both', which='both', length=0, pad=8)
plt.ylim(0,0.04)
ax.grid(True, axis='y',linestyle='--',zorder=1,alpha=0.5)
ax2 = ax.twinx()
pool_total_blocks.plot.line(ax=ax2,color='black',linestyle='--',legend=True)
pool_total_blocks.reset_index().plot.scatter(x='miner',y='Total Blocks Mined',ax=ax2,color='black', s=50)
ax2.set_yticks([0,2000,4000,6000,8000,10000,12000,14000,16000])
plt.ylim(0,16000)
ax2.yaxis.set_major_formatter(mtick.StrMethodFormatter('{x:,.0f}'))
plt.legend(bbox_to_anchor=(1,1.0),frameon=False,fontsize=11.3)
plt.tick_params(axis='both', which='both', length=0, pad=8)
plt.yticks(rotation=0,size=12)
plt.ylabel('Total Blocks Mined\n',fontsize=14,labelpad=10);
plt.annotate(
'Source: Coin Metrics ATLAS',
weight='book',
font='arial',
fontsize=12,
xy=(1.0, 1.0),
xycoords='axes fraction',
color='black',
xytext=(-8, 6),
textcoords='offset pixels',
horizontalalignment='right',
verticalalignment='bottom'
)
plt.savefig('./Empty-Blocks-by-Pool.png',facecolor='white',dpi=100)