Pages:
Author

Topic: [PATCH] monitoraddress/blocks - page 2. (Read 5492 times)

legendary
Activity: 1540
Merit: 1002
September 30, 2010, 04:50:30 PM
#11
I should have been clear:  this is a patch against the latest 'vanilla' svn.

Oh, well, thanks again Smiley Boy, you're fast...
legendary
Activity: 1652
Merit: 2301
Chief Scientist
September 30, 2010, 04:44:58 PM
#10
I should have been clear:  this is a patch against the latest 'vanilla' svn.
legendary
Activity: 1540
Merit: 1002
September 30, 2010, 04:42:39 PM
#9
Any chance of getting a patch against the vanilla svn? I have a heavily tweaked code base (cuda and a collection of patches).
legendary
Activity: 1596
Merit: 1100
September 30, 2010, 01:49:15 PM
#8
I just updated the code/patch:
   monitoraddress allwallet
... gets triggered for all transactions that go into your wallet.  That includes 'change' transactions that can occur when you send somebody coins, which I expect will strike some people as a bug and others as an important feature.

And I combined the getblockby methods into one.  I know I would've never remembered  "is it getblockybycount or getblockbynumber or getblockbyheight or getblockbydepth" -- I will remember "getblock".

+3 all great stuff.

I strongly prefer this new 'getblock' arrangement of yours.  My only question was whether satoshi might not like it.
legendary
Activity: 1652
Merit: 2301
Chief Scientist
September 30, 2010, 01:38:10 PM
#7
I just updated the code/patch:
   monitoraddress allwallet
... gets triggered for all transactions that go into your wallet.  That includes 'change' transactions that can occur when you send somebody coins, which I expect will strike some people as a bug and others as an important feature.

And I combined the getblockby methods into one.  I know I would've never remembered  "is it getblockybycount or getblockbynumber or getblockbyheight or getblockbydepth" -- I will remember "getblock".
legendary
Activity: 1596
Merit: 1100
September 30, 2010, 01:35:19 PM
#6
  • getblockbyhash
    Returns details of the block with (hexadecimal).
  • getblockbynumber
    Returns details of block in the longest block chain.
  • gettransaction
    Returns details of transaction with (hexadecimal).

Your changes appear to come darned close to superceding my getblock and listtransaction patches.  With a few minor changes, you can completely supercede my patches:

  • add listtransactions or gettransactions, calling your txToJSON, for each wallet tx matching the given query parameters
  • add the following fields to txToJSON from my patch: bitcoin address, label, category (credit, debit, generated, etc.), amount
  • any reason why you didn't use 'getblockbycount' as elsewhere discussed?  I named mine that based on your own logic Smiley
legendary
Activity: 1596
Merit: 1100
September 30, 2010, 11:46:34 AM
#5
Come to think of it, maybe I should combine the getblockby* routines into one; there's no chance of mistaking a 64-character hex block hash for a 5-digit (or, in many years, a six or seven or ten digit) block number.

I thought about that before, too, but the rpc interface is internally typed.  Sure, we can specify a string for the parameter, and interpret the string as either a block hash or a block number, but satoshi might grumble at the overloading of parameters?  None of the existing RPC commands have multi-use parameters.
legendary
Activity: 1652
Merit: 2301
Chief Scientist
September 30, 2010, 11:34:51 AM
#4
My preferred arrangement would be a 'monitorall' command...
Good Idea, and that aught to be easy.

I'm thinking it should be:
  monitoraddress allwallet
... instead of a separate monitor command.

Come to think of it, maybe I should combine the getblockby* routines into one; there's no chance of mistaking a 64-character hex block hash for a 5-digit (or, in many years, a six or seven or ten digit) block number.
legendary
Activity: 1596
Merit: 1100
September 30, 2010, 10:57:31 AM
#3

My preferred arrangement would be a 'monitorall' command, which POSTs each incoming transaction to a URL, regardless of bitcoinaddress, as long as it's a wallet transaction.
legendary
Activity: 1540
Merit: 1002
September 30, 2010, 09:05:32 AM
#2
Kudos to you!

I will have to find the time to merge this into my private version, but this opens a whole new world of possibilities to me, in terms of code organization mainly.
legendary
Activity: 1652
Merit: 2301
Chief Scientist
September 30, 2010, 08:57:17 AM
#1
This patch adds the following JSON-RPC commands to bitcoin/bitcoind:

  • monitoraddress [monitor=true]
    When coins are sent to POST JSON transaction info to .
    If is 'allwallet' then monitor coins sent to all of your addresses.
    Pass false as third param to stop monitoring.
  • monitorblocks [monitor=true] [startblockcount=0]
    POST block information to as blocks are added to the block chain.
    [monitor] true will start monitoring, false will stop.
    Pass [startblockcount] to start monitoring at/after block with given blockcount.
  • listmonitored
    Returns list describing where blocks and transactions are being POSTed.
  • getblock
    Returns details of the block with (hexadecimal) or .
  • gettransaction
    Returns details of transaction with (hexadecimal).
This patch also modifies the "sendtoaddress" function so it returns the transaction ID on a successful send (instead of the string "sent").

If you use the monitor* functionality to POST information be sure to think through the security of your application.  For example, if you use monitoraddress to get notified of customer payments you should think about whether or not a customer could fake a payment by POSTing bogus information to your web server.

Full source code is at: http://github.com/gavinandresen/bitcoin-git/tree/monitorreceived
As always, bug reports, suggestions for improvement and feedback is welcome.

Updated monitoraddress/getblock commands as discussed below
Pages:
Jump to: