Gavin Andresen (OP)
Legendary
Offline
Activity: 1652
Merit: 2216
Chief Scientist
|
|
October 09, 2010, 10:10:33 PM Last edit: October 09, 2010, 10:28:29 PM by gavinandresen |
|
Keeping the patch file up-to-date is another couple of steps, and I could/should automate it.
I automated updating/patching the monitorreceived patch, and just updated to Satoshi's latest: http://gist.github.com/604574(use the "raw" link there for a link to latest version of the patch) And I fixed the bug reported by doublec.
|
How often do you get the chance to work on a potentially world-changing project?
|
|
|
|
|
|
|
Whoever mines the block which ends up containing your transaction will get its fee.
|
|
|
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
|
mizerydearia
|
|
October 14, 2010, 09:28:21 PM |
|
Just a quick note that this patch is not compatible with http://bitcointalk.org/index.php?topic=724.msg8053#msg8053<gavinandresen> I reimplemented getblock in the monitor* patch <gavinandresen> (so it returned the same JSON data structures as monitorblock ) <necrodearia> Ah, so your patch makes getblock patch deprecated, right? <gavinandresen> Yup <necrodearia> Yay! ^_^
|
|
|
|
jgarzik
Legendary
Offline
Activity: 1596
Merit: 1091
|
|
October 15, 2010, 12:41:25 AM |
|
Incorrect. See response at link.
|
Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own. Visit bloq.com / metronome.io Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
|
|
|
mizerydearia
|
|
October 15, 2010, 07:31:41 AM Last edit: October 15, 2010, 09:11:07 PM by mizerydearia |
|
- monitoraddress <bitcoinaddress> <url> [monitor=true]
When coins are sent to <bitcoinaddress> POST JSON transaction info to <url>. If <bitcoinaddress> is 'allwallet' then monitor coins sent to all of your addresses. Pass false as third param to stop monitoring. - monitorblocks <url> [monitor=true] [startblockcount=0]
POST block information to <url> 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.
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. I agree. A "monitorall" command would be quite useful. This should show the data that is passed along. <?php file_get_contents('php://input'); ?>
|
|
|
|
doublec
Legendary
Offline
Activity: 1078
Merit: 1005
|
|
October 15, 2010, 10:35:14 AM |
|
Does any data get passed to the POST request? From my observations it appear no data is passed along.
From my tests, the data is passed as the body of the POST request. For example, the following Perl code using the Mojolicious web framework will extract data from the POST: my @blocks;
any '/receive' => sub { my $self = shift; my $body = $self->req->body; my $json = Mojo::JSON->new; my $data = $json->decode($body); my $params = $json->{params}; ...do something with $params... $self->render(json => {result => undef, error => undef, id => undef }); };
Here the $params variable contains the decoded JSON data equivalent to what 'getblock' returns if this was posted as a result of 'monitorblocks'. It will return the equivalent of what 'gettransaction' returns if it was posted as a result of 'monitoraddresses'. I wasn't sure what it expected as a result so I just return an empty JSON method result.
|
|
|
|
Gavin Andresen (OP)
Legendary
Offline
Activity: 1652
Merit: 2216
Chief Scientist
|
|
October 15, 2010, 06:39:44 PM |
|
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. I agree. A "monitorall" command would be quite useful. Pass "allwallet" to monitoraddress and you'll get all transactions that put coins in your wallet. RE: getting the data POSTed in PHP: Try: json_string = http_get_request_body(); Also, POSTing to www.postbin.org (create a postbin there first) is really useful for debugging.
|
How often do you get the chance to work on a potentially world-changing project?
|
|
|
mizerydearia
|
|
October 15, 2010, 09:13:22 PM |
|
Fatal error: Call to undefined function http_get_request_body()
I apparently don't have the HTTP extension and am uncertain how to provide it.
Workaround is: file_get_contents('php://input')
|
|
|
|
mizerydearia
|
|
October 16, 2010, 05:19:47 AM |
|
jgarzik's getblock patch has some extra information that your patch doesn't have. Is it possible you could add them to your patch, particularly nBits? For now I wrote some lines to patch your patch. This is line from jgarzik's patch for nBits: + obj.push_back(Pair("bits", (uint64_t)block.nBits)); It would be nice for both of your patches to be merged into one.
|
|
|
|
Gavin Andresen (OP)
Legendary
Offline
Activity: 1652
Merit: 2216
Chief Scientist
|
|
October 18, 2010, 02:27:33 AM |
|
nBits is difficulty in 'compact' format? (if I recall correctly...)
It should be reported as floating-point 'difficulty', like you get from the 'getinfo' rpc command.
I will add that.
|
How often do you get the chance to work on a potentially world-changing project?
|
|
|
strip4bit
Newbie
Offline
Activity: 26
Merit: 0
|
|
April 18, 2013, 04:02:12 PM |
|
old topic, old patch. But i need this. Is it possible to merge this patch? (impossible after the long time) Or do i have to use this old bitcoind version?
|
|
|
|
Gavin Andresen (OP)
Legendary
Offline
Activity: 1652
Merit: 2216
Chief Scientist
|
|
April 18, 2013, 04:17:27 PM |
|
See -blocknotify and -walletnotify command-line options in the latest code, which will run an arbitrary command when new blocks happen or transactions hit your wallet (and that arbitrary command can be "POST information to this URL...").
|
How often do you get the chance to work on a potentially world-changing project?
|
|
|
|