Author

Topic: bitcoind - get no. of confirmations for an address (Read 1282 times)

legendary
Activity: 4592
Merit: 1851
Linux since 1997 RedHat 4
 listtransactions '*' N

lists the last N transactions.
hero member
Activity: 728
Merit: 500
165YUuQUWhBz3d27iXKxRiazQnjEtJNG9g
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 '.
mav
full member
Activity: 169
Merit: 107
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.
hero member
Activity: 728
Merit: 500
165YUuQUWhBz3d27iXKxRiazQnjEtJNG9g
An address doesn't have a discrete number of confirmations.  Only a transaction does.

Try this:
Code:
bitcoind gettransaction 
mav
full member
Activity: 169
Merit: 107
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?
Jump to: