Bitcoin Forum

Bitcoin => Project Development => Topic started by: MORA on January 06, 2012, 06:26:13 PM



Title: [DONE] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: MORA on January 06, 2012, 06:26:13 PM
Src : https://github.com/bitcoin/bitcoin/commits/v0.5.1rc2

For original thread where the idea was mentioned : https://bitcointalk.org/index.php?topic=40264.msg676281#msg676281

The idea is to add a HTTP POST call to a local webserver, after bitcoind has accepted a new transaction into memory.

I will not put too much requirements on the contents of the call, its easyier to convert in PHP that C++ anyway.
But I need at least inputs and outputs with amounts.
The HTTP url can be hardcoded in the patch.
Patch license should be same as bitcoin or public domain.

[EDIT] What I am looking for is a call with http/system, when bitcoind gets a new transaction, ie. unconfirmed, I am not interested in the actual blocks, since I already have a setup to handle that.

Here's my suggestion for the easiest way to get unconfirmed transactions out of bitcoind

At the end of the AcceptToMemoryPool() function in main.ccp use WalletTxToJSON() in bitcoinrpc.cpp to make a json string and the HTTPPost method in to post it to your callback url which you can process.

I have posted this to vworker.com also, feel free to post a bid there.
If you are interested before bids are posted on vworker, you can also bid here.


Title: Re: [5BTC] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: Matt Corallo on January 07, 2012, 02:13:31 AM
Use https://github.com/bitcoin/bitcoin/pull/743 (https://github.com/bitcoin/bitcoin/pull/743) plus a simple post-sender.


