[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mining Dashboard (Phase 1): Backend support for block and pool data #1047

Closed
softsimon opened this issue Dec 27, 2021 · 3 comments
Closed

Mining Dashboard (Phase 1): Backend support for block and pool data #1047

softsimon opened this issue Dec 27, 2021 · 3 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@softsimon
Copy link
Member
softsimon commented Dec 27, 2021

Needed new database tables

  1. Create a new table for block data in the database with the following fields:
    Block height
    Block size
    Block weight
    Tx count
    Fees
    Coinbase raw
    Fee-span (Array)
    Median fee
    Difficulty
    Pool identification ID (connected to a separate pools with pool id+name)

  2. Create a new pools table that automatically stores the individual unique mining pools

Blocks and mining pool APIs

  1. Latest blocks and load more blocks API similar to current /api/blocks/ API
  2. API for block mining info /api/v1/block/:height/pool
  3. Include mining pool info in WebSocket blocks info
  4. Mining pool icons API
@softsimon
Copy link
Member Author

Here is a start


  private static currentVersion = 2;



if (version < 2) {
      queries.push(`DROP TABLE IF EXISTS blocks;`);

      queries.push(`CREATE TABLE blocks (
        height int(11) unsigned NOT NULL,
        hash varchar(65) NOT NULL,
        size int(11) unsigned NOT NULL,
        weight int(11) unsigned NOT NULL,
        timestamp int(11) unsigned NOT NULL,
        fee_span text NOT NULL,
        tx_count int(11) unsigned NOT NULL,
        fees double unsigned NOT NULL,
        median_fee double unsigned NOT NULL,
        difficulty bigint(20) unsigned NOT NULL,
        coinbase varchar(255) NOT NULL,
        pool_id int(11) NOT NULL,
        PRIMARY KEY (height),
        INDEX (pool_id)
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8;`);

      queries.push(`CREATE TABLE pools (
        id int(11) NOT NULL AUTO_INCREMENT,
        name varchar(50) NOT NULL,
        url varchar(255) NOT NULL,
        PRIMARY KEY (id)
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8;`);
    }

@nymkappa
Copy link
Member
nymkappa commented Jan 3, 2022

coinbase varchar(255) NOT NULL

Should not this be a text instead? If you want to store the raw coinbase tx a varchar(255) won't be able to accommodate that.

Example using Bitcoin Core RPC:

getrawtransaction 00010a775ece696068afc40c062fac32a41ad679945b9891563893eb6542fc5a
0200000000010296111e9c776aa347301762d744a43ec5f2573a70275c6662f2b0ecab45fbaa08000000001716001409721ee97c9a7d2d800e3672e9134a4e8163dbeefeffffff9c2a53f9eb66422626eeeea93355937713ca824e469509790a6f2a71c84beefb0000000017160014aead0ad2f29cc0cdf7211ea6b8aa4f23b444b22efeffffff02994a0f000000000017a91485bd11faa1f03b0b3bce69b9ac69e870ac94b1a387f04f01000000000017a9140ba28e560a5d811b3dcec538f57fb2d720baf1d8870247304402202ad263a30af92b5903aeac9da5195b69d0a54b22bde4f662bda0c40613005484022011a7000daf9541102d270a414a6ed6d5a45b8e7870c0e8a8905da72a3e95d8a601210336751d2f362cff01b222cf04340e9b2df03b6afc2e6b9370ed3d70c911a316250247304402202a6fe4bbf368fae1c5b2c474bc0f7453e4001ef484cd7fcd5a1f784d66f031eb02204c70a1dd877b5ee80d2dc4f0c77fb4a4e839fd4f8951b7370f39ca1393e764f1012103ab93017177a5790a78cd44b922b6740eb4b2a7b6facc362f15bcccd489c2d25b96700900

@softsimon
Copy link
Member Author

Closed in
#1162
#1235
#1233

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants