Browse files

Adding initial commit for Roast Coins front-end statistics

  • Loading branch information...
whotooktwarden committed Feb 20, 2016
1 parent 7d42a65 commit f3a59faf2b8fd08575c4d9444690297a2716d0f8
Showing with 60 additions and 4 deletions.
  1. +26 −0
  2. +4 −4 config.php
  3. +30 −0 rcindex.php
@@ -0,0 +1,26 @@

Create a front end statistics API for Roast cryptos

GETs without variables, used to query the database about its current state for daily operation

Get all data regarding all currently pending transactions, page name is pending: SELECT * FROM coin_index WHERE finished = false;

Get all data regarding all completed transactions, page name is completed: SELECT * FROM coin_index WHERE finished = true;

Get all data regarding all accounts from the coin_index table, the following will be made on loading the full_index page: SELECT * FROM coin_index;

GETs with variables, used to audit clients' past and/or current transactions with the operator

Get all data from the crypto index table about a specific external address, page name is tentatively named
get_external_address_transactions?external=<external address>: SELECT FROM coin_index * WHERE external_address = <external address>;
This would provide all of the information about all crypto symbols and all addresses for all cryptos, conversely..

Get all data from the crypto index table about a specific <crypto symbol> for any specified <external address>, page name is tentatively named
get_crypto_symbol_external_address?external=<external address>?cryptocode=<crypto symbol>:
SELECT FROM coin_index WHERE crypto_symbol = <crypto symbol> AND WHERE external_address = <external address>;
This would conversely provide only information about a specified crypto and ripple account.

This second query can be modified slightly to receive information about any specified <external address> and
any <crypto address> to fetch the same information but with another selector:
SELECT FROM coin_index WHERE crypto_address = <crypto address> AND WHERE external_address = <external address>
Tentatively named get_ripple_address_timestamp?ripple=<ripple address>?timestamp=<timestamp>.
@@ -1,6 +1,6 @@
$dbhost = 'localhost';
$dbuser = 'qgk_user';
$dbpass = 'pw12345';
$dbname = 'qgk';
$db_host = '';
$db_user = '';
$db_pass = '';
$db_name = '';
@@ -0,0 +1,30 @@
require_once 'config.php';
$conn = mysql_connect($db_host,$db_user,$db_ pass)
or die ('Error connecting to mysql! Please check config.php and your database for any inconsistencies.');
//SQL query executed returning an array
//Use a while loop to print each line by ID then append with the newline character
//assign SQL to a variable for query execution
$sql = "SELECT id, crypto_symbol, crypto_address, external_address, direction, timestamp, finished FROM coin_index";
//connect to the database, execute the $sql, store the returned array within $result
//script exits gracefully if connection cannot be established
$result = $conn->query($sql);
//if the returned array has data
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "id: " . $row["id"]. " - Crypto Symbol: " . $row["crypto_symbol"]. " - Cryptocurrency Address: " . $row["crypto_address"].
" - External Address: " . $row["external_address"].
" - Time-stamp: " . $row["timestamp"]. " - Direction: " . $row["direction"]. " - Finished: " . $row["finished"]. "<br />";
} else {
//else there were no results, notify RC operator
echo "0 results";

0 comments on commit f3a59fa

Please sign in to comment.