Title: Re: [5BTC] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: Luke-Jr on January 07, 2012, 02:16:09 AM
Add to bitcoin.conf (with pull 727 (https://github.com/bitcoin/bitcoin/pull/727) and 743 (https://github.com/bitcoin/bitcoin/pull/743)):
Code:
blocknotify=curl -d "$(bitcoind getblock %s)" http://youruri

1843ETPAWNriBA2mtDCBMQasaDHnWETP82 if this does what you need


Title: Re: [5BTC] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: MORA on January 07, 2012, 08:57:13 AM
Add to bitcoin.conf (with pull 727 (https://github.com/bitcoin/bitcoin/pull/727) and 743 (https://github.com/bitcoin/bitcoin/pull/743)):
Code:
blocknotify=curl -d "$(bitcoind getblock %s)" http://youruri

1843ETPAWNriBA2mtDCBMQasaDHnWETP82 if this does what you need
I think thats for an actual block, I see I used "block" in the description, but as the other thread and quote shows, its the new transactions that are interesting.

ie. when bitcoind gets a new tx, which will then be unconfirmed, it calls a http post/system with the details.

I guess the reason I need both pulls was the getBlock rpc ?
I will look into 743 anyway, the code to call system() could probaly be reused.




[EDIT] I have now posted this to vworker.com, so if you are interested, please bid using vworker.
I will update this thread when the project is done.


Title: Re: [PAY] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: MORA on January 15, 2012, 08:15:11 PM
URL for vworker : http://www.vworker.com/RentACoder/misc/BidRequests/ShowBidRequest.asp?lngBidRequestId=1810678


Title: Re: [PAY] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: stcupp on January 17, 2012, 10:14:51 AM
im actually working on something like this for myself just haven't had the time to work on it hopefully today i will have the time to get and compile all the dependencies and start coding... i have another project i need to finish up first though

check this patch out:
https://bitcointalk.org/index.php?topic=1319.msg15065#msg15065

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.



Title: Re: [PAY] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: MORA on January 18, 2012, 05:24:29 PM
For now I am using Abe for the regular block monitoring, but yes that could be useful also, just need to check for orfans etc.

I didnt see any bids on my project, so I adjusted it and reposted, but maybe bitcoin is too unknown for someone to risk their rating on vworker to take on such a project.

I could post as pay-for-time, but then I risk paying for a few hours work with no solution.
Wish I was better as C myself, I have only done some non-object based micro processor code.


Title: Re: [PAY] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: stcupp on January 21, 2012, 07:55:19 AM
if your already getting the blocks why not just pull the transaction data from the blocks?

edit: err nevermind just thought about what i said lol if its in a block then it has atleast 1 confirm



Title: Re: [PAY] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: stcupp on January 22, 2012, 08:56:00 AM
I've had a little bit of time to work on this today.
I made a new thread just to handle posts like Gavins blockmonitor does.
When a new transaction is received and gets accepted to the memory pool it will put a new post in the query to be sent out.

Is this what you wanted? or do you want a whole dump of the transactions in the memory pool?
I just ran across some code in the new source it's a new RPC command: getmemorypool

You can use it like getmemorypool("transactions") and it will dump out all unconfirmed transactions

anyway lemme know what you think


Title: Re: [PAY] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: MORA on January 22, 2012, 09:06:39 AM
I've had a little bit of time to work on this today.
I made a new thread just to handle posts like Gavins blockmonitor does.
When a new transaction is received and gets accepted to the memory pool it will put a new post in the query to be sent out.
Very nice, that is exactly what I wanted, a post per tx, and since its localhost it should be fast enough to keep.

You can use it like getmemorypool("transactions") and it will dump out all unconfirmed transactions
Also useable, but then you would need to poll it every so often and check if theres new transactions.

Did you get a POST system working in your test?
If so could you show what data the post script would receive ?


Title: Re: [PAY] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: stcupp on January 22, 2012, 09:34:16 AM
I've had a little bit of time to work on this today.
I made a new thread just to handle posts like Gavins blockmonitor does.
When a new transaction is received and gets accepted to the memory pool it will put a new post in the query to be sent out.
Very nice, that is exactly what I wanted, a post per tx, and since its localhost it should be fast enough to keep.

You can use it like getmemorypool("transactions") and it will dump out all unconfirmed transactions
Also useable, but then you would need to poll it every so often and check if theres new transactions.

Did you get a POST system working in your test?
If so could you show what data the post script would receive ?

Havn't tested it yet... I should be ready to test in about 15 mins I'll let you now what happens


Title: Re: [PAY] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: stcupp on January 22, 2012, 12:48:53 PM
sorry it took so long i had some bugs to work out....

How does this look?
Code:
{
"method":"monitortx",
"params":[
{
"hash":"e0065cfb99b2479cbd7479fbe7c70864b5de5ba67c8f3bf58eb460ea2ef094b3",
"ver":1,
"vin_sz":4,
"vout_sz":2,
"lock_time":0,
"in":[
{
"prev_out":"12e1a620f7e90c3f877c8f6369aaf71100ab15be17de0d3c2802c26790f5a3c9",
"n":1,
"scriptSig":"30450221009572ef611ba5940e3842bcbf255a4b1e79c32c39549cc412655c39f0ad727413022022c07128a0cf3b111ce7faf7a7283fa48dd8563adaadd26a477d7e41e09dfbaf01 047fac59c7a28fd6069a00307ab853d0915cb6fec4df84df422b79e0ad3049be0e87cfaf9ca823a06ebee5fb04bc267b3bd0f782579a501397a35d49ada02075dc"
},
{
"prev_out":"d037bfa871865f5020e3a9edb0ad8e3bfeee25bbc6115476c3fb1cd105361c8f",
"n":0,
"scriptSig":"30460221008945b51f2616e4197f60bdec7c2b79cf9cb597faa631accf4b0d00081c525e26022100820c3e1cd2c9d0aec02fccc73dd22baef1a5746b78d3bc4c8df92f21abcf606601 047f094b909687bb621d9ecb02a3f5f7938a0dc71917beec1d21055a69094f030bf210d059b2ad6f872d717826e9dee0348aef7716c8c93911e911a067103c0b69"
},
{
"prev_out":"c8356c7f33245c77a31f75c4534b31993a5d4f47985208d7bf4e708b6e6cb9ad",
"n":0,
"scriptSig":"304502202c30da244b961e570d964cb9d6998e17b0a0349131d8cf0cfa36d214534ecf0b022100b65775ff34b27ed5b0688f5dd4f2b2a1d0c623dd0340891f7845b72757e8ed4701 04ce18444917f2dd3c8f5a4f262556ab9dd04ad482799ee8e92c92735c66957bd42a9e55f894a408ca3ce42d96f6efa221f81e914b49422ff8cfc1b8a950fc91f0"
},
{
"prev_out":"8302ab4b9b5fb426bc8a41e343d2006bafbab95883622cd954e068f2787a3e97",
"n":0,
"scriptSig":"3046022100e2b880f9cfbfeecbd8bb76629ecbff654ed915f8ff8557937f376cffedd8b98f022100ef63e5cd8af0531e2e53d4be8ee73690eb4537ac19663ed054c1c05235eaa12701 04c78a58082241cb3c8c09ef57f9104fc4c28d4ff13252f8bbce0c0eedbbafd92b66639bd48c850016b2442db22474e333cdf2ae3ef6f237eb4be22e582fcf0563"
}
],

"out":[
{
"value":505.96647463,
"scriptPubKey":"OP_DUP OP_HASH160 609c3e000d66225caf5ad27245978d33ed761ee6 OP_EQUALVERIFY OP_CHECKSIG"
},
{
"value":173.16000000,
"scriptPubKey":"OP_DUP OP_HASH160 c56d7f3e011ce6f40d7399667fb2bc116e643b38 OP_EQUALVERIFY OP_CHECKSIG"
}
]

],
"id":null
}

I just used a simple php script to catch the data

Code:
<?php

      
if (
            
$_SERVER['REQUEST_METHOD'] = 'POST' AND 
            !empty(
$_SERVER['CONTENT_TYPE']) AND
            
$_SERVER['CONTENT_TYPE'] = 'application/json'
            
) {
$stringData file_get_contents('php://input');
$myFile "test.txt";
$fh fopen($myFile'w') or die("can't open file");
          
fwrite($fh$stringData);
fclose($fh);
        }
                

?>


Title: Re: [PAY] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: MORA on January 22, 2012, 01:50:19 PM
Very nice :)

Not sure how to decode the scriptsig, but I dont use sender for now anyway.





Title: Re: [PAY] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: stcupp on January 22, 2012, 02:41:46 PM
Very nice :)

Not sure how to decode the scriptsig, but I dont use sender for now anyway.

The scriptSigs seem to be split up into 2 parts by a space
I'm not 100% sure but i think the first part is the actual sig and the 2nd part is the senders pubkey

anyway this should be done soon im just adding the block posting part now for my needs and adding in the code to make this usable by the
config file im gna make it like this
monitortx(true|false)
monitortxurl=http://example.com/foo.php
monitorblock(true|false)
monitorblockurl=http://example.com/foo.php


Title: Re: [PAY] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: slush on January 22, 2012, 02:41:50 PM
Code:
<?php
            $_SERVER
['REQUEST_METHOD'] = 'POST' AND 
            !empty(
$_SERVER['CONTENT_TYPE']) AND
            
$_SERVER['CONTENT_TYPE'] = 'application/json'
?>

This is, of course, wrong. Corrected condition:

Code:
            $_SERVER['REQUEST_METHOD'] == 'POST' &&  isset($_SERVER['CONTENT_TYPE']) && $_SERVER['CONTENT_TYPE'] == 'application/json'


Title: Re: [PAY] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: stcupp on January 22, 2012, 02:56:35 PM
Code:
<?php
            $_SERVER
['REQUEST_METHOD'] = 'POST' AND 
            !empty(
$_SERVER['CONTENT_TYPE']) AND
            
$_SERVER['CONTENT_TYPE'] = 'application/json'
?>

This is, of course, wrong. Corrected condition:

Code:
            $_SERVER['REQUEST_METHOD'] == 'POST' &&  isset($_SERVER['CONTENT_TYPE']) && $_SERVER['CONTENT_TYPE'] == 'application/json'

AND == && in php lol

its even the first example on the logical operators page in the php manual

http://www.php.net/manual/en/language.operators.logical.php


Title: Re: [PAY] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: MORA on January 22, 2012, 02:58:41 PM
Very nice :)

Not sure how to decode the scriptsig, but I dont use sender for now anyway.

The scriptSigs seem to be split up into 2 parts by a space
I'm not 100% sure but i think the first part is the actual sig and the 2nd part is the senders pubkey

anyway this should be done soon im just adding the block posting part now for my needs and adding in the code to make this usable by the
config file im gna make it like this
monitortx(true|false)
monitortxurl=http://example.com/foo.php
monitorblock(true|false)
monitorblockurl=http://example.com/foo.php

How are you going to handle when some blocks are rejected later, ie. a rollback of 2 blocks that didnt make it into the main chain after all ?

From what I understand the reading of block file is only a small part of what Abe does to make sure the database is maintained to keep track of the main chain.


Title: Re: [PAY] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: stcupp on January 22, 2012, 03:22:54 PM
Very nice :)

Not sure how to decode the scriptsig, but I dont use sender for now anyway.

The scriptSigs seem to be split up into 2 parts by a space
I'm not 100% sure but i think the first part is the actual sig and the 2nd part is the senders pubkey

anyway this should be done soon im just adding the block posting part now for my needs and adding in the code to make this usable by the
config file im gna make it like this
monitortx(true|false)
monitortxurl=http://example.com/foo.php
monitorblock(true|false)
monitorblockurl=http://example.com/foo.php

How are you going to handle when some blocks are rejected later, ie. a rollback of 2 blocks that didnt make it into the main chain after all ?

From what I understand the reading of block file is only a small part of what Abe does to make sure the database is maintained to keep track of the main chain.

I didn't really think about it but i think it could be done fairly easily
I'm going to add the code to post in the SetBestChain void in main.cpp
once the blocks get posted to the server just do checks on the blockchain structure and if it does need to get some different blocks send rpc commands to get them...

I'm not exactly sure how that would work out though =P I would need to do some testing


Title: Re: [PAY] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: slush on January 22, 2012, 04:27:02 PM
AND == && in php lol

You probably missed that I fixed the '=' mistake. I replaced 'and' for '&&' just because it's my personal favourite.


Title: Re: [PAY] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: stcupp on January 22, 2012, 04:40:30 PM
AND == && in php lol

You probably missed that I fixed the '=' mistake. I replaced 'and' for '&&' just because it's my personal favourite.

hmmm i didn't notice that... I think i've been awake too long... need sleep


Title: Re: [PAY] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: stcupp on January 23, 2012, 09:13:59 AM
Well after a long nap i woke up and finished this up and posted to a github heres the link:

https://github.com/stcupp/bitcoin

Look here to view all the code changes:

https://github.com/stcupp/bitcoin/commit/cd2b9c14a003a8fc1b0b439998d298518cdf675e

Here is my bitcoin address:
1BNFvb7e62j5CANx1WARq5jADaXJ6uVhZa

 I'm working on building the binaries for windows and 32bit linux with the gitian-builder right now although i already have a 64 bit linux binary made if youd like me to post it.


Title: Re: [PAY] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: MORA on January 23, 2012, 09:49:36 AM
Looks good, will give it a test run this evening.
Are you sending tx posts for all tx, or only the ones for addresses in the wallet ?


Title: Re: [PAY] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: stcupp on January 23, 2012, 10:00:42 AM
For all... as soon as the tx is recieved and accepted into the memory pool it converts the tx to json and puts it in a queue to be sent out. the blocks work the same way as soon as its accepted its put in the queue to be sent out. I also updated the blockToJson code to include the full transactions so if you use the getblock rpc call it will give you the full transactions instead of just the hashes, with the block


Title: Re: [PAY] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: stcupp on January 23, 2012, 10:15:04 AM
Here is a example of the TX post:

Code:
{
    "method": "monitortx",
    "params": [{
        "hash": "ff8647d5ff6840ad16fabfeb9ec8d85245a3a36a7594d75fb222607c020805a1",
        "ver": 1,
        "vin_sz": 3,
        "vout_sz": 1,
        "lock_time": 0,
        "in": [{
            "prev_out": "1ab90bbdbae4da69afc1010895d3d615de9d86c6c440850d5a7e32d496be8b2b",
            "n": 0,
            "scriptSig": "3045022100f1fd13871c4fd21d076c41a2f55a47d3c636e53811fe2fa1b3d710398d51001b022036ce9f6cc4e14c7f3bd555320c07f2a9ce05cb4c30dba071b919248cd1e7a90501"
        }, {
            "prev_out": "96ca24a2f30c783cccaaf8dc56dba1b53b8697707d4e7891255c378607fb1db7",
            "n": 0,
            "scriptSig": "3046022100e40bbc646adff910c0f20107bbac8112986f629be0b0f10ab5c494bb182b63380221009da7252d87773cb03eae337c0d4f439ca3f1bd8d06e620dc9272ac4b0bed3d3801"
        }, {
            "prev_out": "3dd44a801ed2844c74e4385bf4a973a624a07ea77b3059dae21c6a8ce614aa66",
            "n": 0,
            "scriptSig": "304502203653911b24703cba25d00e24b81db4bda64c4270280bff4e0d038589e4d7d020022100f98eff337ebe46925b98024fcbae6d0385acbcb276fbe2625433eeac84d7b4b801"
        }],
        "out": [{
            "value": 150.10960597,
            "scriptPubKey": "OP_DUP OP_HASH160 0568015a9facccfd09d70d409b6fc1a5546cecc6 OP_EQUALVERIFY OP_CHECKSIG"
        }]
    }],
    "id": null
}

And a example of the block post:

Code:
{
    "method": "monitorblock",
    "params": [{
        "hash": "000000000000029320c3dca1346bdfc5232d5a3c0c94b658443e00834e967e40",
        "hashprevious": "0000000000000b6e89bb00a92d1f75b327f1573f0625892f47ed4c1dd22b9537",
        "blockcount": 163481,
        "version": 1,
        "merkleroot": "ad2ec07261dc0c96f7ea7b54c1caac7262b4f2fd9c1ece66ea9b24bf7e33487f",
        "time": 1327307306,
        "nonce": 3086712885,
        "difficulty": 1307728.36060407,
        "tx": [{
            "hash": "abcde22c73bcd0eb16f4e21500e0fff613d52de682af549df780033681384be9",
            "ver": 1,
            "vin_sz": 1,
            "vout_sz": 1,
            "lock_time": 0,
            "in": [{
                "prev_out": "0000000000000000000000000000000000000000000000000000000000000000",
                "n": 4294967295,
                "coinbase": "70736a043fd40c1a040f367b12522cfabe6d6d3e5504513a919a434cd108f7832a38248ade54d52d704bd8e03a70831eae0c1f01000000000000004d696e656420627920425443204775696c6420ac1eeeed88"
            }],
            "out": [{
                "value": 50.00400000,
                "scriptPubKey": "OP_DUP OP_HASH160 ca975b00a8c203b8692f5a18d92dc5c2d2ebc57b OP_EQUALVERIFY OP_CHECKSIG"
            }]
        }, {
            "hash": "01487a246df68eead40576b14cbcd2dd3da311ef3058e25d22e27fc64efff46e",
            "ver": 1,
            "vin_sz": 1,
            "vout_sz": 2,
            "lock_time": 0,
            "in": [{
                "prev_out": "b27ea2628d0af802dbe90d13e3532e0c2152c844642e3efbd32c9a859b86568f",
                "n": 0,
                "scriptSig": "3045022100b04b9f69b409326054549c28d2bcbc8983eb7747b53c770cb928b1a7af6aa0e7022053182f5541f74ce7f9863f9725cb962e57a101c02e4c21375e1a0d2bc24833a701 0426ed9da294aac90e519b89b2143cba83665292f5a299aafe26c3aa753a2390df676bfe10c8c6964efcf5ea3930392bacf605f4db84c4dc248ac665b16f7441f8"
            }],
            "out": [{
                "value": 40.81900000,
                "scriptPubKey": "OP_DUP OP_HASH160 dbd6dc9a1c1a97a459f7790111f218b04f209c05 OP_EQUALVERIFY OP_CHECKSIG"
            }, {
                "value": 0.54000000,
                "scriptPubKey": "OP_DUP OP_HASH160 2696676f6503597de19f7cad63bb72a6ffeddaf4 OP_EQUALVERIFY OP_CHECKSIG"
            }]
        }, {
            "hash": "e4cb25d7699287a8b0c71980becf8d11f8ea03f6520f3f59cf26985d5b42257e",
            "ver": 1,
            "vin_sz": 3,
            "vout_sz": 2,
            "lock_time": 0,
            "in": [{
                "prev_out": "06ea36a6b9cf2ebc18309cff2d53f3cd1c02bed81f38e5fa8f4a4e8493205324",
                "n": 1,
                "scriptSig": "304402202a9d6eafce7aae0ea8dda87dfce9c4943805f606016d497af0964fa1eacf045102206789505d05cb67116355efe7762e33d199e5e2d9f887de9cad6324e6d006663001 042ebba781cb9de59cd85c5771432e47181335dd46f4f519ef11151113ef2e3b7eb3f5212b8cc27f30ae38e25e83f2899976aae12315b4bd90976d3dda48300210"
            }, {
                "prev_out": "222aea682ff6b6c1c0e18cb42c1f2ca36ed27c0ff1281028fa04338be4ce3c1e",
                "n": 1,
                "scriptSig": "3045022100848003cd025ffcd3ffb8a4522679e307b8c2325b67dea904e17c753ccbc373cb02203f8f980cba48a2f648c110b5dfe9d1ab2095bd6baafd47c0038c6285e7738b3801 04eb92676fef11a618025af7fed4d2b47c7659c8078e86b95a22b0b2c5506d5c566720f7baf017f6283413d7b3c904ad4a6547d8d9b85f2f5d5803920688b354d1"
            }, {
                "prev_out": "dceb52e39004673de10d00f6eb43034c4219e010c62bacee8991b8c232e26339",
                "n": 1,
                "scriptSig": "3045022100c39c1c47acb247c22fd522b28ee110c24a560ef5691af585579e5fa7b6c7c192022031dd0259b19dbc7e6319214d1ca663483e7d61402cc89d9b9795397e57175ba301 04ee6df0f681c7681b9d45f5d20ecdc7087abce4ad941e94b723fd232615a3755c9d69b38be8e85d0135d35b1e5304924a0be6a8d3dcc5974de7f39bc4b2a53480"
            }],
            "out": [{
                "value": 0.04000000,
                "scriptPubKey": "OP_DUP OP_HASH160 5891e124c37b7c7224ed831dd1fc1e4f43aa6553 OP_EQUALVERIFY OP_CHECKSIG"
            }, {
                "value": 1.00000000,
                "scriptPubKey": "OP_DUP OP_HASH160 7d2d5970466f727e4b76850312b934e58e7366e7 OP_EQUALVERIFY OP_CHECKSIG"
            }]
        }, {
            "hash": "5098dfcb191780d0fae664c879ec6ea9e489d2adc73807a43fe26b685135e720",
            "ver": 1,
            "vin_sz": 1,
            "vout_sz": 2,
            "lock_time": 0,
            "in": [{
                "prev_out": "3a0bfe363a19ffce511144830299a1b1ea167182772daabad63fff3dd33cdf64",
                "n": 0,
                "scriptSig": "304502205cb23da1f36bc5935a9f3b3dde19fad4702ff1d2598a5496defd6ac69d38fa67022100ea5faa87832465eabc3677bd20508402292628367f84ba5bf9bc3c0a50ac139101 043a236eb9b7453d39655935ca2c4052f0f56370fcf648f5726026fc8c18469f2a8dd49e6fd08c302d60dc6a4c4aa75ad5a8a761acaec7095ce296f776f666ec2f"
            }],
            "out": [{
                "value": 0.44000000,
                "scriptPubKey": "OP_DUP OP_HASH160 941656bce3375c294ff5c332d197719fa0a10ea8 OP_EQUALVERIFY OP_CHECKSIG"
            }, {
                "value": 28.20239771,
                "scriptPubKey": "OP_DUP OP_HASH160 96ad43eced787e464d1672092bbf8a5ed9f4ee2a OP_EQUALVERIFY OP_CHECKSIG"
            }]
        }, {
            "hash": "004a005e475cd171b6a151ab4d02989a9ae7fc4eaee32094f82f3f93b9299ca9",
            "ver": 1,
            "vin_sz": 1,
            "vout_sz": 2,
            "lock_time": 0,
            "in": [{
                "prev_out": "176cade937d0a8eac8fc7792a561bc167306c5781b02619c75531a6286e189f1",
                "n": 1,
                "scriptSig": "304402204156ac094e95c55d38ea58314f159da2c06d4fa441e3af803b5977541731c56e022005e2f58b98086f5d70c7a6c0d2e20eaf7a08662f5f68caa29ecd456aa77fa2d101 045d2324c6531101888d4f9434be8664fbd01964bf2596fe4bd1df0b0bb1ea336484423af7b982be618d5e33cdf55d70a6113627a7dff6b617815e52162259c94e"
            }],
            "out": [{
                "value": 0.11000000,
                "scriptPubKey": "OP_DUP OP_HASH160 5aad12807f1101086b44dd4a8c15e0ff37b390a7 OP_EQUALVERIFY OP_CHECKSIG"
            }, {
                "value": 0.20000000,
                "scriptPubKey": "OP_DUP OP_HASH160 e46fbf8373de205e6c5a6df751cd3d9d818d92e3 OP_EQUALVERIFY OP_CHECKSIG"
            }]
        }, {
            "hash": "0d8ff8632d665295dd404452e6a7481d6649240c217f70aa11d9fea09c880831",
            "ver": 1,
            "vin_sz": 1,
            "vout_sz": 2,
            "lock_time": 0,
            "in": [{
                "prev_out": "a3e3e29fb3314b7fafafa92b3b65c9e0b3f73e60b935720311e176c591d867f0",
                "n": 0,
                "scriptSig": "3044022068e7f1e5e536eb1e848652609fd7a8344c49e0f7b49009ea49570f6b3ce2201a02204f3ed5a7523f73db0d9fbeb0d9050418f1fac04cf2992b0c0388d6edc3b8551a01 0409afc6bcc8cb8f308d1bf7ec9babbab4c346e232cb3603b4783ac05fae15f41ac48e19011ac7a8e4b1d8bee79820608ef199aad079bca0de2238a0f1415eb381"
            }],
            "out": [{
                "value": 26.33584204,
                "scriptPubKey": "OP_DUP OP_HASH160 fb78618baee799e576a881e27c2b6c7358966d1c OP_EQUALVERIFY OP_CHECKSIG"
            }, {
                "value": 0.17000000,
                "scriptPubKey": "OP_DUP OP_HASH160 36075808d9110c69de695ec11e1b2e642a88dc18 OP_EQUALVERIFY OP_CHECKSIG"
            }]
        }, {
            "hash": "f54ff8dfab502910191c011cac2180b34bb222cc7e882f023e61e035f181866c",
            "ver": 1,
            "vin_sz": 1,
            "vout_sz": 2,
            "lock_time": 0,
            "in": [{
                "prev_out": "34216c42b8c90aa2c48a84bba0be39c19ca5418d69013a14d9547d459985bfca",
                "n": 1,
                "scriptSig": "3045022100edda8d04f6ec80df3b30046e00a6c9adb1c61b5ca8eea213ef48f74114d693df02201530aa5f0aec7e78c1dfdf3634e629f0ca005b6216f99e7d80396cd65e07750b01 044ba927bf00b7849990b421f0d91848ac7e466ee21ac3a2910058bdada48eed9d2d3aaf0de3779c8c8541c317f0679edd5214a0108842b6ed698e3ae35b0df4df"
            }],
            "out": [{
                "value": 0.18000000,
                "scriptPubKey": "OP_DUP OP_HASH160 f14dc5847f0b16a2343663a052a2aae15d89e466 OP_EQUALVERIFY OP_CHECKSIG"
            }, {
                "value": 0.39228740,
                "scriptPubKey": "OP_DUP OP_HASH160 2a88731c1dc4a6fa586370396a1077f146276c26 OP_EQUALVERIFY OP_CHECKSIG"
            }]
        }, {
            "hash": "11609365b72c5dd4b294f2bd076452bc74d638dbf529f826da390cd02a22c0a7",
            "ver": 1,
            "vin_sz": 1,
            "vout_sz": 2,
            "lock_time": 0,
            "in": [{
                "prev_out": "080079e03476056cad948e054da87a676b8a40e664067c20d30ff16d03f7ed0a",
                "n": 0,
                "scriptSig": "3046022100b136a562f70bb7b6fa245976ac89778682d7f18b35bbc6da0edb1c5aec26f6e7022100e1b2f2559557947642f5927d962941bb9cf41fe1dfda9e144629765079488b1101 04b2fab0ddcff6a03dc2c7da4b8c3253abcd65c22c4a0497a7e33abd211472efd97d2338d3fb92295ee618ddc0516aaf30ed9299701fa21d43c3ad9263e894fa61"
            }],
            "out": [{
                "value": 0.37166362,
                "scriptPubKey": "OP_DUP OP_HASH160 374b3164f0655b74d82da36a5040e268b46d2296 OP_EQUALVERIFY OP_CHECKSIG"
            }, {
                "value": 1.85183405,
                "scriptPubKey": "OP_DUP OP_HASH160 e0649121d21dc6d59d416d925a532fcb7670135b OP_EQUALVERIFY OP_CHECKSIG"
            }]
        }, {
            "hash": "40e3b930fb43be70cd9241c3849679cbae023f38182afdf1948a90edb9724c5f",
            "ver": 1,
            "vin_sz": 1,
            "vout_sz": 2,
            "lock_time": 0,
            "in": [{
                "prev_out": "6dbd606b99d362553295fb80672ba1d78025a8b5e04bf3c3d58d395298ab044a",
                "n": 0,
                "scriptSig": "304402207d9870c85204f00f08b6b1f3ba8fb7061cc64a37b0e735623cf884961fd12cb702204910779e4804197b0c1a8f10c1321d08980df81792fcbf21871fc22d16c4552601 04a39b9e4fbd213ef24bb9be69de4a118dd0644082e47c01fd9159d38637b83fbcdc115a5d6e970586a012d1cfe3e3a8b1a3d04e763bdc5a071c0e827c0bd834a5"
            }],
            "out": [{
                "value": 46.87000000,
                "scriptPubKey": "OP_DUP OP_HASH160 0568015a9facccfd09d70d409b6fc1a5546cecc6 OP_EQUALVERIFY OP_CHECKSIG"
            }, {
                "value": 1.02000000,
                "scriptPubKey": "OP_DUP OP_HASH160 26678a04219946d2230fa886a5023743fa0825d2 OP_EQUALVERIFY OP_CHECKSIG"
            }]
        }, {
            "hash": "3863ab484aeda88ad8629477b4aedf605565ba51c148daf664928f402cdd1f48",
            "ver": 1,
            "vin_sz": 1,
            "vout_sz": 2,
            "lock_time": 0,
            "in": [{
                "prev_out": "0524d6503933a96e5339731be9befcd74888808a464eb2230980f7b9fd126baf",
                "n": 0,
                "scriptSig": "3045022100dd6fb2bc7e2b42f2384c0314ebda145724b1e6648579fc1bf7c6de949376c2d102204abddac0774c52907271ee1c79bdd664e6e60864c9003f7382b12fd5e5ee641001 04a39b9e4fbd213ef24bb9be69de4a118dd0644082e47c01fd9159d38637b83fbcdc115a5d6e970586a012d1cfe3e3a8b1a3d04e763bdc5a071c0e827c0bd834a5"
            }],
            "out": [{
                "value": 46.48100000,
                "scriptPubKey": "OP_DUP OP_HASH160 0568015a9facccfd09d70d409b6fc1a5546cecc6 OP_EQUALVERIFY OP_CHECKSIG"
            }, {
                "value": 0.39000000,
                "scriptPubKey": "OP_DUP OP_HASH160 4023432360fc5b1e25269001d125a0e5faa4545c OP_EQUALVERIFY OP_CHECKSIG"
            }]
        }, {
            "hash": "035ef102ab8eaf9d050600ccd1ca69788d078a7aab34a094e025b5eeb71de7cd",
            "ver": 1,
            "vin_sz": 1,
            "vout_sz": 2,
            "lock_time": 0,
            "in": [{
                "prev_out": "f5c398dcdb1dcd81789a4646b773d245137690d16063492935dd06f999810822",
                "n": 0,
                "scriptSig": "3046022100d80b132783f1d6cc91e80b0b4e8373299a3f739b8c9a2a2f97184bb48240e975022100f59cdb873f9815632164bed8c10fbac2eb6c82f11fc22b27f253aacce198d25301 04a39b9e4fbd213ef24bb9be69de4a118dd0644082e47c01fd9159d38637b83fbcdc115a5d6e970586a012d1cfe3e3a8b1a3d04e763bdc5a071c0e827c0bd834a5"
            }],
            "out": [{
                "value": 45.35752499,
                "scriptPubKey": "OP_DUP OP_HASH160 0568015a9facccfd09d70d409b6fc1a5546cecc6 OP_EQUALVERIFY OP_CHECKSIG"
            }, {
                "value": 0.67000000,
                "scriptPubKey": "OP_DUP OP_HASH160 f262db5ba802742bf88b06c4fd727a7b3d5f9c8f OP_EQUALVERIFY OP_CHECKSIG"
            }]
        }, {
            "hash": "bc9f26d7b2fffe0258c72a492aaf876fbaafe2a09ed68ed66ad9d833872020ee",
            "ver": 1,
            "vin_sz": 2,
            "vout_sz": 2,
            "lock_time": 0,
            "in": [{
                "prev_out": "e3ed95d86176b88f68be3a519e0ab08a46927634c99c138042a62fa072fee632",
                "n": 1,
                "scriptSig": "3045022100f384c6eb978ef69c6ff611c3b77ce2c7078d17b2ea7acd8167caa4b492457cd4022012818b3bfad32e924e2c99de38059cddded074a07497646dca554f60ace1783901 0452370553cc6d352f65476dd148272e8303fbbd0e26b24003d0e5eb9c97a434475ba57f51227a228b50e28553bf161fea6572dfab81795e296d901842cd37e142"
            }, {
                "prev_out": "d8ceee26c260b24b08642340e8b141fdd2dcaf8d23f01cd5e6242f7d36e6bed0",
                "n": 1,
                "scriptSig": "304502200af9ca1504038a6591e8c6bedcd4652a7c58a05faa5c63b8082282250303cd2802210082e98aca079137fb0d7f752e07d08d647c584c0553709123035e386aae39097601 0452370553cc6d352f65476dd148272e8303fbbd0e26b24003d0e5eb9c97a434475ba57f51227a228b50e28553bf161fea6572dfab81795e296d901842cd37e142"
            }],
            "out": [{
                "value": 0.00950000,
                "scriptPubKey": "OP_DUP OP_HASH160 9c84b1799178d1ef85c0a1c3940c3b85aa891cb5 OP_EQUALVERIFY OP_CHECKSIG"
            }, {
                "value": 1.56000000,
                "scriptPubKey": "OP_DUP OP_HASH160 f38aa32fb97a7964d6134ef48c698de46cf01fe7 OP_EQUALVERIFY OP_CHECKSIG"
            }]
        }, {
            "hash": "89f07a36414a688f89f345cfbd64aed3d6974ff7a114a16ae47342cd82b67672",
            "ver": 1,
            "vin_sz": 2,
            "vout_sz": 2,
            "lock_time": 0,
            "in": [{
                "prev_out": "2588e6e176b7faa196fac03ca52b89ae886085a234214af35f84968be50946fa",
                "n": 1,
                "scriptSig": "3045022051baa9121e9098653646e3f2763c82f7346d5c492948a696429ef7b52412ae0c022100efa3f8f4c155e3f97b663c29b0eabf32062c6bdcb9c4c49c5938450f725605be01 04537700132bf05cc2df038ec4588f2299352dc5909b7cc0f5e4d3a3073f9ca4fb75f9bfc2186538c86223ac673bee3f0c144f90df1e0de06d0b59862aa013c9f6"
            }, {
                "prev_out": "e55960fa6db46cf2142669d25ccf9c353bf5ba618756869d2bb03d579a093b34",
                "n": 1,
                "scriptSig": "304402204de35c4994484ffc32605a9ede6f1002b42410960084d346829438fa4bf73f3402202351275c9da266e4a0c6d8e0f046d56ab7e8c51d46619a02791e49b77841d1d201 04b75f55f7c03bbd652b6f3766270a01bd596122ea829c7346739dd30ff63f9b161ff44388e003d88fbf1c97883a571c7762644227c34105130d4641a3da8fc4d5"
            }],
            "out": [{
                "value": 0.02826857,
                "scriptPubKey": "OP_DUP OP_HASH160 2e6415a8fcbcfe838b56d5ddd8152bca82174896 OP_EQUALVERIFY OP_CHECKSIG"
            }, {
                "value": 0.80000000,
                "scriptPubKey": "OP_DUP OP_HASH160 ca16f76e68fa118d6df00e25793f39cfab557935 OP_EQUALVERIFY OP_CHECKSIG"
            }]
        }, {
            "hash": "7f41577397833ded61863d899af65672cc7ffea7bfae0dcced7938dc48596cad",
            "ver": 1,
            "vin_sz": 22,
            "vout_sz": 1,
            "lock_time": 0,
            "in": [{
                "prev_out": "877e2172990b3e1f019c8ccf4e34b0aed52f8d4cdd035bccbe19056a032fe602",
                "n": 1,
                "scriptSig": "30450221008bd8e16392c1707901a4d1dc975a446e2863e5bc65b31d36cacbae23a7c9bf7202204b0069cfd029cda03e1f4a752f81dd7d9f734108eafd1835b1bc38b5005eacbe01 04e35c414a68499e529ef65123b33cd84702e7f6d0b2fa18ccbe6702b98157bfbad5099e685189084d8bbca21b86583af7ee106cb382378c49815e6b43c4e83384"
            }, {
                "prev_out": "5b48153fef6a61a52c4f6dfaea5ad85126901599c8d6ede26c57442f94a24800",
                "n": 1,
                "scriptSig": "3046022100eb04081204684d14d2f607e664110f523daf4d016680591465de15f91235dd70022100ee05aa277284cd136a7aadf4596d3fa8cfaaea55f3874b3397abb2216f3d303401 04e35c414a68499e529ef65123b33cd84702e7f6d0b2fa18ccbe6702b98157bfbad5099e685189084d8bbca21b86583af7ee106cb382378c49815e6b43c4e83384"
            }, {
                "prev_out": "adc67f0adea0b0c21ea54782d9817335cf7b76b561993820297566dc5a663e12",
                "n": 1,
                "scriptSig": "3046022100a0257a6d0812ba09f6fb89830ab150fd491acc6d3d5441db84599d6f1250c191022100c64f5206b7c72931ddba5ab85a8dd677edfb174e68c00abda9938565f04e134801 04e35c414a68499e529ef65123b33cd84702e7f6d0b2fa18ccbe6702b98157bfbad5099e685189084d8bbca21b86583af7ee106cb382378c49815e6b43c4e83384"
            }, {
                "prev_out": "bff54e3b069ab16db484fb9aa66ef829251e64fc838bd7cf8fda69aa6500eeae",
                "n": 1,
                "scriptSig": "304402206cad5548f44cb8143c9dd60c6660afc9af406a6e61c84bef86f7b2251035dc3e0220093755fa08a6ae5329d65b132065fc72dfef911cc8c3de5d8fa250ecfd6e3f3401 04e35c414a68499e529ef65123b33cd84702e7f6d0b2fa18ccbe6702b98157bfbad5099e685189084d8bbca21b86583af7ee106cb382378c49815e6b43c4e83384"
            }, {
                "prev_out": "4ca3fe99e2d0f44fa464365658b1a1af334a21893493c51b778e08ab43ca26af",
                "n": 1,
                "scriptSig": "3046022100911fddaf885b44f496c69cfdedad81ac32d0a6d78b9a9f9ac6b0169126b651cd02210092e9e84a20d68c5340f1be72a56b10f91e22fbe31d5e68223de4f7cef4322f6201 04e35c414a68499e529ef65123b33cd84702e7f6d0b2fa18ccbe6702b98157bfbad5099e685189084d8bbca21b86583af7ee106cb382378c49815e6b43c4e83384"
            }, {
                "prev_out": "2f8d5ec088229837f1ce4df910061055abf03f11a8bce991119b651e3003c5b6",
                "n": 1,
                "scriptSig": "3046022100ac99eadb68f2775983f7611810aac026b2a7e41d1122d9b3acf25b2bc8d48a94022100b4e1945293b9b28045b03a013f0308735f8e6838369ced4f21fea65f008cbd6501 04e35c414a68499e529ef65123b33cd84702e7f6d0b2fa18ccbe6702b98157bfbad5099e685189084d8bbca21b86583af7ee106cb382378c49815e6b43c4e83384"
            }, {
                "prev_out": "c89c0d2ab359e95cd3b85823550fae7c5aec011cc50c65beed192fa7699139c2",
                "n": 1,
                "scriptSig": "3045022026d82a7de39cb03688fd96f547522f48f0460b5479b9d36a8798c0dc8e6a33e2022100ad6e8f35fd249655b2ed69671922ab2a233c8182fe67539565489033243dcdcf01 04e35c414a68499e529ef65123b33cd84702e7f6d0b2fa18ccbe6702b98157bfbad5099e685189084d8bbca21b86583af7ee106cb382378c49815e6b43c4e83384"
            }, {
                "prev_out": "5d18759627823279854885f5f10a53cf71f67fcea33ee731e7dda4c9275d7fcc",
                "n": 0,
                "scriptSig": "3046022100808306c0990347f125c9483d0e8079656aeb77ee4bb4d5a7afa22b37fc08f649022100bd812b9ca8da6f89c860d4fd2cb51a90a50660de746555687f4755436ec9c3a401 047f19808e82d91dac8990decec451ac3ce61a509d0c37688b9b3af7d1fc85194fd781b9c480a8a63c74353a6fdeff941a3ea67a30c0474a55ff4763dbec6d8862"
            }, {
                "prev_out": "99b838c88d7215563ebae709c7d4233ee176d60086c4373a54b74dc6b3b0fbe2",
                "n": 1,
                "scriptSig": "3045022100f81df9b95c2f65b779b568e7981cc005b29c60422b6eca529ffc33c77a4bbbeb0220411c5705e0588b5d4aa6be386bafb85134d7c127891fd27a85c3e4f1cda2d63401 04e35c414a68499e529ef65123b33cd84702e7f6d0b2fa18ccbe6702b98157bfbad5099e685189084d8bbca21b86583af7ee106cb382378c49815e6b43c4e83384"
            }, {
                "prev_out": "6bb3c9d969b653bca1c48d8c1e0f09dad6a41d31797121df6c83445ec3304dee",
                "n": 1,
                "scriptSig": "3046022100d2710c5d4cd41995fc14ac6116db2264abfad6e3f22f5fd49b7cd54b01154f27022100d779147cdc814e813e32170a3074b64679d94cb2dc1373c6e4e0ffdc7cd9ba2701 04e35c414a68499e529ef65123b33cd84702e7f6d0b2fa18ccbe6702b98157bfbad5099e685189084d8bbca21b86583af7ee106cb382378c49815e6b43c4e83384"
            }, {
                "prev_out": "9dca18148757d15d17c0e0954f3af32bb89c48e73017df1dc8947b8fa14c6820",
                "n": 1,
                "scriptSig": "3045022100d53d3037f67e9fc253d439e3723b54a0d6e527762ab199bfe014307cfffd5bf3022042e46b3de55fe730a5774fde0e5e53440b8a476928c00a626ad0932676e2592901 04e35c414a68499e529ef65123b33cd84702e7f6d0b2fa18ccbe6702b98157bfbad5099e685189084d8bbca21b86583af7ee106cb382378c49815e6b43c4e83384"
            }, {
                "prev_out": "506289f3e1498ea6b0f3ba6362a3948914ba620fecf9af3941faf26a5c1fc428",
                "n": 1,
                "scriptSig": "3046022100e65b980daa644228dcb2bc8052a7423e43382be4357fef3818a445794e408136022100ac4799dde0af7045dc13201dd7fd98c1c71fa0f81644a1a5ba0af4847ff1c4b301 04e35c414a68499e529ef65123b33cd84702e7f6d0b2fa18ccbe6702b98157bfbad5099e685189084d8bbca21b86583af7ee106cb382378c49815e6b43c4e83384"
            }, {
                "prev_out": "ba9475f0b5bee0162fa8386b04183c031be86ea92ceaa8e1d1e5d94affe3b460",
                "n": 1,
                "scriptSig": "304402207a53f8d2b30a81c246ff115168eb407e34a123e15ae3680860fefcc3499a6aed02206a399ea6c7c8b9559eb1cf0e5b0d09443c41245fa621abbcce45bbf4a5e37c5201 04e35c414a68499e529ef65123b33cd84702e7f6d0b2fa18ccbe6702b98157bfbad5099e685189084d8bbca21b86583af7ee106cb382378c49815e6b43c4e83384"
            }, {
                "prev_out": "ac4af318de97f5f666d1734ae129b5137cae138409d6589d72cafcbf2083d369",
                "n": 1,
                "scriptSig": "3045022100de12d38ecc38b73de9485d4235c31248be239248dc6cffa05e3e666a77829b5702207e8a939ab661ee0b4a3b79acc19e1c92ffa739aeeb85d5a2f2b9b1e6fc92b5ee01 04e35c414a68499e529ef65123b33cd84702e7f6d0b2fa18ccbe6702b98157bfbad5099e685189084d8bbca21b86583af7ee106cb382378c49815e6b43c4e83384"
            }, {
                "prev_out": "5ef12780842fe644bfb960a14edface041ca4d74b3ba9e556c71d9915a89237a",
                "n": 1,
                "scriptSig": "3045022100e54ce1cdad833d21be8ee58f3ea49cb4ee7a6c909bc85abd8fb0b660916040b102205b6475f4fe47b1d30247ae833264fda102a306dd20ce06d7db4575f8f782b58901 04e35c414a68499e529ef65123b33cd84702e7f6d0b2fa18ccbe6702b98157bfbad5099e685189084d8bbca21b86583af7ee106cb382378c49815e6b43c4e83384"
            }, {
                "prev_out": "ec3f028b14c0c3b6292333def50fff73c696742d71800adf596abf723f3e247a",
                "n": 1,
                "scriptSig": "304402204357211cbed04aa09007b4394b9e7f9a0e383021660e5b246c7356db12287a0e022037a97f3768cdc5466b59b931015665af57d5b7d1af9a73d0af1a78210a8eda0001 04e35c414a68499e529ef65123b33cd84702e7f6d0b2fa18ccbe6702b98157bfbad5099e685189084d8bbca21b86583af7ee106cb382378c49815e6b43c4e83384"
            }, {
                "prev_out": "7ca09d1f674e49650f383b512e7d8409e402ef27e3992e172760dcefb638498a",
                "n": 1,
                "scriptSig": "304602210085430df971ce86de035afdc21f693527ba2ffd243f4613b450a8abd03186ce0c022100cede118d4b01192bf021f4533f682ae139cbce3b17768784580e5d2c3aae289e01 04e35c414a68499e529ef65123b33cd84702e7f6d0b2fa18ccbe6702b98157bfbad5099e685189084d8bbca21b86583af7ee106cb382378c49815e6b43c4e83384"
            }, {
                "prev_out": "35f9531358e77330b2d09a1f4c0f27e09f2dcbf4cde1b1d9d68104e9eba2e69e",
                "n": 1,
                "scriptSig": "3046022100b2da03c7cc12e0c9e3cd72172e8596f13103d5b6b2490ac5e29b8dee1ff958d7022100897277b4744513411a7e19a8864280d1796848c8c3949a295d0566c6438787f501 04e35c414a68499e529ef65123b33cd84702e7f6d0b2fa18ccbe6702b98157bfbad5099e685189084d8bbca21b86583af7ee106cb382378c49815e6b43c4e83384"
            }, {
                "prev_out": "31df14b21226251a4511c069bb400872e5dca7462f0126ab1660dfa632013a01",
                "n": 1,
                "scriptSig": "3045022100af9dc3433417cb3c8690fe3ee6e40f8208aa7ae9d0d12200f8d9cc9fc14c0493022016f6803bc1c69f87abd3571e92baa938706ace192e4745a99f1ebca637b3c11f01 04e35c414a68499e529ef65123b33cd84702e7f6d0b2fa18ccbe6702b98157bfbad5099e685189084d8bbca21b86583af7ee106cb382378c49815e6b43c4e83384"
            }, {
                "prev_out": "58383fe84d9fca86cf9cfd6a0c8f681aa171ddc117794daf7985a435145a2579",
                "n": 1,
                "scriptSig": "3045022100ba7f84d3923a9e794af8705822a8d44856b6498d2ab2d05a766db17046b06bc2022063177710d3046d0c75a05fbf356c2ff17f86fafbe7d402c7f4774fa8c456554c01 04e35c414a68499e529ef65123b33cd84702e7f6d0b2fa18ccbe6702b98157bfbad5099e685189084d8bbca21b86583af7ee106cb382378c49815e6b43c4e83384"
            }, {
                "prev_out": "de21a6cb8206c0ce3b6455d9af35259da1ba633da17f1c8f559b108ec6893b0a",
                "n": 1,
                "scriptSig": "3046022100cb2e2a1714dd04ad7c46dbd3461d2bbd78a0b1a060a46307c67b5eab045519d002210090d3b8a1a1d70a7b0a2c0b29b200734114fe199d1979757321ffccc6f7ff49a001 04e35c414a68499e529ef65123b33cd84702e7f6d0b2fa18ccbe6702b98157bfbad5099e685189084d8bbca21b86583af7ee106cb382378c49815e6b43c4e83384"
            }, {
                "prev_out": "6451a1882382e724c4cb7d9d1831847f82d52addb7027e78c7ad12bece6fd652",
                "n": 1,
                "scriptSig": "3045022100aec6c8d25d9043bbac33a3e316cb4b6eb9760eadeba6457625d69ecc27650dbe02207f9d58dfd93075a6debe1752dc6ae33760995ad4bc114fc482598bd62f24e3cd01 04e35c414a68499e529ef65123b33cd84702e7f6d0b2fa18ccbe6702b98157bfbad5099e685189084d8bbca21b86583af7ee106cb382378c49815e6b43c4e83384"
            }],
            "out": [{
                "value": 0.67000000,
                "scriptPubKey": "OP_DUP OP_HASH160 138505e0101ae7b0fca439ef2e9f88a25e530fbd OP_EQUALVERIFY OP_CHECKSIG"
            }]
        }, {
            "hash": "9cc60a7d2105699b5f9642939f458e58bc01d97a3935d642cd259f9f2171341e",
            "ver": 1,
            "vin_sz": 2,
            "vout_sz": 2,
            "lock_time": 0,
            "in": [{
                "prev_out": "edee1d56e10bf099608ff0e1dec4b485a4190edfaa6cb86b7fc36863ed22aade",
                "n": 0,
                "scriptSig": "3045022100c4cac1e3b75d49e8aaf401e0bc41de372e5890f4346e1b4d497d800488d7e4040220297a9513db31108ac07e8bf9f009a71ce76929715df6a19c2e316da4e74e0a3201 0207417a41c3757047665088f28bb3c3feb588486c121315720442ceaade4500de"
            }, {
                "prev_out": "1b47f179a9b0fb4d7b8113d09b4d35b88a87890322cc04d97ec6fb67e6388fc7",
                "n": 0,
                "scriptSig": "3044022053a50932eaed4f5826f05b7267b5b4d79423feda98693a6cccce9abd3492116402200884500bdace48c6d143aba7ba6bf4af9b3d7bc1c191e5591d690fec7554a48101 0239f3efe44b0307bec058ebe04ad2dd6c28c8def95d2f5d112daff05b654481fe"
            }],
            "out": [{
                "value": 0.01093466,
                "scriptPubKey": "OP_DUP OP_HASH160 40a067a40fec77927f3667964b1b0365aded4e25 OP_EQUALVERIFY OP_CHECKSIG"
            }, {
                "value": 0.01011013,
                "scriptPubKey": "OP_DUP OP_HASH160 6ab3e08f9d6ebd308237e1aca455e860f3f77fa1 OP_EQUALVERIFY OP_CHECKSIG"
            }]
        }]
    }],
    "id": null
}


Title: Re: [PAY] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: MORA on January 23, 2012, 10:48:53 AM
Code:
$arr = json_decode($json);


$data = $arr->params;
    $bc = new Bitcoin();

foreach ($data as $tx)
{
        $outputs = $tx->out;

        foreach ($outputs as $output)
        {
                $value = $output->value;
                $script = $output->scriptPubKey;
                $scriptparts = explode(" ", $script);
                $hash = "";

                for ($i=0; $i<count($scriptparts); $i++)
                {
                        if ($scriptparts[$i] == "OP_HASH160")
                        {
                                $hash = $scriptparts[$i+1];
                                break;
                        }
                }

                if ($hash != "")
                {
                        $address = $bc->hash160ToAddress($hash);
                        echo "Payment to $address of $value BTC \r\n";
                }
        }

}

Payment to 1VayNert3x1KzbpzMGt2qdqrAThiRovi8 of 150.10960597 BTC

:)


