Bitcoin Forum
November 11, 2024, 11:44:42 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to get the mempool size during a given block  (Read 272 times)
digital_mine (OP)
Member
**
Offline Offline

Activity: 99
Merit: 14


View Profile
July 11, 2019, 08:05:43 AM
Merited by ABCbits (1)
 #1

Hi there,

I'm playing around with python and bitcoin-cli.

I'm extracting some data from the blockchain for some data analysis, machine learning and stuff like this.

I would like to know whether is there a command to know the mempool size or tx number during a given block number.

Thanks

Foxpup
Legendary
*
Offline Offline

Activity: 4533
Merit: 3184


Vile Vixen and Miss Bitcointalk 2021-2023


View Profile
July 11, 2019, 08:47:14 AM
Merited by DooMAD (2), o_e_l_e_o (2), ABCbits (1), Coin-1 (1)
 #2

Your node's current mempool size can be obtained with the getmempoolinfo command, which returns both the number of unconfirmed transactions ("size") and the total amount of data they take up ("bytes"). Bitcoin Core does not store historical mempool info; you'll have to record it yourself by calling getmempoolinfo periodically.

Note also that there no information whatsoever about the mempool stored in the blockchain itself, partly because there is no such thing as "the" mempool; each node has its own mempool, which will vary from the mempools of other nodes depending on which unconfirmed transactions that particular node knows about. That different nodes can disagree about which transactions exist is the reason a blockchain is needed in the first place.

Will pretend to do unspeakable things (while actually eating a taco) for bitcoins: 1K6d1EviQKX3SVKjPYmJGyWBb1avbmCFM4
I am not on the scammers' paradise known as Telegram! Do not believe anyone claiming to be me off-forum without a signed message from the above address! Accept no excuses and make no exceptions!
digital_mine (OP)
Member
**
Offline Offline

Activity: 99
Merit: 14


View Profile
July 11, 2019, 08:55:04 AM
 #3

Your node's current mempool size can be obtained with the getmempoolinfo command, which returns both the number of unconfirmed transactions ("size") and the total amount of data they take up ("bytes"). Bitcoin Core does not store historical mempool info; you'll have to record it yourself by calling getmempoolinfo periodically.

Note also that there no information whatsoever about the mempool stored in the blockchain itself, partly because there is no such thing as "the" mempool; each node has its own mempool, which will vary from the mempools of other nodes depending on which unconfirmed transactions that particular node knows about. That different nodes can disagree about which transactions exist is the reason a blockchain is needed in the first place.

thx

I was afraid that there was not a way to get historical data, well too bad

digital_mine (OP)
Member
**
Offline Offline

Activity: 99
Merit: 14


View Profile
July 11, 2019, 11:42:20 AM
 #4

If you're looking for historical data, you could check https://bitcoinvisuals.com/ & https://bitcoinperf.com.
You also can check https://www.lopp.net/bitcoin-information/statistics-metrics.html for list of website which show statistics and metrics.

The only problem is i don't know if any of them have API so you can get the data from python, i'm afraid you need to DYOR.

Thx but I wanted to do with my own local client-cli without any API that will impose me limitations

now I'm running the command "getnetworkhashps" and I get numnbers like 8.651303124075628e+20 how to read it?

domob
Legendary
*
Offline Offline

Activity: 1135
Merit: 1170


View Profile WWW
July 11, 2019, 12:30:27 PM
 #5

now I'm running the command "getnetworkhashps" and I get numnbers like 8.651303124075628e+20 how to read it?

See here: https://en.wikipedia.org/wiki/Scientific_notation

This number means 8.65 * 10^20, i.e. 8 followed by 20 zeros (roughly speaking).

Use your Namecoin identity as OpenID: https://nameid.org/
Donations: 1domobKsPZ5cWk2kXssD8p8ES1qffGUCm | NMC: NCdomobcmcmVdxC5yxMitojQ4tvAtv99pY
BM-GtQnWM3vcdorfqpKXsmfHQ4rVYPG5pKS | GPG 0xA7330737
khaled0111
Legendary
*
Offline Offline

Activity: 2702
Merit: 3045


Top Crypto Casino


View Profile WWW
July 11, 2019, 01:18:29 PM
 #6

now I'm running the command "getnetworkhashps" and I get numnbers like 8.651303124075628e+20 how to read it?
8.651303124075628e+20 means 8.651303124075628 *10^20 hashes per second.
To make it easier to read convert it to tera =10^12: 855130312.4075628*10^12 around 855 million terahash persecond. I don't think this is the current hashrate though.

digital_mine (OP)
Member
**
Offline Offline

Activity: 99
Merit: 14


View Profile
July 11, 2019, 05:54:05 PM
 #7

Thx but I wanted to do with my own local client-cli without any API that will impose me limitations

No problem, AFAIK data analysis & machine learning enjoy are easier/perform better with more data, so i thought obtain past data once might be useful in your case.

Yeah, For now I'm getting all the data possible from my local client, than I'll se whether to integrate something I can't get already there like mempool size, if I'll be not happy with te results I'll get

TheWolf666
Full Member
***
Offline Offline

Activity: 615
Merit: 154


CEO of Metaisland.gg and W.O.K Corp


View Profile WWW
July 13, 2019, 12:12:54 PM
Merited by joniboini (3), ABCbits (1), digital_mine (1)
 #8

Thx but I wanted to do with my own local client-cli without any API that will impose me limitations

No problem, AFAIK data analysis & machine learning enjoy are easier/perform better with more data, so i thought obtain past data once might be useful in your case.

Yeah, For now I'm getting all the data possible from my local client, than I'll se whether to integrate something I can't get already there like mempool size, if I'll be not happy with te results I'll get

This tool can be useful in your case, it parses the blockchain and get useful information from it. But it does it without using a wallet, it takes the binaries files of the blockchain directly.

Check it here: https://github.com/NicolasChoukroun/blockparser

It is in C and can be compiled easily on an unix OS.

digital_mine (OP)
Member
**
Offline Offline

Activity: 99
Merit: 14


View Profile
July 13, 2019, 02:57:18 PM
 #9

Thx but I wanted to do with my own local client-cli without any API that will impose me limitations

No problem, AFAIK data analysis & machine learning enjoy are easier/perform better with more data, so i thought obtain past data once might be useful in your case.

Yeah, For now I'm getting all the data possible from my local client, than I'll se whether to integrate something I can't get already there like mempool size, if I'll be not happy with te results I'll get

This tool can be useful in your case, it parses the blockchain and get useful information from it. But it does it without using a wallet, it takes the binaries files of the blockchain directly.

Check it here: https://github.com/NicolasChoukroun/blockparser

It is in C and can be compiled easily on an unix OS.

Awesome thx for point me to this tool

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!