Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: OmegaStarScream on March 14, 2020, 01:12:19 PM



Title: Unconfirmed transactions
Post by: OmegaStarScream on March 14, 2020, 01:12:19 PM
I basically want to get a list of the current unconfirmed transactions. For example, If we have 6000 transactions in the mem pool, I want all the data (addresses, time, amount transacted, TXID) regarding these transactions.

Any APIs that could facilitate doing that? I found Blockchain's one[1] but it's not exactly what I'm looking for.

[1] https://blockchain.info/ja/unconfirmed-transactions?format=json


Title: Re: Unconfirmed transactions
Post by: LoyceV on March 14, 2020, 01:20:02 PM
https://www.reddit.com/r/Bitcoin/comments/7jdswx/how_can_i_extractquery_mempool_data/ gives several options, I tested this one in Bitcoin Core > Debug window > Console:
Code:
getrawmempool true
It gives a long list :)


Title: Re: Unconfirmed transactions
Post by: DaveF on March 14, 2020, 01:46:43 PM
Also keep in mind that if your node is online it's a moving target. If you scrape it and then scrape it again you will get a different (probably longer) list the 2nd time.
If you are looking for static info drop your gateway and you can play with the same info over and over again.

-Dave


Title: Re: Unconfirmed transactions
Post by: DaveF on March 16, 2020, 04:04:23 PM
Also keep in mind this post of mine from last year:
https://bitcointalk.org/index.php?topic=5200716 (https://bitcointalk.org/index.php?topic=5200716)

Your list of unconfirmed transactions is not "the" list of unconfirmed transactions it is "a" list of unconfirmed transactions and can vary between nodes.
Didn't actually pay attention to that myself till I noticed and asked about it.

-Dave


Title: Re: Unconfirmed transactions
Post by: OmegaStarScream on March 16, 2020, 05:27:53 PM
Thanks, both of you!

Also keep in mind this post of mine from last year:
https://bitcointalk.org/index.php?topic=5200716 (https://bitcointalk.org/index.php?topic=5200716)

Your list of unconfirmed transactions is not "the" list of unconfirmed transactions it is "a" list of unconfirmed transactions and can vary between nodes.
Didn't actually pay attention to that myself till I noticed and asked about it.

-Dave

Not sure I understood this properly. Is it safe to say there is some kind of "delay"? Let's say I have two nodes, and I'm getting the mempool txs in both of them, and then I find that node_A has 50 more transactions than node_B. Where are these 50 transactions exactly? If I make a second request to get a list of unconfirmed transactions using node_B, would that allow me to see the missing 50 transactions that node_A have?

Also, if there is that much gap, how come we never encounter errors while checking our transactions in block explorers? I mean, if not all nodes have your transaction, you shouldn't be able to find it in at least a few blockexplorers. Right?


Title: Re: Unconfirmed transactions
Post by: DaveF on March 16, 2020, 07:54:21 PM
Thanks, both of you!

Also keep in mind this post of mine from last year:
https://bitcointalk.org/index.php?topic=5200716 (https://bitcointalk.org/index.php?topic=5200716)

Your list of unconfirmed transactions is not "the" list of unconfirmed transactions it is "a" list of unconfirmed transactions and can vary between nodes.
Didn't actually pay attention to that myself till I noticed and asked about it.

-Dave

Not sure I understood this properly. Is it safe to say there is some kind of "delay"? Let's say I have two nodes, and I'm getting the mempool txs in both of them, and then I find that node_A has 50 more transactions than node_B. Where are these 50 transactions exactly? If I make a second request to get a list of unconfirmed transactions using node_B, would that allow me to see the missing 50 transactions that node_A have?

Also, if there is that much gap, how come we never encounter errors while checking our transactions in block explorers? I mean, if not all nodes have your transaction, you should at least not be able to find it in a few block explorers right?


This is why occasionally you can't see an unconfirmed TX on some explorers for a bit longer then others.
As far as I can tell it's part propagation, and part validation time. Node "A" sees a tx, while it's thinking about it (milliseconds) it may or may not accept another TX so yeah it can probably accept many per second if it hits at the wrong time it just does not see it.

This is a very very simplified version as it was explained to me. May or may not be 100% accurate.

What was explained to me as accurate is that there are certain non optimal ways that core / reference client do things. But it allows for more stability. i.e. not accepting a transaction is better then stacking them up and building a large backlog of things to process. Because if a block is found it still has to go though the backlog to get all the transactions and then throw out the ones that were in the block since they are now in a block.

-Dave