Title: Re: [PAY] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: stcupp on January 23, 2012, 11:20:35 AM
nice lol I know that address from this thread:

https://bitcointalk.org/index.php?topic=53892.0

I had no clue that transaction was that address i didnt try converting it to an address

its deepbit's change address


Title: Re: [PAY] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: MORA on January 23, 2012, 05:44:19 PM
How do you tell bitcoind where which url to call ?

I tried to add in config
monitortx=true
monitortxurl=http://127.0.0.1/tx.php
monitorblock=false
monitorblockurl=http://example.com/foo.php

And also on command line
./bitcoind -debug -printtoconsole -monitortx=true -monitortxurl=http://127.0.0.1/tx.php

But didnt seem to work.


Title: Re: [PAY] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: stcupp on January 23, 2012, 05:49:11 PM
how did you build it? if you used gitian then you might of not built it from the right source i had a little trouble setting it up but finally got it i can give you directions or i can build it for you....


Title: Re: [PAY] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: stcupp on January 23, 2012, 06:06:29 PM
you can check if you built the right source by looking in your debug log first delete the old one then start up bitcoin and search for Threadhttppost starting if its not in there then you didn't build it from the right source

gitian doesn't build any of the sources from your HD it runs a virtual machine and downloads the source to build from github so if your using gitian you need to edit:

