Bitcoin Forum

Bitcoin => Electrum => Topic started by: ThisManIsTesting on November 05, 2017, 02:34:11 AM



Title: Electrum Protocol: Transaction Confirmations
Post by: ThisManIsTesting on November 05, 2017, 02:34:11 AM
Looking for a method to get transaction confirmations,
Apparently there's nothing to do that in the protocol documentation

Docs: http://docs.electrum.org/en/latest/protocol.html


Title: Re: Electrum Protocol: Transaction Confirmations
Post by: HCP on November 05, 2017, 05:30:46 AM
Does the "transaction.get" method give you the block# or height that it was confirmed in within the hex data? If so, then you could just calculate the difference between that number and the current blockchain height and that is your number of confirmations.

NOTE: I see the Address.get_history method returns block heights for the transactions associated with an address... maybe that's an option?


Title: Re: Electrum Protocol: Transaction Confirmations
Post by: ThisManIsTesting on November 05, 2017, 05:56:56 AM
Does the "transaction.get" method give you the block# or height that it was confirmed in within the hex data? If so, then you could just calculate the difference between that number and the current blockchain height and that is your number of confirmations.

NOTE: I see the Address.get_history method returns block heights for the transactions associated with an address... maybe that's an option?
Explain more please,
I do not know how confirmations are counted thanks for giving me an idea :)


Title: Re: Electrum Protocol: Transaction Confirmations
Post by: HCP on November 05, 2017, 06:45:51 AM
"Confirmations" are simply the number of blocks that have been mined since the transaction was put into a block... the block it is put in, counts as 1 confirmation. The formula is:

Number of Confirmations = (current blockchain height - block height it was confirmed in) + 1

For example, your transaction is included in block# 492400... it now has 1 confirmation. 10 blocks later, at block# 492410, it will now have 11 confirmations... 10 blocks after that, at block# 492420, it will have 21 confirmations.

So... if you transaction was in block# 492400... and the current blockheight is 492502... # confirmations = (492502 - 492400) + 1 = 103 confirmations.