GithubHelp home page GithubHelp logo

mempool / mining-pools Goto Github PK

View Code? Open in Web Editor NEW

This project forked from btccom/blockchain-known-pools

17.0 3.0 24.0 397 KB

Bitcoin Mining Pools Coinbase Tags

Home Page: https://mempool.space/mining/pools

License: MIT License

Shell 100.00%

mining-pools's Introduction

Bitcoin Mining Pools

Mining pools definition used on https://mempool.space/mining/pools

Contributing

Contributions welcome. All changes must be applied in pools-v2.json file.

Adding a new mining pool

Regardless of the choosen method, we recommend adding a appropriate slug to each new mining pool you add to pools-v2.json. The slug will be used as a unique tag for the mining pool, for example in the public facing urls like https://mempool.space/mining/pool/foundryusa (here foundryusa is the slug).

You can specify mining pool slugs in the slugs object in pools-v2.json. If you don't specify one, we will automatically generate one as such.

if (slug === undefined) {
  // Only keep alphanumerical
  slug = poolNames[i].replace(/[^a-z0-9]/gi, '').toLowerCase();
  logger.warn(`No slug found for '${poolNames[i]}', generating it => '${slug}'`);
}

Add a new mining pool by coinbase_tags

You can add a new mining pool by specifying the coinbase tag they're using in the coinbase transaction.

To add a new pool, you must add a new JSON object in the coinbase_tags object. Note that you can add multiple tags for the same mining pool, but you must use the exact same values for name and link in each new entry. For example:

"Foundry USA Pool" : {
  "name" : "Foundry USA",
  "link" : "https://foundrydigital.com/"
},
"Foundry USA Pool another tag" : {
  "name" : "Foundry USA",
  "link" : "https://foundrydigital.com/"
},

Each coinbase tag will be use as a regex to match blocks with their mining pool. This is how we use it in mempool application. You can see the code here.

const regexes: string[] = JSON.parse(pools[i].regexes);
for (let y = 0; y < regexes.length; ++y) {
  const regex = new RegExp(regexes[y], 'i');
  const match = asciiScriptSig.match(regex);
  if (match !== null) {
    return pools[i];
  }
}

Add a new mining pool by payout_addresses

You can add a new mining pool by specifying the receiving address they're using in the coinbase transaction to receive the miner reward.

To add a new pool, you must add a new JSON object in the payout_addresses object. Note that you can add multiple addresses for the same mining pool, but you must use the exact same values for name and link in each new entry. For example:

"1FFxkVijzvUPUeHgkFjBk2Qw8j3wQY2cDw" : {
    "name" : "Foundry USA",
    "link" : "https://foundrydigital.com/"
},
"12KKDt4Mj7N5UAkQMN7LtPZMayenXHa8KL" : {
    "name" : "Foundry USA",
    "link" : "https://foundrydigital.com/"
},

Each address will be use to match blocks with their mining pool by matching the coinbase transaction output address. This is how we use it in mempool application. You can see the code here.

const address = txMinerInfo.vout[0].scriptpubkey_address;
for (let i = 0; i < pools.length; ++i) {
  if (address !== undefined) {
    const addresses: string[] = JSON.parse(pools[i].addresses);
    if (addresses.indexOf(address) !== -1) {
      return pools[i];
    }
  }

Change an existing mining pool metadata

You can also change an existing mining pool's name, link and slug. In order to do so properly, you must update all existing entry in the pools-v2.json file.

For example, if you'd like to rename Foundry USA to Foundry Pool, you must replace all occurences of the old string with the new one in pools-v2.json file, with no exception, otherwise you'll end with two mining pools. The samme idea applies if you want to change the link or the slug.

For example, to rename Foundry USA to Foundry Pool you'd need to update the following (using today's pools-v2.json as reference):