for linux build:
bitcoin/contrib/gitian-descriptors/gitian.yml

for windows:
bitcoin/contrib/gitian-descriptors/gitian-win32.yml

change "https://github.com/bitcoin/bitcoin.git"
to "https://github.com/stcupp/bitcoin.git"

 and run these commands to build:

Linux:

Code:
./bin/gbuild --commit bitcoin=master ../bitcoin/contrib/gitian-descriptors/gitian.yml
   ./bin/gsign --signer MORA --release master --destination ../gitian.sigs/ ../bitcoin/contrib/gitian-descriptors/gitian.yml
   pushd build/out
   zip -r bitcoin-master-linux-gitian.zip *
   mv bitcoin-master-linux-gitian.zip ../../
   popd

Windows:

Code:
   ./bin/gbuild --commit bitcoin=master ../bitcoin/contrib/gitian-descriptors/gitian-win32.yml
   ./bin/gsign --signer MORA --release master-win32 --destination ../gitian.sigs/ ../bitcoin/contrib/gitian-descriptors/gitian-win32.yml
   pushd build/out
   zip -r bitcoin-master-win32-gitian.zip *
   mv bitcoin-master-win32-gitian.zip ../../
   popd


Title: Re: [PAY] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: MORA on January 23, 2012, 06:31:14 PM
I used

