It was the Bitcointalk forum that inspired us to create Bitcointalksearch.org - Bitcointalk is an excellent site that should be the default page for anybody dealing in cryptocurrency, since it is a virtual gold-mine of data. However, our experience and user feedback led us create our site; Bitcointalk's search is slow, and difficult to get the results you need, because you need to log in first to find anything useful - furthermore, there are rate limiters for their search functionality.
The aim of our project is to create a faster website that yields more results and faster without having to create an account and eliminate the need to log in - your personal data, therefore, will never be in jeopardy since we are not asking for any of your data and you don't need to provide them to use our site with all of its capabilities.
We created this website with the sole purpose of users being able to search quickly and efficiently in the field of cryptocurrency so they will have access to the latest and most accurate information and thereby assisting the crypto-community at large.
include('setup.php');
require_once 'BitcoinRPC.php';
function readTransaction($rawtx)
{
$details = $this->getrawtransaction($rawtx["txid"], 1);
$vinhex = $details['vin'][0]['scriptSig']['hex'];
$decodedscript = decodescript($vinhex);
$address = pubKeyToAddress($decodedscript[1]);
return $address;
}
function hash160ToAddress($hash160,$addressversion = "00")
{
$hash160 = $addressversion.$hash160;
$check = pack("H*" , $hash160);
$check = hash("sha256", hash("sha256", $check , true));
$check = substr($check, 0, 8);
$hash160 = strtoupper($hash160.$check);
return encodeBase58($hash160);
}
function hash160($data)
{
$data = pack("H*" , $data);
return strtoupper(hash("ripemd160", hash("sha256", $data,true)));
}
function pubKeyToAddress($pubkey)
{
return hash160ToAddress(hash160($pubkey));
}
function decodeHex($hex)
{
$hex = strtoupper($hex);
$chars = "0123456789ABCDEF";
$return = "0";
for($i = 0; $i < strlen($hex); $i++)
{
$current = (string)strpos($chars, $hex[$i]);
$return = (string)bcmul($return, "16", 0);
$return = (string)bcadd($return, $current, 0);
}
return $return;
}
function encodeBase58($hex)
{
if(strlen($hex)%2 !=0 )
{
die("encodeBase58: uneven number of hex characters");
}
$orighex = $hex;
$chars = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
$hex = decodeHex($hex);
$return = "";
while(bccomp($hex, 0) == 1)
{
$dv = (string)bcdiv($hex, "58", 0);
$rem = (integer)bcmod($hex, "58");
$hex = $dv;
$return = $return.$chars[$rem];
}
$return = strrev($return);
for($i = 0; $i < strlen($orighex) && substr($orighex, $i, 2) == "00"; $i += 2)
{
$return = "1".$return;
}
return $return;
}
function decodescript($script)
{
$op_code = array(
'00' => 'OP_FALSE', '61' => 'OP_NOP', '6a' => 'OP_RETURN',
'76' => 'OP_DUP', '87' => 'OP_EQUAL', '88' => 'OP_EQUALVERIFY',
'51' => 'OP_TRUE', 'a6' => 'OP_RIPEMD160', 'a7' => 'OP_SHA1',
'a8' => 'OP_SHA256', 'a9' => 'OP_HASH160', 'aa' => 'OP_HASH256',
'ac' => 'OP_CHECKSIG', 'ae' => 'OP_CHECKMULTISIG');
$data = array();
while(strlen($script) !== 0)
{
$byte = return_bytes($script, 1);
if(isset($op_code[$byte]))
{
$data[] = $op_code[$byte];
}
else if($byte >= 0x01 && $byte <= 0x4b)
{
$data[] = return_bytes($script, hexdec($byte));
}
else if($byte >= 0x52 && $byte <= 0x60)
{
$data[] = 'OP_' . ($byte - 0x52);
}
}
return $data;
}
function return_bytes(&$string, $byte_count, $reverse = false)
{
$requested_bytes = substr($string, 0, $byte_count * 2);
$string = substr($string, $byte_count * 2);
return ($reverse == false) ? $requested_bytes : flip_byte_order($requested_bytes);
}
function flip_byte_order($bytes)
{
return implode('', array_reverse(str_split($bytes, 2)));
}
$transaction = $this->listtransactions($setup['account'], 500, 100);
foreach($transaction as $rawtx)
{
if($rawtx['category'] == "sent")
{
continue;
}
else
{
$query = mysql_query('SELECT * FROM `received_transactions` WHERE `tx` = "'.$rawtx['txid'].'";') or die(mysql_error());
if(!mysql_fetch_assoc($query))
{
$address = readTransaction($rawtx);
$input = $rawtx['amount'];
$tx = $rawtx['txid'];
$received = date('Y-m-d H:i:s', $rawtx['time']);
$query = "INSERT INTO `received_transactions` (`id`, `tx`, `address`, `input`, `received`) VALUES (null, '$tx', '$address', '$input', '$received')";
}
else
{
continue;
}
}
}
?>