// Original
"Foundry USA Pool" : {
    "name" : "Foundry USA",
    "link" : "https://foundrydigital.com/"
},
  "/2cDw/" : {
    "name" : "Foundry USA",
    "link" : "https://foundrydigital.com/"
},
// Renamed
"Foundry USA Pool" : {
    "name" : "Foundry Pool",
    "link" : "https://foundrydigital.com/"
},
  "/2cDw/" : {
    "name" : "Foundry Pool",
    "link" : "https://foundrydigital.com/"
},
// Original
"1FFxkVijzvUPUeHgkFjBk2Qw8j3wQY2cDw" : {
    "name" : "Foundry USA",
    "link" : "https://foundrydigital.com/"
},
"12KKDt4Mj7N5UAkQMN7LtPZMayenXHa8KL" : {
    "name" : "Foundry USA",
    "link" : "https://foundrydigital.com/"
},
// Renamed
"1FFxkVijzvUPUeHgkFjBk2Qw8j3wQY2cDw" : {
    "name" : "Foundry Pool",
    "link" : "https://foundrydigital.com/"
},
"12KKDt4Mj7N5UAkQMN7LtPZMayenXHa8KL" : {
    "name" : "Foundry Pool",
    "link" : "https://foundrydigital.com/"
},
// Original
"Foundry USA": "foundryusa",
// Renamed - Be aware, this will also change the mining pool page link from
mempool.space/mining/pool/foundryusa to mempool.space/mining/pool/foundrypool
"Foundry Pool": "foundrypool",

Block re-indexing

When a mining pool's coinbase tag or addresses is updated in pools.jon, mempool can automatically re-index the appropriate blocks in order to re-assign them to the correct mining pool. "Appropriate" blocks here concern all blocks which are not yet assigned to a mining pool (unknown pool), from block 130635 (first known mining pool block) as well as all blocks from the update mining pool. You can find the re-indexing logic here

You can enable/disable this behavior using by setting the following backend configuration variable:

{
  "MEMPOOL": {
    "AUTOMATIC_BLOCK_REINDEXING": false
  }
}

If you set it to false, no re-indexing will happen automatically, but this also means that you will need to delete blocks manually from your database. Upon restarting your backend, missing indexed blocks are always be re-indexed using the latest mining pool data.

Mining pool definition

When the mempool backend starts, we automatically fetch the latest pools-v2.json version from github. By default the url points to https://github.com/mempool/mining-pools/blob/master/pools-v2.json but you can configure it to points to another repo by setting the following backend variables:

{
  "MEMPOOL": {
    'POOLS_JSON_URL': 'https://raw.githubusercontent.com/mempool/mining-pools/master/pools-v2.json',
    'POOLS_JSON_TREE_URL': 'https://api.github.com/repos/mempool/mining-pools/git/trees/master'
  }
}

mining-pools's People

Contributors

aknirmal90 avatar bitkevin avatar daizisheng avatar dcexploration avatar debugfuture avatar dubuqingfeng avatar ganibc avatar hyperwang avatar jameshilliard avatar jaybeddict1 avatar jiangjinyuan avatar knorrium avatar liceaga avatar liuyangovo avatar mononaut avatar natsoni avatar nymkappa avatar peiyuyang avatar simonohanlon101 avatar slimgotomoon avatar softsimon avatar spicalab avatar tuzzolo avatar ucwong avatar wangchun avatar winlin avatar wiz avatar wozz avatar zaidos avatar zowki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mining-pools's Issues

Combine efforts with 0xB10C/known-mining-pools

I've been maintaining a similar repository, 0xB10C/known-mining-pools. I think it would make sense to merge these two repositories at some point.

I opted for a more maintainable structure than having a large pools.json file for the tags and addresses. I'm using a JSON file per pool where a pool can have multiple tags and addresses. This is makes it much less cluttered and greatly reduces the error surface of having e.g. duplicates with slightly different names. See, for example, mara-pool.json.

{
  "name": "MARA Pool",
  "addresses": [
    "3D72db1KMCnj7FL7MBsmxTw81z2bVu4UN5",
    "3LC8dDKyBsrWPfzhXyt7aAyjXxGYkfDdHu",
    "15MdAHnkxt9TMC2Rj595hsg8Hnv693pPBB"
  ],
  "tags": [
    "MARA Pool"
  ],
  "links": [
    "https://marathondh.com/"
  ]
}

Automatically generating a pool.json file, as is used by many projects (mempool.space, miningpool.observer, forkmonitor.info, rust-bitcoin-pool-identification, ...), is done with this script. I've also set up quite a bit of automated CI for quality assurance.

I've seen that the mempool project added a slugs and I think adding this in the per-pool JSON file should be easy. As well as generating a pools.json file with the slugs as mempool.space expects them.

Let me know what you think. Also happy to move the combined repo to e.g. the @bitcoin-data organization.

Label blocks found by FutureBit devices

Got a request from jstefanop of FutureBit to label blocks found by FutureBit's Apollo devices.

The devices mine solo. They put out between 2 and 9 TH/s depending on the device and settings but supposedly there are >100,000 of these things out there.

See example of coinbase tag here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.