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.
import struct
def SetCompact(nCompact):
"""convert bc compact uint to number"""
nSize = (nCompact >> 24) & 0xFF
tbuf = "\x00\x00\x00" + chr(nSize)
if nSize >= 1:
tbuf += chr((nCompact >> 16) & 0xFF)
if nSize >= 2:
tbuf += chr((nCompact >> 8) & 0xFF)
if nSize >= 3:
tbuf += chr((nCompact >> 0) & 0xFF)
tbuf += "\x00" * (nSize - 3)
return mpi2num(tbuf)
def uint256_from_compact(c):
nbytes = (c >> 24) & 0xFF
v = (c & 0xFFFFFFL) << (8 * (nbytes - 3))
return v
import struct
def mpi2num(m):
"""convert MPI string to number"""
datasize = struct.unpack(">I", m[0:4])[0]
r = 0
if datasize:
neg_flag = bool(ord(m[4]) & 0x80)
r = ord(m[4]) & 0x7F
for i in xrange(1, datasize):
r <<= 8
r += ord(m[4+i])
if neg_flag:
r = -r
return r
def num2mpi(n):
"""convert number to MPI string"""
if n == 0:
return struct.pack(">I", 0)
r = ""
neg_flag = bool(n < 0)
n = abs(n)
while n:
r = chr(n & 0xFF) + r
n >>= 8
if ord(r[0]) & 0x80:
r = chr(0) + r
if neg_flag:
r = chr(ord(r[0]) | 0x80) + r[1:]
datasize = len(r)
return struct.pack(">I", datasize) + r
def GetCompact(n):
"""convert number to bc compact uint"""
mpi = num2mpi(n)
nSize = len(mpi) - 4
nCompact = (nSize & 0xFF) << 24
if nSize >= 1:
nCompact |= (ord(mpi[4]) << 16)
if nSize >= 2:
nCompact |= (ord(mpi[5]) << 8)
if nSize >= 3:
nCompact |= (ord(mpi[6]) << 0)
return nCompact
def SetCompact(nCompact):
"""convert bc compact uint to number"""
nSize = (nCompact >> 24) & 0xFF
tbuf = "\x00\x00\x00" + chr(nSize)
if nSize >= 1:
tbuf += chr((nCompact >> 16) & 0xFF)
if nSize >= 2:
tbuf += chr((nCompact >> 8) & 0xFF)
if nSize >= 3:
tbuf += chr((nCompact >> 0) & 0xFF)
tbuf += "\x00" * (nSize - 3)
return mpi2num(tbuf)
CBigNum& SetCompact(unsigned int nCompact) {
unsigned int nSize = nCompact >> 24;
std::vectorvch(4 + nSize);
vch[3] = nSize;
if (nSize >= 1) vch[4] = (nCompact >> 16) & 0xff;
if (nSize >= 2) vch[5] = (nCompact >> 8) & 0xff;
if (nSize >= 3) vch[6] = (nCompact >> 0) & 0xff;
BN_mpi2bn(&vch[0], vch.size(), this);
return *this;
}
def uint256_from_compact(c):
nbytes = (c >> 24) & 0xFF
v = (c & 0xFFFFFFL) << (8 * (nbytes - 3))
return v
function uint256_from_compact($c) {
$nbytes = ($c >> 24) & 0xFF;
return bcmul($c & 0xFFFFFF,bcpow(2,8 * ($nbytes - 3)));
}
unsigned int GetCompact() const {
unsigned int nSize = BN_bn2mpi(this, NULL);
std::vectorvch(nSize);
nSize -= 4;
BN_bn2mpi(this, &vch[0]);
unsigned int nCompact = nSize << 24;
if (nSize >= 1) nCompact |= (vch[4] << 16);
if (nSize >= 2) nCompact |= (vch[5] << 8);
if (nSize >= 3) nCompact |= (vch[6] << 0);
return nCompact;
}
function GetNextWorkRequired($block, $bits, $nActualTimespan) {
$nTargetTimespan = 60 * 60 * 24 * 14; // 2 weeks
if ($nActualTimespan < $nTargetTimespan / 4) { $nActualTimespan = $nTargetTimespan / 4; }
if ($nActualTimespan > $nTargetTimespan * 4) { $nActualTimespan = $nTargetTimespan * 4; }
$bits = uint256_from_compact($bits);
$bits = bcmul($bits,$nActualTimespan);
$bits = bcdiv($bits,$nTargetTimespan);
$bits = uint256_to_compact($bits); // <-- Need to translate C++ code for GetCompact()
return $bits;
}
bool CBlock::CheckBlock() const
{
...
// Check timestamp
if (nTime > GetAdjustedTime() + 2 * 60 * 60)
return error("CheckBlock() : block timestamp too far in the future");
...
bool CBlock::AcceptBlock()
{
...
// Check timestamp against prev
if (nTime <= pindexPrev->GetMedianTimePast())
return error("AcceptBlock() : block's timestamp is too early");
-7017 seconds to find block 70719
8153 seconds to find block 70718
49 seconds to find block 70717
524 seconds to find block 70716
block timestamp
70715 1280275621
70716 1280276145
70717 1280276194
70718 1280284347
70719 1280277330
header("Content-type: text/html");
require_once 'jsonRPCClient.php';
$data=new jsonRPCClient('http://127.0.0.1:8332');
$blockcount = $data->getblockcount();
$now = date("U");
$blockfile = "blockdata";
$data = file($blockfile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); array_pop($data);
?>
function humantime($secs) {
if ($secs<0) return false;
$m = (int)($secs / 60); $s = $secs % 60; $s = ($s <= 9) ? "0$s" : $s;
$h = (int)($m / 60); $m = $m % 60; $m = ($m <= 9) ? "0$m" : $m;
$d = (int)($h / 24); $h = $h % 24; $h = ($h <= 9) ? "0$h" : $h;
$d = ($d <= 9) ? "0$d" : $d;
return $d."d $h:$m:$s";
}
// Converted from ArtForz's python code http://bitcointalk.org/index.php?topic=464.msg4080#msg4080
function uint256_from_compact($c) {
$nbytes = ($c >> 24) & 0xFF;
return bcmul($c & 0xFFFFFF,bcpow(2,8 * ($nbytes - 3)));
}
$tblock = 0;
$nTargetTimespan = 60 * 60 * 24 * 14;
bcscale(256);
foreach ($data as $line) {
$blocks = strtok($line, " ");
$date = strtok(" ");
$avghash = strtok(" ");
$bits = strtok(" ");
if ($blocks == 0 || $blocks == $tblock) {
$tblock = $blocks + 2016;
$blocknum = str_repeat(" ", 6 - strlen($blocks)).$blocks;
echo "Block $blocknum was generated at $date (".date("r", $date).")";
if ($blocks != 0) {
$intervalnum = $date - $lastdate;
$interval = str_repeat(" ", 9 - strlen($intervalnum)).$intervalnum;
echo " $interval seconds interval (".humantime($intervalnum).")";
echo " Difficulty: ".bcdiv(bcdiv(bcmul(uint256_from_compact(0x1D00FFFF),1000), uint256_from_compact($bits)), 1000);
$lastdate = $date;
}
echo "
";
}
}
?>