Skip to content

Commit 0fcc81f

Browse files
author
Taylor Warden
committed
Merge pull request #46 from whotooktwarden/master
Update Release: Pre-release Version 1.0.8, Roast-Coins Front-End API Endpoints Updated
2 parents 64e4136 + e194c9d commit 0fcc81f

10 files changed

+77
-25
lines changed

completed.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//Use a while loop to print each line by ID then append with the newline character
88
//assign SQL to a variable for query execution
99

10-
$sql = "SELECT id, crypto_symbol, crypto_address, external_address, direction, timestamp, finished FROM coin_index WHERE finished = true;";
10+
$sql = "SELECT id, crypto_symbol, crypto_address, external_address, is_inbound, rc_timestamp, finished, bc_blockhash, bc_amount, bc_txid FROM blockchain_transactions WHERE finished = 1 AND bc_txid IS NOT NULL;";
1111

1212
//connect to the database, execute the $sql, store the returned array within $result
1313
//script exits gracefully if connection cannot be established
@@ -21,7 +21,7 @@
2121
while($row = $result->fetch_assoc()) {
2222
echo "id: " . $row["id"]. " - Crypto Symbol: " . $row["crypto_symbol"]. " - Cryptocurrency Address: " . $row["crypto_address"].
2323
" - External Address: " . $row["external_address"].
24-
" - Time-stamp: " . $row["timestamp"]. " - Direction: " . $row["direction"]. " - Finished: " . $row["finished"]. "<br />";
24+
" - Time-stamp: " . $row["rc_timestamp"]. " - Is Inbound: " . $row["is_inbound"]. " - Finished: " . $row["finished"]. " - Blockhash: ". $row["bc_blockhash"]. " Amount: " . $row["bc_txid"]. " TxID: " . $row["bc_txid"]. "<br />";
2525
}
2626
} else {
2727
//else there were no results, notify RC operator

full_index.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,17 @@
1010
//Use a while loop to print each line by ID then append with the newline character
1111

1212
//assign SQL to a variable for query execution
13-
$sql = "SELECT id, crypto_symbol, crypto_address, external_address, direction, timestamp, finished FROM coin_index;";
13+
$sql = "SELECT id, crypto_symbol, crypto_address, external_address, is_inbound, rc_timestamp, finished, bc_blockhash, bc_amount, bc_txid FROM blockchain_transactions;";
1414
//connect to the database, execute the $sql, store the returned array within $result
1515
//script exits gracefully if connection cannot be established
1616
$result = $conn->query($sql);
17-
1817
//if the returned array has data
1918
if ($result->num_rows > 0) {
2019
// output data of each row
2120
while($row = $result->fetch_assoc()) {
2221
echo "id: " . $row["id"]. " - Crypto Symbol: " . $row["crypto_symbol"]. " - Cryptocurrency Address: " . $row["crypto_address"].
2322
" - External Address: " . $row["external_address"].
24-
" - Time-stamp: " . $row["timestamp"]. " - Direction: " . $row["direction"]. " - Finished: " . $row["finished"]. "<br />";
23+
" - Time-stamp: " . $row["rc_timestamp"]. " - Is Inbound: " . $row["is_inbound"]. " - Finished: " . $row["finished"]. " - Blockhash: ". $row["bc_blockhash"]. " Amount: " . $row["bc_txid"]. " TxID: " . $row["bc_txid"]. "<br />";
2524
}
2625
} else {
2726
//else there were no results, notify RC operator

get_crypto_symbol_by_external_address.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,18 @@
3434
died($error_message);
3535
}
3636

37-
$sql = "SELECT id, crypto_symbol, crypto_address, external_address, direction, timestamp, finished FROM coin_index WHERE crypto_symbol = ". $cryptocode . " AND WHERE external_address = ". $external .";";
37+
//assign SQL to a variable for query execution
38+
$sql = "SELECT id, crypto_symbol, crypto_address, external_address, is_inbound, rc_timestamp, finished, bc_blockhash, bc_amount, bc_txid FROM blockchain_transactions WHERE crypto_symbol = ". $cryptocode . " AND WHERE external_address = ". $external .";";
3839
//connect to the database, execute the $sql, store the returned array within $result
3940
//script exits gracefully if connection cannot be established
40-
4141
$result = $conn->query($sql);
42-
4342
//if the returned array has data
4443
if ($result->num_rows > 0) {
4544
// output data of each row
4645
while($row = $result->fetch_assoc()) {
4746
echo "id: " . $row["id"]. " - Crypto Symbol: " . $row["crypto_symbol"]. " - Cryptocurrency Address: " . $row["crypto_address"].
4847
" - External Address: " . $row["external_address"].
49-
" - Time-stamp: " . $row["timestamp"]. " - Direction: " . $row["direction"]. " - Finished: " . $row["finished"]. "<br />";
48+
" - Time-stamp: " . $row["rc_timestamp"]. " - Is Inbound: " . $row["is_inbound"]. " - Finished: " . $row["finished"]. " - Blockhash: ". $row["bc_blockhash"]. " Amount: " . $row["bc_txid"]. " TxID: " . $row["bc_txid"]. "<br />";
5049
}
5150
} else {
5251
//else there were no results, notify RC operator

get_external_address_by_timestamp.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,17 @@
3636
died($error_message);
3737
}
3838

39-
$sql = "SELECT id, crypto_symbol, crypto_address, external_address, direction, timestamp, finished FROM coin_index WHERE timestamp = ". $timestamp . " AND WHERE external_address = ". $external .";";
39+
$sql = "SELECT id, crypto_symbol, crypto_address, external_address, is_inbound, rc_timestamp, finished, bc_blockhash, bc_amount, bc_txid FROM blockchain_transactions WHERE rc_timestamp = ". $timestamp . " AND WHERE external_address = ". $external .";";
4040
//connect to the database, execute the $sql, store the returned array within $result
4141
//script exits gracefully if connection cannot be established
42-
4342
$result = $conn->query($sql);
44-
4543
//if the returned array has data
46-
4744
if ($result->num_rows > 0) {
4845
// output data of each row
4946
while($row = $result->fetch_assoc()) {
5047
echo "id: " . $row["id"]. " - Crypto Symbol: " . $row["crypto_symbol"]. " - Cryptocurrency Address: " . $row["crypto_address"].
5148
" - External Address: " . $row["external_address"].
52-
" - Time-stamp: " . $row["timestamp"]. " - Direction: " . $row["direction"]. " - Finished: " . $row["finished"]. "<br />";
49+
" - Time-stamp: " . $row["rc_timestamp"]. " - Is Inbound: " . $row["is_inbound"]. " - Finished: " . $row["finished"]. " - Blockhash: ". $row["bc_blockhash"]. " Amount: " . $row["bc_txid"]. " TxID: " . $row["bc_txid"]. "<br />";
5350
}
5451
} else {
5552
//else there were no results, notify RC operator

get_transactions_by_blockhash.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
//Usage: domain.tld/get_transactions_by_blockhash.php?blockhash=blockchain_blockhash
3+
//Provides an audit of all transactions for any specified blockhash
4+
require_once 'config.php';
5+
$conn = mysql_connect($db_host,$db_user,$db_pass)
6+
or die ('Error connecting to mysql! Please check config.php and your database for any inconsistencies.');
7+
//SQL query executed returning an array
8+
//Use a while loop to print each line by ID then append with the newline character
9+
//assign SQL to a variable for query execution
10+
//GET blockhash
11+
$blockhash = htmlspecialchars($_GET["blockhash"])
12+
13+
$sql = "SELECT id, crypto_symbol, crypto_address, external_address, is_inbound, rc_timestamp, finished, bc_blockhash, bc_amount, bc_txid FROM blockchain_transactions WHERE bc_blockhash = ". $blockhash .";";
14+
//connect to the database, execute the $sql, store the returned array within $result
15+
//script exits gracefully if connection cannot be established
16+
$result = $conn->query($sql);
17+
//if the returned array has data
18+
if ($result->num_rows > 0) {
19+
// output data of each row
20+
while($row = $result->fetch_assoc()) {
21+
echo "id: " . $row["id"]. " - Crypto Symbol: " . $row["crypto_symbol"]. " - Cryptocurrency Address: " . $row["crypto_address"].
22+
" - External Address: " . $row["external_address"].
23+
" - Time-stamp: " . $row["rc_timestamp"]. " - Is Inbound: " . $row["is_inbound"]. " - Finished: " . $row["finished"]. " - Blockhash: ". $row["bc_blockhash"]. " Amount: " . $row["bc_txid"]. " TxID: " . $row["bc_txid"]. "<br />";
24+
}
25+
} else {
26+
//else there were no results, notify RC operator
27+
echo "0 results";
28+
}
29+
$conn->close();
30+
?>

get_transactions_by_external_address.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,17 @@
3131
died($error_message);
3232
}
3333

34-
$sql = "SELECT id, crypto_symbol, crypto_address, external_address, direction, timestamp, finished FROM coin_index WHERE external_address = ". $external .";";
34+
$sql = "SELECT id, crypto_symbol, crypto_address, external_address, is_inbound, rc_timestamp, finished, bc_blockhash, bc_amount, bc_txid FROM blockchain_transactions WHERE external_address = ". $external .";";
3535
//connect to the database, execute the $sql, store the returned array within $result
3636
//script exits gracefully if connection cannot be established
37-
3837
$result = $conn->query($sql);
39-
4038
//if the returned array has data
4139
if ($result->num_rows > 0) {
4240
// output data of each row
4341
while($row = $result->fetch_assoc()) {
4442
echo "id: " . $row["id"]. " - Crypto Symbol: " . $row["crypto_symbol"]. " - Cryptocurrency Address: " . $row["crypto_address"].
4543
" - External Address: " . $row["external_address"].
46-
" - Time-stamp: " . $row["timestamp"]. " - Direction: " . $row["direction"]. " - Finished: " . $row["finished"]. "<br />";
44+
" - Time-stamp: " . $row["rc_timestamp"]. " - Is Inbound: " . $row["is_inbound"]. " - Finished: " . $row["finished"]. " - Blockhash: ". $row["bc_blockhash"]. " Amount: " . $row["bc_txid"]. " TxID: " . $row["bc_txid"]. "<br />";
4745
}
4846
} else {
4947
//else there were no results, notify RC operator

get_transactions_by_txid.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
//Usage: domain.tld/get_transactions_by_txid.php?txid=blockchain_transactionID
3+
//Provides an audit of all transactions for any specified transaction ID.
4+
5+
require_once 'config.php';
6+
$conn = mysql_connect($db_host,$db_user,$db_pass)
7+
or die ('Error connecting to mysql! Please check config.php and your database for any inconsistencies.');
8+
//SQL query executed returning an array
9+
//Use a while loop to print each line by ID then append with the newline character
10+
//assign SQL to a variable for query execution
11+
//GET txid
12+
$txid = htmlspecialchars($_GET["txid"])
13+
14+
$sql = "SELECT id, crypto_symbol, crypto_address, external_address, is_inbound, rc_timestamp, finished, bc_blockhash, bc_amount, bc_txid FROM blockchain_transactions WHERE bc_txid = ". $txid .";";
15+
//connect to the database, execute the $sql, store the returned array within $result
16+
//script exits gracefully if connection cannot be established
17+
$result = $conn->query($sql);
18+
//if the returned array has data
19+
if ($result->num_rows > 0) {
20+
// output data of each row
21+
while($row = $result->fetch_assoc()) {
22+
echo "id: " . $row["id"]. " - Crypto Symbol: " . $row["crypto_symbol"]. " - Cryptocurrency Address: " . $row["crypto_address"].
23+
" - External Address: " . $row["external_address"].
24+
" - Time-stamp: " . $row["rc_timestamp"]. " - Is Inbound: " . $row["is_inbound"]. " - Finished: " . $row["finished"]. " - Blockhash: ". $row["bc_blockhash"]. " Amount: " . $row["bc_txid"]. " TxID: " . $row["bc_txid"]. "<br />";
25+
}
26+
} else {
27+
//else there were no results, notify RC operator
28+
echo "0 results";
29+
}
30+
$conn->close();
31+
?>

include.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
//Declare and instantiate the gatewayName variable, store default as Read the README.md file to Change This:
3232

33-
$gatewayName = "QGK V1.0.7 Demo"; // string value
33+
$gatewayName = "QGK V1.0.8 Demo"; // string value
3434

3535
//Declare and instantiate asset array with default BTC:
3636

pending.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,17 @@
1010
//Use a while loop to print each line by ID then append with the newline character
1111
//assign SQL to a variable for query execution
1212

13-
$sql = "SELECT id, crypto_symbol, crypto_address, external_address, direction, timestamp, finished FROM coin_index WHERE finished = false;";
14-
13+
$sql = "SELECT id, crypto_symbol, crypto_address, external_address, is_inbound, rc_timestamp, finished, bc_blockhash, bc_amount, bc_txid FROM blockchain_transactions WHERE finished = 0;";
1514
//connect to the database, execute the $sql, store the returned array within $result
1615
//script exits gracefully if connection cannot be established
17-
1816
$result = $conn->query($sql);
19-
2017
//if the returned array has data
21-
2218
if ($result->num_rows > 0) {
2319
// output data of each row
2420
while($row = $result->fetch_assoc()) {
2521
echo "id: " . $row["id"]. " - Crypto Symbol: " . $row["crypto_symbol"]. " - Cryptocurrency Address: " . $row["crypto_address"].
2622
" - External Address: " . $row["external_address"].
27-
" - Time-stamp: " . $row["timestamp"]. " - Direction: " . $row["direction"]. " - Finished: " . $row["finished"]. "<br />";
23+
" - Time-stamp: " . $row["rc_timestamp"]. " - Is Inbound: " . $row["is_inbound"]. " - Finished: " . $row["finished"]. " - Blockhash: ". $row["bc_blockhash"]. " Amount: " . $row["bc_txid"]. " TxID: " . $row["bc_txid"]. "<br />";
2824
}
2925
} else {
3026
//else there were no results, notify RC operator

rcindex.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
echo "<li><a href="pending.php">Pending Transactions</a></li>";
66
echo "<li><a href="completed.php">Completed Transactions</a></li>";
77
echo "<li>Get Transactions by External Address:<br /><li>get_transactions_by_external_address.php?external=EXTERNAL_ADDRESS</li></li>";
8+
echo "<li>Get Transactions by Transaction ID:<br /><li>get_transactions_by_txid.php?txid=BLOCKCHAIN_TRANSACTION_ID</li></li>";
9+
echo "<li>Get Transactions by Blockhash:<br /><li>get_transactions_by_blockhash.php?blockhash=BLOCKCHAIN_BLOCKHASH</li></li>";
810
echo "<li>Get Transactions by Crypto Code and External Address:<br /><li>get_crypto_symbol_by_external_address.php?cryptocode=XYZ?external=EXTERNAL_ADDRESS</li></li>";
911
echo "<li>Get Transactions by Timestamp and External Address:<br /><li>get_external_address_by_timestamp.php?timestamp=UNIX_TIMESTAMP?external=EXTERNAL_ADDRESS</li></li>";
1012
echo "</ul><br />";

0 commit comments

Comments
 (0)