bitcoin-data / mining-pools

Known Bitcoin mining pool coinbase tags and coinbase output addresses. Generated files: https://github.com/bitcoin-data/mining-pools/tree/generated
MIT License
18 stars 12 forks source link

Use integers as pool IDs #76

Closed 0xB10C closed 1 year ago

0xB10C commented 1 year ago

See https://github.com/0xB10C/known-mining-pools/pull/75#issuecomment-1363169075. This also adds a basic check to the CI that there are no duplicate IDs and that the data has the expected format.

I used this script to change the IDs to integers:

#!/usr/bin/env python3

import json
import glob
import sys

entity_files = glob.glob("pools/*.json")

pool_id = 1

for file_path in entity_files:
    with open(file_path, "r") as f:
        e = json.load(f)

        content = {
            "id": pool_id,
            "name": e["name"],
            "addresses": sorted(e["addresses"]),
            "tags": sorted(e["tags"]),
            "link": e["link"],
        }

        with open(file_path, "w") as out:
            json.dump(content, out, indent=2, ensure_ascii=False)
            out.write('\n')
    pool_id+=1
0xB10C commented 1 year ago

@nymkappa let me know if that's what you had in mind!

nymkappa commented 1 year ago

I would avoid using 0 as ID but aside this I'm good with it.

That's how I hardcoded it for my dev purpose as you can see here https://github.com/nymkappa/known-mining-pools/blob/2022-12-generate-mempool-space-data/generated/pool-list.json

0xB10C commented 1 year ago

Starting pool id's at 1 instead of 0. Thanks!