1

I've used this query to try to get all the transaction between two addresses:

https://blockchain.info/multiaddr?active=1EipJdYVJbqsTSQhj1icK424AkMbyjvgBm|1LWwLvKWbcpiZYqCcwfuQ3gjjNJkxftmEJ

but the thing is- according to my wallet there are many more transactions that aren't appearing in the json result here.

Why is that?

How can I see actually all of the transactions?

I though maybe blockexplorer would be better than blockchain.info, but actually- not so.

They have it as this:

https://blockexplorer.com/api/addrs/1EipJdYVJbqsTSQhj1icK424AkMbyjvgBm,1LWwLvKWbcpiZYqCcwfuQ3gjjNJkxftmEJ/txs?from=0&to=50

perhaps it would be better to just query by txid?

  • When you say "all the transactions between two addresses" do you mean you only want transactions where both addresses were involved, or do you just want all transactions from both addresses? – m1xolyd1an Dec 13 '16 at 16:56
  • the ones between then, but- also those that are not just bi-directional, but that also include maybe like- 1 to many others as well- but- at least those two – smatthewenglish Dec 13 '16 at 20:16
1

I don't believe you can do this with just a single API call. I'd return all the transactions from one of the addresses, and cycle through all the inputs and outputs and if they match the other address then show the tx data.

Not sure which language you're using but the logic should be the same.

<?php
$addr1 = "1EipJdYVJbqsTSQhj1icK424AkMbyjvgBm";
$addr2 = "1LWwLvKWbcpiZYqCcwfuQ3gjjNJkxftmEJ";

$url = "https://blockchain.info/address/".$addr1."?format=json";
$fgc = json_decode(file_get_contents($url), true);

//num of txs
$txs = count($fgc["txs"]);

//loop through all txs
for($i=0;$i<$txs;$i++){
    //check all inputs & outputs for the other address
    //inputs
    $numinputs = count($fgc["txs"][$i]["inputs"]);
    for($ii=0;$ii<$numinputs;$ii++){
        if($fgc["txs"][$i]["inputs"][$ii]["prev_out"]["addr"] == $addr2){
            //found a corresponding tx
            print_r($fgc["txs"][$i]);
        }
    }//end inputs loop

    $numoutputs = count($fgc["txs"][$i]["out"]);
    for($iii=0;$iii<$numoutputs;$iii++){
        if($fgc["txs"][$i]["out"][$iii]["addr"] == $addr2){
            //found a corresponding tx
            print_r($fgc["txs"][$i]);
        }
    }//end outputs loop
}

?>

http://phpfiddle.org/main/code/8imw-ardy

  • why is it so that this is not an easy thing to query? – smatthewenglish Dec 14 '16 at 9:50
0

I had trouble too. Documentation is unclear. This link works by way of browser: https://blockchain.info/multiaddr?address=641ad5051edd97029a003fe9efb29359fcee409d&address=1A8JiWcwvpY7tAopUkSnGuEYHmzGYfZPiq

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.