Bitcoin Forum
November 08, 2024, 01:07:38 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: List of Transactions?  (Read 600 times)
Fiiasco-Exalt (OP)
Full Member
***
Offline Offline

Activity: 140
Merit: 100


View Profile
April 18, 2015, 05:28:59 PM
 #1

How can I show a list of transactions of my website automatically?
Like right when someone deposits to a specific address I want it to be shown right beside a list of other transactions saying the sender address, amount, date time.
I'm not really an expert in developing and website designing and coding so if you can help me that would be great!
coinableS
Legendary
*
Offline Offline

Activity: 1442
Merit: 1186



View Profile WWW
April 18, 2015, 06:07:05 PM
 #2

You can do this with blockchain.info's API and a little PHP.  https://blockchain.info/api/blockchain_api

Code:
https://blockchain.info/address/$bitcoin_address?format=json

Use PHP and change the code below to have $bitcoin_address equal your address that you want to monitor for new transactions.

The below code will work for MOST standard transactions. Save the below code as a PHP file and run it on your server. It's a little buggy since it will also show transactions going out from this address, but it's a start.
Example: http://btcthreads.com/getBalance.php

Code:
<?php

$bitcoin_address "12DR75wMiV9YiBS5KcSLrQCWeK2WR32N4N"//Replace this with your address you want to monitor
$jsonData "https://blockchain.info/address/$bitcoin_address?format=json";
$getTx json_decode(file_get_contents($jsonData), true);
$totRec $getTx["total_received"];
$convert $totRec 0.00000001;

$finBal $getTx["final_balance"];
$finCon $finBal 0.00000001;

//Most recent tx
$sentAmount $getTx["txs"][0]["out"][0]["value"];
$sentAmountBTC $sentAmount 0.00000001;
$sentBy $getTx["txs"][0]["inputs"][0]["prev_out"]["addr"];

//2nd Most recent tx
$sentAmount2 $getTx["txs"][1]["out"][0]["value"];
$sentAmountBTC2 $sentAmount2 0.00000001;
$sentBy2 $getTx["txs"][1]["inputs"][0]["prev_out"]["addr"];

//3rd Most recent tx
$sentAmount3 $getTx["txs"][2]["out"][0]["value"];
$sentAmountBTC3 $sentAmount3 0.00000001;
$sentBy3 $getTx["txs"][2]["inputs"][0]["prev_out"]["addr"];

//4th Most recent tx
$sentAmount4 $getTx["txs"][3]["out"][0]["value"];
$sentAmountBTC4 $sentAmount4 0.00000001;
$sentBy4 $getTx["txs"][3]["inputs"][0]["prev_out"]["addr"];

?>

<html>
<head>
<style>
html {
background-color: #666666;
color: #ffffff;
font-family: "Calibri", arial, sans-serif;
}
h1 {
color: #FF6666;
}

.g_co {
color: #52CC29;
}

.addr {
font-family: Helvetica, sans-serif;
}

#latCon {
background-color: #333333;
border: 2px solid #FF6666;
border-radius: 6px;
max-width: 485px;
}
</style>
</head>
<center>
<h1>MY FUND RAISER</h1>
<h2>SEND DONATIONS TO:</h2>
<h2><?php echo $getTx["address"]; ?></h2>
<h2>So far we have received: <span class="g_co"><?php echo $convert " BTC"?></span></h2>
<br>

<h3>Latest Donations:</h3>
<div id="latCon">
 <span class="g_co"><?php echo $sentAmountBTC?> </span>BTC sent by <span class="addr"><?php echo $sentBy?></span><br>
 <span class="g_co"><?php echo $sentAmountBTC2?> </span>BTC sent by <span class="addr"><?php echo $sentBy2?></span><br>
 <span class="g_co"><?php echo $sentAmountBTC3?> </span>BTC sent by <span class="addr"><?php echo $sentBy3?></span>
 </div>
</html>


Fiiasco-Exalt (OP)
Full Member
***
Offline Offline

Activity: 140
Merit: 100


View Profile
April 18, 2015, 07:15:10 PM
 #3

You can do this with blockchain.info's API and a little PHP.  https://blockchain.info/api/blockchain_api

Code:
https://blockchain.info/address/$bitcoin_address?format=json

Use PHP and change the code below to have $bitcoin_address equal your address that you want to monitor for new transactions.

The below code will work for MOST standard transactions. Save the below code as a PHP file and run it on your server. It's a little buggy since it will also show transactions going out from this address, but it's a start.
Example: http://btcthreads.com/getBalance.php

Code:
<?php

$bitcoin_address "12DR75wMiV9YiBS5KcSLrQCWeK2WR32N4N"//Replace this with your address you want to monitor
$jsonData "https://blockchain.info/address/$bitcoin_address?format=json";
$getTx json_decode(file_get_contents($jsonData), true);
$totRec $getTx["total_received"];
$convert $totRec 0.00000001;

$finBal $getTx["final_balance"];
$finCon $finBal 0.00000001;

//Most recent tx
$sentAmount $getTx["txs"][0]["out"][0]["value"];
$sentAmountBTC $sentAmount 0.00000001;
$sentBy $getTx["txs"][0]["inputs"][0]["prev_out"]["addr"];

//2nd Most recent tx
$sentAmount2 $getTx["txs"][1]["out"][0]["value"];
$sentAmountBTC2 $sentAmount2 0.00000001;
$sentBy2 $getTx["txs"][1]["inputs"][0]["prev_out"]["addr"];

//3rd Most recent tx
$sentAmount3 $getTx["txs"][2]["out"][0]["value"];
$sentAmountBTC3 $sentAmount3 0.00000001;
$sentBy3 $getTx["txs"][2]["inputs"][0]["prev_out"]["addr"];