git clone https://github.com/stcupp/bitcoin
cd bitcoin/src
make -f makefile.unix USE_UPNP=         
./bitcoind ...

Code:
ThreadHTTPPOST started

Where should I define url/true config or cmd line ?


Title: Re: [PAY] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: stcupp on January 23, 2012, 06:41:51 PM
when i did my tests i used the command line it should work either way though

heres exactly what i used -monitortx -monitortxurl=http://192.168.1.119/testpost.php


Title: Re: [PAY] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: stcupp on January 23, 2012, 06:45:36 PM
btw is your blockchain fully downloaded? I noticed that when the blockchain isnt fully downloaded it wont ask for tx from other clients because downloading the blockchain is more important

and whats the script your catching the data look like?


Title: Re: [PAY] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: MORA on January 23, 2012, 07:32:47 PM
ok, I used =true, with just -monitortx it seems to work, at least it calls my script :)

My script is
Code:
<?
mail("jkn@---.dk", "debug", print_r($_POST, true), "FROM: robot@me.net");

However it seems $_POST is empty, even though apache logs it as a post.

Code:
127.0.0.1 - - [23/Jan/2012:20:29:14 +0100] "POST /tx.php HTTP/1.1" 200 174 "-" "bitcoin-json-rpc/0.5.99-beta"
127.0.0.1 - - [23/Jan/2012:20:29:32 +0100] "POST /tx.php HTTP/1.1" 200 174 "-" "bitcoin-json-rpc/0.5.99-beta"
127.0.0.1 - - [23/Jan/2012:20:30:23 +0100] "POST /tx.php HTTP/1.1" 200 174 "-" "bitcoin-json-rpc/0.5.99-beta"
127.0.0.1 - - [23/Jan/2012:20:30:23 +0100] "POST /tx.php HTTP/1.1" 200 174 "-" "bitcoin-json-rpc/0.5.99-beta"


