Programming a solution to know when a Bitcoin Address has stored a target amount

1

1

Sorry, I'm probably not going to use the correct terms here.

Does anyone know of, or how to use bitcoind (or of an external library) that can look at or even provide event driven mechanisms to monitor when an address has received equal to or more than a target amount.

I know of the websocket API available from blockchain but I'd ideally do it in house using my own systems if possible.

Peter Fox

Posted 2013-05-07T08:50:41.543

Reputation: 181

Question was closed 2013-05-11T16:35:25.043

see also: Push deposit notification through HTTP requests

o0'. 2013-05-07T12:14:18.033

Answers

2

A rough solution:

If the account is in your wallet, you can use:

bitcoind getreceivedbyaddress "ADDRESS"

to get the amount of bitcoins received by ADDRESS. You can put that line inside an infinite loop. You could create a shell program which stores the result in a variable every 30 seconds (using sleep) and compare it to the previous value. If you subtract the values and find a difference above a threshold you can make the script alert you.

I can be more specific if you tell me your preferences (Python, Linux shell...)

halftimepad

Posted 2013-05-07T08:50:41.543

Reputation: 1 218

I'm assuming that won't scale that well for a massive system though?Peter Fox 2013-05-07T14:47:20.560

By massive do you mean with many addresses? In that case you might just check each new block for your addresses. You can use getblock and bitcointools https://github.com/gavinandresen/bitcointools. By the way, the 30 seconds wait time is overkill. If you want confirmed transactions (or transactions that are at least in one block), on average the changes take 10 minutes.

halftimepad 2013-05-07T15:31:54.847

Well ideally I want to create a new address, wait until it has a set amount of bitcoins in that address and then transfer the coins and close the address down, doing this for hundreds if not thousands of addresses at a timePeter Fox 2013-05-07T15:41:37.037

I would go for a script calling bitcoind. Or a custom program in Python with bitcointools. I don't think the operations are that complicated. A regular processor should be enough. In any case it seems you will need a bit of work.halftimepad 2013-05-07T16:14:52.907