Bitcoin Forum
December 05, 2016, 08:49:03 PM *
News: Latest stable version of Bitcoin Core: 0.13.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: « 1 [2]  All
  Print  
Author Topic: [PATCH] monitoraddress/blocks  (Read 5096 times)
Gavin Andresen
Legendary
*
qt
Offline Offline

Activity: 1652


Chief Scientist


View Profile WWW
October 09, 2010, 10:10:33 PM
 #21

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?
1480970943
Hero Member
*
Offline Offline

Posts: 1480970943

View Profile Personal Message (Offline)

Ignore
1480970943
Reply with quote  #2

1480970943
Report to moderator
1480970943
Hero Member
*
Offline Offline

Posts: 1480970943

View Profile Personal Message (Offline)

Ignore
1480970943
Reply with quote  #2

1480970943
Report to moderator
1480970943
Hero Member
*
Offline Offline

Posts: 1480970943

View Profile Personal Message (Offline)

Ignore
1480970943
Reply with quote  #2

1480970943
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1480970943
Hero Member
*
Offline Offline

Posts: 1480970943

View Profile Personal Message (Offline)

Ignore
1480970943
Reply with quote  #2

1480970943
Report to moderator
1480970943
Hero Member
*
Offline Offline

Posts: 1480970943

View Profile Personal Message (Offline)

Ignore
1480970943
Reply with quote  #2

1480970943
Report to moderator
mizerydearia
Hero Member
*****
Offline Offline

Activity: 574



View Profile
October 14, 2010, 09:28:21 PM
 #22

Just a quick note that this patch is not compatible with http://bitcointalk.org/index.php?topic=724.msg8053#msg8053

Quote
<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
*
qt
Offline Offline

Activity: 1470


View Profile
October 15, 2010, 12:41:25 AM
 #23

Just a quick note that this patch is not compatible with http://bitcointalk.org/index.php?topic=724.msg8053#msg8053

Incorrect.  See response at link.

Jeff Garzik, bitcoin core dev team and BitPay engineer; opinions are my own, not my employer.
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
mizerydearia
Hero Member
*****
Offline Offline

Activity: 574



View Profile
October 15, 2010, 07:31:41 AM
 #24

  • 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.
Code:
<?php file_get_contents('php://input'); ?>
doublec
Legendary
*
Offline Offline

Activity: 1078


View Profile
October 15, 2010, 10:35:14 AM
 #25

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:

Code:
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
Legendary
*
qt
Offline Offline

Activity: 1652


Chief Scientist


View Profile WWW
October 15, 2010, 06:39:44 PM
 #26

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
Hero Member
*****
Offline Offline

Activity: 574



View Profile
October 15, 2010, 09:13:22 PM
 #27

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
Hero Member
*****
Offline Offline

Activity: 574



View Profile
October 16, 2010, 05:19:47 AM
 #28

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:
Code:
+    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
Legendary
*
qt
Offline Offline

Activity: 1652


Chief Scientist


View Profile WWW
October 18, 2010, 02:27:33 AM
 #29

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 Offline

Activity: 27


View Profile WWW
April 18, 2013, 04:02:12 PM
 #30

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?

strip4bit  - Bitcoin Amateuer Webcam Strip
Gavin Andresen
Legendary
*
qt
Offline Offline

Activity: 1652


Chief Scientist


View Profile WWW
April 18, 2013, 04:17:27 PM
 #31

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?
Pages: « 1 [2]  All
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!