Title: Re: [PAY] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: stcupp on January 23, 2012, 08:04:25 PM
try using
Code:
$example = file_get_contents('php://input');


Title: Re: [PAY] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: MORA on January 24, 2012, 11:10:32 AM
Ok, that works :)
Since its a raw post and not contained in a variable.

I am currently waiting for trade to be fulfilled, and will then pay, should happen today (if he/she is honest :o).
Have you released the code into GPL, maybe its implied when forking on github and comitting changes ?


Title: Re: [PAY] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: stcupp on January 24, 2012, 11:39:43 AM
Ok, that works :)
Since its a raw post and not contained in a variable.

I am currently waiting for trade to be fulfilled, and will then pay, should happen today (if he/she is honest :o).
Have you released the code into GPL, maybe its implied when forking on github and comitting changes ?

I just left all the bitcoin licensing and copyrights in the fork

I think bitcoin is under the open source MIT licensing


Title: Re: [DONE] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: MORA on January 24, 2012, 01:05:58 PM
Right its MIT license, no problems, I confused it with another project that is GPL.

I should get a unconfirmed notification system working on BPN later today.
Payment sent :)


Title: Re: [DONE] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: MORA on January 29, 2012, 06:35:22 PM
After my existing block monitor crashed this weekend, I looked a bit into using your code for the block part.

