Bitcoin Forum

Other => Beginners & Help => Topic started by: WorldOfBitcoin on September 25, 2012, 12:06:44 AM



Title: Looking for a line of code that will read transactions values on the blockchain
Post by: WorldOfBitcoin on September 25, 2012, 12:06:44 AM
and submit them into a SQL database.

Anyone got some good “for dummies” write ups on how to implement the blockchain.info api into a website like that?

trying to make sense of this
http://blockchain.info/api/blockchain_api


Title: Re: Looking for a line of code that will read transactions values on the blockchain
Post by: scintill on September 25, 2012, 02:03:34 AM
Use the json_decode (http://us3.php.net/manual/en/function.json-decode.php)() function.  Here's an easy way to copy-paste chunks of JSON into PHP:

Code:
<?php
var_dump
(json_decode(<<<JSON
{
"hash":"b6f6991d03df0e2e04dafffcd6bc418aac66049e2cd74b80f14ac86db1e3f0da",
"ver":1,
"vin_sz":1,
"vout_sz":2,
"lock_time":"Unavailable",
"size":258,
"relayed_by":"64.179.201.80",
    "block_height": 12200,
"tx_index":"12563028",
"inputs":[


{
"prev_out":{
"hash":"a3e2bcc9a5f776112497a32b05f4b9e5b2405ed9",
"value":"100000000",
"tx_index":"12554260",
"n":"2"
},
"scriptSig":"Unavailable"
}

],
"out":[

{
"value":"98000000",
"hash":"29d6a3540acfa0a950bef2bfdc75cd51c24390fd",
"scriptPubKey":"Unavailable"
},
        
{
"value":"2000000",
"hash":"17b5038a413f5c5ee288caa64cfab35a0c01914e",
"scriptPubKey":"Unavailable"
}
        
]
}
JSON
));

Replace the stuff between <<<JSON and JSON with the JSON code.


Title: Re: Looking for a line of code that will read transactions values on the blockchain
Post by: WorldOfBitcoin on September 25, 2012, 02:19:52 AM
nice, will work on that.

I found a link on Websocket API
https://blockchain.info/api/api_websocket

going to read up on this, thinks its going to be the best route.