0

This is usual checkout functionality. Show address to the user and needs to monitor it for new transaction during n minutes. Addresses are not unique for each payment.

Optional:it would be good to have listener for transaction with certain incoming amount, but this is optional.

blockchain.info have something similar, but I want to it using local bitcoin-qt from .Net application.

*Update: this should be done for non-wallet addresses/transactions.

1

Bitcoin-qt has several limitations when it comes to this type of thing. There are only really two ways to do this.

  1. Use the listunspents RPC call to watch the balance for a particular address, and compute the total balance. Then trigger your call on the backend from your .net application.

  2. Use the external wallet-notify bitcoind option that sends transaction data to your .net process via a script, parse the result to determine the payment. This can cause problems on high volume sites as it spawns external processes per wallet notify.

Finally, you can only use this method to interact with addresses registered to the local bitcoind. Either addresses it controls, or that you have manually loaded.

  • Addresses are not mine. Users who selling enter their addresses online. What does it mean "registered to the local bitcoind"? Can I do it without private key? – Alex Nov 27 '14 at 20:26
  • I don't believe so. Your best bet is to use a service that already does this, there are several api services that address this exact use case. If you want to monitor arbitrary addresses then you would need additional software. For example Bitpay's nodejs bitcore could be used to connect to bitcoind and scan incoming 0 confirmation transactions for addresses you were interested in. Bitcoind won't do this out of the box. – Matt Nov 27 '14 at 23:46
  • So, if services which can monitor addresses exist, so it is possible. And I want to know how they implemented to see is it worth to have own implementation or use them. – Alex Nov 28 '14 at 14:11
  • As I said, they don't do this with standard bitcoind. They either modify bitcoind to start pushing transaction information to an external source, or they use a project like bitcore to access that information on the network, then write their own bindings / software. – Matt Nov 28 '14 at 15:59
  • Does the first option require polling? – Jus12 Oct 30 '16 at 16:13
1

In order to monitor specific receiving addresses for incoming transactions through the RPC API you should make use of the listreceivedbyaddress method. Adding these parameters: listreceivedbyaddress(0, true) will also return zero-confirmation and empty addresses.

The most efficient way to monitor all incoming transactions with a specific amount is by calling listsinceblock, keeping track of the last scanned-by-your-app block and passing it as a parameter: listsinceblock(lastScannedBlockHash, targetConfirmations) so you effectively scan only the new block, which is very fast and lightweight.

A battle-tested library for performing the above in .net is BitcoinLib which also comes as a NuGet packet:

  • I think your example is only for "your wallet" transactions. I just found another way to find my tx: -getblockcount -getblockhash {index} -getblock {hash} - loop for: getrawtransaction {txid} I can find my transaction by address , but this is ONLY for confirmed tx. How I can look at unconfirmed tx??? – Alex Dec 1 '14 at 21:17
  • @Alex that is correct, however it wasn't clear in your original question that you had to also scan non-wallet transactions. You can obtain a list of unconfirmed transactions by calling getrawmempool which returns transactions in your memory pool where they reside until (and if) they get confirmed. You can then call: getrawtransaction <txId> 1 against that collection and examine each transaction in depth. – George Kimionis Dec 2 '14 at 0:17
0

If you gonna do this. Lets say RPCCMDS+.net server is better than bitcoin-qt server which betters than bicoind.exe server.If you don't owe those addresses ,just ask blockchain API for mercy.

0

Since 0.10, bitcoind has support for watch-only addresses. https://bitcoin.org/en/developer-reference#importaddress

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.