From your JSON
Code:
        "hash": "000000000000029320c3dca1346bdfc5232d5a3c0c94b658443e00834e967e40",
        "hashprevious": "0000000000000b6e89bb00a92d1f75b327f1573f0625892f47ed4c1dd22b9537",
        "blockcount": 163481,

Maybe when a split happens, and it finally ends, hashprevious, will not be the block we got the last time, and that can be used to detect the new main branch.

Not sure about blockcount, if that is the blockheight, or just a number for the block internally to the bitcoind.

Your TX code is still running fine, I made a small PHP script to insert info into MySQL if its a monitored address, and then a cronjob monitors that table to send out notifications.

It could also be used to make a simpler backend for a webstore that sells upon unconfirmed/1confirmation, but still needs a bit of room/mem for the bitcoind daemon.


Title: Re: [DONE] Patch bitcoin v0.5.1rc2 to send a HTTP POST when a new block is accepted
Post by: stcupp on January 30, 2012, 01:57:51 AM
I wrote a php script that does something like this:

when a new block comes in check the database and see what the newest block is
if the database isn't caught up do a loop from the newest block in your database to the newest block in the bitcoin client
example:

Code:
for($i = $newest_database_block; $i <= $client_blockcount; $i++)
{
$checkhash = $bitcoin->getblockhash($i);
$block = $bitcoin->getblock($checkhash);
insert block data into database
}
the getblockhash rpc command will only give you hashes from blocks that are in the main chain

if the database is already caught up grab the last 10 blocks and do a loop in the loop check the hashes

example:


Code:
$result = mysql_query("SELECT * FROM `blocks` ORDER BY `id` DESC LIMIT 10");  
while($row = mysql_fetch_array($result)) {
$checkblock = $row['id'];
$checkhash = $bitcoin->getblockhash($checkblock);
if($checkhash != $row['hash']){
                        $block = $bitcoin->getblock($checkhash);
                        delete old block and put new block in
                        }
                }


this should keep the database up to date and eliminate orphans and split chains