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 os
import sys
import urllib2
import urllib
import json
import time
import re
import getpass
INSTALL_PATH = '/srv/'
CONF_FILE = os.path.join(INSTALL_PATH, "hz-v3.9/conf/nhz-default.properties")
NHZ_PATH = os.path.join(INSTALL_PATH, "hz-v3.9")
SUPERVISOR_CONF = "/etc/supervisor/conf.d/nhz.conf"
def make_get(url):
response = urllib2.urlopen(url)
html = response.read()
return html
def make_post(url, data):
data = urllib.urlencode(data)
req = urllib2.Request(url=url,data=data)
content = urllib2.urlopen(req).read()
return content
def installed():
return os.path.exists(CONF_FILE)
def edited(ip):
return ip in open(CONF_FILE).read()
def get_ip():
return json.loads(make_get("http://httpbin.org/ip"))["origin"]
def create_hallmark(ip, secret):
endpoint = 'http://127.0.0.1:7776/nhz'
content = make_post(endpoint, {
"requestType": "markHost",
"host": ip,
"weight": 100,
"date": "2013-12-10",
"secretPhrase": secret,
})
return json.loads(content)["hallmark"]
def update_config(ip, hallmark):
conf_content = open(CONF_FILE).read()
conf_content = re.sub("nhz.myHallmark=([^\n]*)\n", "nhz.myHallmark={}".format(hallmark), conf_content)
conf_content = re.sub("nhz.myAddress=([^\n]*)\n", "nhz.myAddress={}".format(ip), conf_content)
f = open(CONF_FILE, 'w+')
f.write(conf_content)
f.close()
print "config updated with addr: {}, hallmark: {}".format(ip, hallmark)
def write_supervisor_config():
if not os.path.exists(os.path.dirname(SUPERVISOR_CONF)):
os.makedirs(os.path.dirname(SUPERVISOR_CONF))
file_content = """[program:quark]
directory={}
command=/bin/sh run.sh
stdout_logfile=/var/log/nhz.log
stderr_logfile=/var/log/nhz.error.log
autorestart=true""".format(NHZ_PATH)
f = open(SUPERVISOR_CONF, "w+")
f.write(file_content)
f.close()
def main():
try:
f = open("/root/sec-test", "w+")
f.close()
except IOError:
print >> sys.stderr, "You need root permissions to run this script."
sys.exit(1)
if not installed():
print "installing dependencies..."
os.system("apt-get update -y")
os.system("apt-get install -y screen")
os.system("apt-get install -y openjdk-7-jre")
os.system("apt-get install -y unzip")
os.system("apt-get install -y supervisor")
os.chdir(INSTALL_PATH)
os.system("wget https://github.com/NeXTHorizon/hz-source/releases/download/hz-v3.9/hz-v3.9.zip")
os.system("unzip hz-v3.9.zip")
# open port
os.system("iptables -A INPUT -p tcp -d 0/0 -s 0/0 --dport 7774 -j ACCEPT")
os.chdir(NHZ_PATH)
ip = get_ip()
if not edited(ip):
os.system("screen -d -m -S hallmark ./run.sh")
print "waiting 30 seconds for node to set itself up..."
time.sleep(30)
try:
hallmark = create_hallmark(ip, getpass.getpass("enter your secret phrase:\n"))
update_config(ip, hallmark)
finally:
os.system("screen -S hallmark -X quit")
write_supervisor_config()
print "starting supervisord"
os.system("service supervisor stop")
time.sleep(3)
os.system("service supervisor start")
print "-" * 42
print "success! your hallmark node set on ip: {}".format(ip)
print "NHZ address for donations: NHZ-MGUU-WTUR-JC6K-DREBV"
print "thanks!"
print "-" * 42
if __name__ == '__main__':
main()