Bitcoin Forum
June 22, 2017, 06:53:39 PM *
News: Latest stable version of Bitcoin Core: 0.14.2  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: bitcoind - get no. of confirmations for an address  (Read 1096 times)
mav
Full Member
***
Offline Offline

Activity: 169


View Profile
June 17, 2012, 07:40:15 AM
 #1

I want to know how many confirmations each of the transfers into a given address has.

I can achieve this in an inefficient way using

Code:
bitcoind listreceivedbyaddress

and manually filtering the result for only the address I'm interested in.

My concern is that if I have a lot of transactions, this command results in a very long list containing all my addresses. Is there a way to get this same list but only for a specific address, so that I don't have to filter through it?

Another way I could do it is using

Code:
bitcoind getreceivedbyaddress ADDRESS X

and iterate over a suitable range for X until I see a balance change, and then I know that there was a transaction to that address which has X confirmations.

I feel like I'm missing something here and I'm making this harder than it is. Anyone got some ideas what I should do?
1498157619
Hero Member
*
Offline Offline

Posts: 1498157619

View Profile Personal Message (Offline)

Ignore
1498157619
Reply with quote  #2

1498157619
Report to moderator
Join the Crowdfunding Revolution ►► FundYourselfNow.com ◄◄ Crowdsale with
attractive rewards
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1498157619
Hero Member
*
Offline Offline

Posts: 1498157619

View Profile Personal Message (Offline)

Ignore
1498157619
Reply with quote  #2

1498157619
Report to moderator
1498157619
Hero Member
*
Offline Offline

Posts: 1498157619

View Profile Personal Message (Offline)

Ignore
1498157619
Reply with quote  #2

1498157619
Report to moderator
1498157619
Hero Member
*
Offline Offline

Posts: 1498157619

View Profile Personal Message (Offline)

Ignore
1498157619
Reply with quote  #2

1498157619
Report to moderator
Revalin
Hero Member
*****
Offline Offline

Activity: 728


165YUuQUWhBz3d27iXKxRiazQnjEtJNG9g


View Profile
June 17, 2012, 07:47:54 AM
 #2

An address doesn't have a discrete number of confirmations.  Only a transaction does.

Try this:
Code:
bitcoind gettransaction <txid>

      War is God's way of teaching Americans geography.  --Ambrose Bierce
Bitcoin is the Devil's way of teaching geeks economics.  --Revalin 165YUuQUWhBz3d27iXKxRiazQnjEtJNG9g
mav
Full Member
***
Offline Offline

Activity: 169


View Profile
June 17, 2012, 08:03:54 AM
 #3

Yep that makes sense about transactions having confirmations not addresses

To be able to use gettransaction I need to have a transaction id which is not something I automatically have for a deposit, only for a send.

I can get a list of incoming transaction ids using

Code:
bitcoind listtransactions ACCOUNT

however I still have the problem of having to do lots of filtering if ACCOUNT has a lot of transactions. I guess I could keep track of how many transactions were returned the last time I called it and use that in the 'from' parameter to narrow down the list.

Thanks for the ideas. Still doesn't seem like a neat solution, but listtransactions is better than the previous ideas I had.

edit:
I might clarify the reason I made this title 'address confirmations' and not 'transaction confirmations' is that I plan to have each address used only once, and hence address should be analogous to a transaction. Of course I cannot assume that the address will indeed only be used once since someone may pay to it multiple times, so I am also thinking about how to deal with that scenario should it arise.
Revalin
Hero Member
*****
Offline Offline

Activity: 728


165YUuQUWhBz3d27iXKxRiazQnjEtJNG9g


View Profile
June 17, 2012, 08:23:00 AM
 #4

That's what I'd recommend: use one address per sale.  Then you don't get a big long list back.  You just get (usually) one transaction, and you deliver the goods when it confirms.  If any unexpected transactions come in you should notice it in your net balance.

Also check out 'listsinceblock <blockhash> <confirmations>'.

      War is God's way of teaching Americans geography.  --Ambrose Bierce
Bitcoin is the Devil's way of teaching geeks economics.  --Revalin 165YUuQUWhBz3d27iXKxRiazQnjEtJNG9g
kano
Legendary
*
Offline Offline

Activity: 2128


Linux since 1997 RedHat 4


View Profile
June 19, 2012, 02:43:04 PM
 #5

 listtransactions '*' N

lists the last N transactions.

Pool: https://kano.is Here on Bitcointalk: Forum BTC: 1KanoPb8cKYqNrswjaA8cRDk4FAS9eDMLU
FreeNode IRC: irc.freenode.net channel #kano.is
Help keep Bitcoin secure by mining on pools with full block verification on all blocks - and NO empty blocks!
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!