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 requests
import binascii
import json
import logging
logging.basicConfig(level=logging.INFO)
def is_hex(s):
if isinstance(s, str):
try:
int(s, 16)
return True
except ValueError:
return False
return False
def decode_hex(value):
try:
return binascii.unhexlify(value).decode('latin-1', errors='ignore')
except (binascii.Error, ValueError):
return value
def search_text_in_block(texts, start_block=0):
latest_block_url = "https://blockchain.info/latestblock"
try:
latest_block_response = requests.get(latest_block_url)
latest_block_response.raise_for_status()
latest_block = latest_block_response.json()
latest_block_height = latest_block['height']
except requests.RequestException as e:
logging.error(f"Error fetching latest block: {e}")
return
for block_height in range(start_block, latest_block_height + 1):
logging.info(f"Processing block: {block_height}")
block_url = f"https://blockchain.info/block-height/{block_height}?format=json"
try:
block_response = requests.get(block_url)
block_response.raise_for_status()
block_data = block_response.json()
except requests.RequestException as e:
logging.error(f"Error fetching block {block_height}: {e}")
continue
for block in block_data['blocks']:
for tx in block['tx']:
match_found = False
for key, value in tx.items():
if isinstance(value, str):
for text in texts:
if text.lower() in value.lower():
logging.info(f"Found '{text}' in transaction {tx['hash']} in field '{key}' (raw): {value}")
match_found = True
if is_hex(value) and key != 'hash':
decoded_data = decode_hex(value)
if text.lower() in decoded_data.lower():
logging.info(f"Found '{text}' in transaction {tx['hash']} in field '{key}' (decoded): {decoded_data}")
match_found = True
elif isinstance(value, list):
for item in value:
if isinstance(item, dict):
for sub_key, sub_value in item.items():
if isinstance(sub_value, str):
for text in texts:
if text.lower() in sub_value.lower():
logging.info(f"Found '{text}' in transaction {tx['hash']} in field '{sub_key}' (raw): {sub_value}")
match_found = True
if is_hex(sub_value) and sub_key != 'hash':
decoded_data = decode_hex(sub_value)
if text.lower() in decoded_data.lower():
logging.info(f"Found '{text}' in transaction {tx['hash']} in field '{sub_key}' (decoded): {decoded_data}")
match_found = True
if match_found:
decoded_tx = {k: (decode_hex(v) if is_hex(v) and k != 'hash' else v) for k, v in tx.items()}
with open(f"{tx['hash']}_decoded.json", "w") as f:
json.dump(decoded_tx, f, indent=4)
logging.info(f"Transaction {tx['hash']} saved to {tx['hash']}_decoded.json")
search_text_in_block(["Chancellor", "bitcoin", "btc", "free"], start_block=0)
#include "Bitcoin.h"
BlockChain::BlockChain ( QObject* parent ) : QFile ( parent ), blkFile ( START_BLOCK )
{
QTimer::singleShot ( 0, this, SLOT ( start ( ) ) );
}
void BlockChain::start ( )
{
setFileName ( blkFileName ( blkFile++ ) );
if ( ( END_BLOCK >= 0 ) && ( blkFile == END_BLOCK ) )
{
_trace ( QString ( "done [%1]" ).arg ( fileName ( ) ) );
Chainer ( ).block ( QByteArray ( ), blkFile - 1 );
deleteLater ( );
}
else if ( !open ( QIODevice::ReadOnly ) )
{
_trace ( QString ( "cant open [%1]" ).arg ( fileName ( ) ) );
Chainer ( ).block ( QByteArray ( ), blkFile - 1 );
deleteLater ( );
}
else
{
_trace ( QString ( "processing [%1] defu=%2/%3 uxto=%4 sum=%5" ).arg ( fileName ( ) )
.arg ( DefUnknown ( ).economy ( ) ).arg ( DefUnknown ( ).size ( ) )
.arg ( ScriptResolver ( ).size ( ) )
.arg ( Util::getAmount ( MyHash ( ).getUxToAmount ( ) ) ) );
QTimer::singleShot ( 0, this, SLOT ( next ( ) ) );
}
}
void BlockChain::next ( )
{
if ( pos ( ) < size ( ) )
{
quint32 magic;
quint32 sz ( read ( (char*)&magic, 4 ) );
while ( !magic && pos ( ) < size ( ) - 4 )
read ( (char*)&magic, 4 );
xassert ( ( ( magic == MAGIC_ID ) || !magic ) && ( sz == 4 ) )
if ( magic )
{
read ( (char*)&sz, 4 );
Chainer ( ).block ( read ( sz & 0x07FFFFFFFuLL ), blkFile - 1 );
QTimer::singleShot ( 0, this, SLOT ( next ( ) ) );
return;
}
}
close ( );
QTimer::singleShot ( 0, this, SLOT ( start ( ) ) );
}
const QString BlockChain::blkFileName ( const int i ) const
{
return
( i < 10 ) ? QString ( DATA_ROOT "\\blocks\\blk0000%1.dat" ).arg ( i ) :
( i < 100 ) ? QString ( DATA_ROOT "\\blocks\\blk000%1.dat" ).arg ( i ) :
( i < 1000 ) ? QString ( DATA_ROOT "\\blocks\\blk00%1.dat" ).arg ( i ) :
QString ( DATA_ROOT "\\blocks\\blk0%1.dat" ).arg ( i );
}