//4th Most recent tx
$sentAmount4 $getTx["txs"][3]["out"][0]["value"];
$sentAmountBTC4 $sentAmount4 0.00000001;
$sentBy4 $getTx["txs"][3]["inputs"][0]["prev_out"]["addr"];

?>

<html>
<head>
<style>
html {
background-color: #666666;
color: #ffffff;
font-family: "Calibri", arial, sans-serif;
}
h1 {
color: #FF6666;
}

.g_co {
color: #52CC29;
}

.addr {
font-family: Helvetica, sans-serif;
}

#latCon {
background-color: #333333;
border: 2px solid #FF6666;
border-radius: 6px;
max-width: 485px;
}
</style>
</head>
<center>
<h1>MY FUND RAISER</h1>
<h2>SEND DONATIONS TO:</h2>
<h2><?php echo $getTx["address"]; ?></h2>
<h2>So far we have received: <span class="g_co"><?php echo $convert " BTC"?></span></h2>
<br>

<h3>Latest Donations:</h3>
<div id="latCon">
 <span class="g_co"><?php echo $sentAmountBTC?> </span>BTC sent by <span class="addr"><?php echo $sentBy?></span><br>
 <span class="g_co"><?php echo $sentAmountBTC2?> </span>BTC sent by <span class="addr"><?php echo $sentBy2?></span><br>
 <span class="g_co"><?php echo $sentAmountBTC3?> </span>BTC sent by <span class="addr"><?php echo $sentBy3?></span>
 </div>
</html>

Thx Imma Go Checkitout
Fiiasco-Exalt (OP)
Full Member
***
Offline Offline

Activity: 140
Merit: 100


View Profile
April 18, 2015, 08:34:24 PM
 #4

You can do this with blockchain.info's API and a little PHP.  https://blockchain.info/api/blockchain_api

Code:
https://blockchain.info/address/$bitcoin_address?format=json

Use PHP and change the code below to have $bitcoin_address equal your address that you want to monitor for new transactions.

The below code will work for MOST standard transactions. Save the below code as a PHP file and run it on your server. It's a little buggy since it will also show transactions going out from this address, but it's a start.
Example: http://btcthreads.com/getBalance.php

Code:
<?php

$bitcoin_address "12DR75wMiV9YiBS5KcSLrQCWeK2WR32N4N"//Replace this with your address you want to monitor
$jsonData "https://blockchain.info/address/$bitcoin_address?format=json";
$getTx json_decode(file_get_contents($jsonData), true);
$totRec $getTx["total_received"];
$convert $totRec 0.00000001;

$finBal $getTx["final_balance"];
$finCon $finBal 0.00000001;

//Most recent tx
$sentAmount $getTx["txs"][0]["out"][0]["value"];
$sentAmountBTC $sentAmount 0.00000001;
$sentBy $getTx["txs"][0]["inputs"][0]["prev_out"]["addr"];

//2nd Most recent tx
$sentAmount2 $getTx["txs"][1]["out"][0]["value"];
$sentAmountBTC2 $sentAmount2 0.00000001;
$sentBy2 $getTx["txs"][1]["inputs"][0]["prev_out"]["addr"];

//3rd Most recent tx
$sentAmount3 $getTx["txs"][2]["out"][0]["value"];
$sentAmountBTC3 $sentAmount3 0.00000001;
$sentBy3 $getTx["txs"][2]["inputs"][0]["prev_out"]["addr"];

//4th Most recent tx
$sentAmount4 $getTx["txs"][3]["out"][0]["value"];
$sentAmountBTC4 $sentAmount4 0.00000001;
$sentBy4 $getTx["txs"][3]["inputs"][0]["prev_out"]["addr"];

?>

<html>
<head>
<style>
html {
background-color: #666666;
color: #ffffff;
font-family: "Calibri", arial, sans-serif;
}
h1 {
color: #FF6666;
}

.g_co {
color: #52CC29;
}

.addr {
font-family: Helvetica, sans-serif;
}

#latCon {
background-color: #333333;
border: 2px solid #FF6666;
border-radius: 6px;
max-width: 485px;
}
</style>
</head>
<center>
<h1>MY FUND RAISER</h1>
<h2>SEND DONATIONS TO:</h2>
<h2><?php echo $getTx["address"]; ?></h2>
<h2>So far we have received: <span class="g_co"><?php echo $convert " BTC"?></span></h2>
<br>

<h3>Latest Donations:</h3>
<div id="latCon">
 <span class="g_co"><?php echo $sentAmountBTC?> </span>BTC sent by <span class="addr"><?php echo $sentBy?></span><br>
 <span class="g_co"><?php echo $sentAmountBTC2?> </span>BTC sent by <span class="addr"><?php echo $sentBy2?></span><br>
 <span class="g_co"><?php echo $sentAmountBTC3?> </span>BTC sent by <span class="addr"><?php echo $sentBy3?></span>
 </div>
</html>

Is there a possible way to convert this php into html?
coinableS
Legendary
*
Offline Offline

Activity: 1442
Merit: 1186



View Profile WWW
April 18, 2015, 09:09:17 PM
 #5

Is there a possible way to convert this php into html?

No, HTML can not do the same functions as PHP.

Fiiasco-Exalt (OP)
Full Member
***
Offline Offline

Activity: 140
Merit: 100


View Profile
April 18, 2015, 09:15:34 PM
 #6

Is there a possible way to convert this php into html?

No, HTML can not do the same functions as PHP.
You see I don't know how to use php for my site and I don't know which area on my server I have to save it.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!