Skip to content
This repository has been archived by the owner on Sep 18, 2022. It is now read-only.

Expose mempoolinfo and blockchaininfo #10

Merged
merged 10 commits into from
Apr 26, 2020

Conversation

nolim1t
Copy link
Contributor

@nolim1t nolim1t commented Apr 26, 2020

Closes #9 when done

@nolim1t nolim1t marked this pull request as draft April 26, 2020 16:32
@nolim1t
Copy link
Contributor Author

nolim1t commented Apr 26, 2020

Endpoints /info/sync (Expanded to expose extra stuff)

{
  "percent": "1.0000",
  "currentBlock": 627729,
  "headerCount": 627729,
  "difficulty": 15958652328578.42,
  "size": 311144972067
}

NEW! /info/mempool

{
  "loaded": true,
  "size": 4963,
  "bytes": 1860448,
  "usage": 7882624,
  "maxmempool": 512000000,
  "mempoolminfee": 1e-05,
  "minrelaytxfee": 1e-05
}

@nolim1t
Copy link
Contributor Author

nolim1t commented Apr 26, 2020

NEW info/stats (aka the firehouse)

{
  "blockchain_info": {
    "chain": "main",
    "blocks": 627732,
    "headers": 627732,
    "bestblockhash": "0000000000000000000dbc52d94673ab45b8271c38ec3245f82eb1a55bf10da3",
    "difficulty": 15958652328578.42,
    "mediantime": 1587917440,
    "verificationprogress": 0.9999987748965766,
    "initialblockdownload": false,
    "chainwork": "00000000000000000000000000000000000000000ee0e63b21634097f85357a4",
    "sizeOnDisk": 311149168631,
    "pruned": false,
    "softforks": {
      "bip34": {
        "type": "buried",
        "active": true,
        "height": 227931
      },
      "bip66": {
        "type": "buried",
        "active": true,
        "height": 363725
      },
      "bip65": {
        "type": "buried",
        "active": true,
        "height": 388381
      },
      "csv": {
        "type": "buried",
        "active": true,
        "height": 419328
      },
      "segwit": {
        "type": "buried",
        "active": true,
        "height": 481824
      }
    },
    "warnings": ""
  },
  "network_info": {
    "version": 190100,
    "subversion": "/Satoshi:0.19.1/",
    "protocolversion": 70015,
    "localservices": "0000000000000409",
    "localservicesnames": [
      "NETWORK",
      "WITNESS",
      "NETWORK_LIMITED"
    ],
    "localrelay": true,
    "timeoffset": -2,
    "networkactive": true,
    "connections": 10,
    "networks": [
      {
        "name": "ipv4",
        "limited": false,
        "reachable": true,
        "proxy": "",
        "proxyRandomizeCredentials": false
      },
      {
        "name": "ipv6",
        "limited": false,
        "reachable": true,
        "proxy": "",
        "proxyRandomizeCredentials": false
      },
      {
        "name": "onion",
        "limited": false,
        "reachable": true,
        "proxy": "127.0.0.1:9150",
        "proxyRandomizeCredentials": true
      }
    ],
    "relayfee": 1e-05,
    "incrementalfee": 1e-05,
    "localaddresses": [
      {
        "address": "3svpjvkmpftz2gny.onion",
        "port": 8333,
        "score": 7
      }
    ],
    "warnings": ""
  },
  "mempool": {
    "loaded": true,
    "size": 728,
    "bytes": 250136,
    "usage": 1135312,
    "maxmempool": 512000000,
    "mempoolminfee": 1e-05,
    "minrelaytxfee": 1e-05
  }
}

@nolim1t nolim1t marked this pull request as ready for review April 26, 2020 17:01
@nolim1t
Copy link
Contributor Author

nolim1t commented Apr 26, 2020

Please test @mayankchhabra

@mayankchhabra
Copy link
Member

nice, I think you missed the hashrate

@mayankchhabra
Copy link
Member

I also suggest removing all the other unrequired info from the stats endpoint because it can increase the request's response time, especially when the polling happens on tor

@nolim1t
Copy link
Contributor Author

nolim1t commented Apr 26, 2020

nice, I think you missed the hashrate

hashrate is difficulty

@mayankchhabra
Copy link
Member

we need the network hashes per second...
image

@nolim1t
Copy link
Contributor Author

nolim1t commented Apr 26, 2020

How is

{
  "blocks": 627734,
  "difficulty": 15958652328578.42,
  "size": 311151022856,
  "mempool": {
    "loaded": true,
    "size": 3889,
    "bytes": 1536424,
    "usage": 6171792,
    "maxmempool": 512000000,
    "mempoolminfee": 1e-05,
    "minrelaytxfee": 1e-05
  },
  "connections": 11
}

for mempool

@mayankchhabra
Copy link
Member

mayankchhabra commented Apr 26, 2020

sure but we still don't need a lot of it... just

{
    peers: <number of connected peers>
    mempool: <size of amempool in bytes>
    hashrate: <network hashes per second>
    blockchainSize: <the estimated size of the block and undo files on disk>
}

would be fine

@nolim1t
Copy link
Contributor Author

nolim1t commented Apr 26, 2020

Not sure what is what in mempool to be honest.

@nolim1t
Copy link
Contributor Author

nolim1t commented Apr 26, 2020

we need the network hashes per second...
image

That might be challenging to get.. its not the same command and the library this is using is also unmaintained

@nolim1t
Copy link
Contributor Author

nolim1t commented Apr 26, 2020

found the function

@nolim1t
Copy link
Contributor Author

nolim1t commented Apr 26, 2020

However the hashes per second is not being returned from the library

@nolim1t
Copy link
Contributor Author

nolim1t commented Apr 26, 2020

so it might be a new function, added after they stopped maintaining

@nolim1t
Copy link
Contributor Author

nolim1t commented Apr 26, 2020

{
  "blocks": 627735,
  "difficulty": 15958652328578.42,
  "size": 311152526222,
  "mempool": {
    "loaded": true,
    "size": 4884,
    "bytes": 2023641,
    "usage": 7947472,
    "maxmempool": 512000000,
    "mempoolminfee": 1e-05,
    "minrelaytxfee": 1e-05
  },
  "connections": 10,
  "hashespersec": 109983984577136800000
}

However may require modifying upstream code which the last time it looks updated was June 2019

@nolim1t
Copy link
Contributor Author

nolim1t commented Apr 26, 2020

I can try to send a pull request (bitpay/bitcoind-rpc#54) but I doubt anyone is maintaining it

@mayankchhabra
Copy link
Member

ah I see, does it have bitcoin-cli getmininginfo? network hash ps is also returned in the mining info

@nolim1t
Copy link
Contributor Author

nolim1t commented Apr 26, 2020

From mining info

{
  "blocks": 627736,
  "difficulty": 15958652328578.42,
  "size": 311153957575,
  "mempool": {
    "loaded": true,
    "size": 4857,
    "bytes": 2377743,
    "usage": 8890432,
    "maxmempool": 512000000,
    "mempoolminfee": 1e-05,
    "minrelaytxfee": 1e-05
  },
  "connections": 10,
  "networkhashps": 109005941033200500000
}

@mayankchhabra
Copy link
Member

Testing now

@mayankchhabra mayankchhabra merged commit db41e5d into getumbrel:master Apr 26, 2020
@mayankchhabra
Copy link
Member

Tested and merged! Great job as always @nolim1t

@nolim1t nolim1t deleted the mempool-and-blockchaininfo branch April 27, 2020 04:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bitcoin Stats Endpoint
2 participants