2 ### Automatic seeding over HTTP
5 ### http://www.gnu.org/licenses/agpl-3.0.en.html
15 ### This module is required to function properly:
16 ### https://github.com/jgarzik/python-bitcoinrpc
18 from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
20 sources = ['http://dalexhz1.cloudapp.net', 'http://dalexhz2.cloudapp.net', 'http://dalexhz4.cloudapp.net', 'http://dalexhz5.cloudapp.net']
24 if platform.system() == 'Windows':
25 folder = os.path.join(os.path.join(os.environ['APPDATA'], 'NovaCoin'))
27 if platform.system() == 'Darwin':
28 folder = os.path.expanduser('~/Library/Application Support/NovaCoin/')
30 folder = os.path.expanduser('~/.novacoin')
32 return os.path.join(folder, 'novacoin.conf')
34 conf_path = confFile()
35 if not os.path.exists(conf_path):
36 parser.error('''Novacoin configuration file not found. Manually enter your RPC password.\r\n'''
37 '''If you actually haven't created a configuration file, you should create one at %s with the text like this:\r\n'''
40 '''rpcuser=yourname\r\n'''
41 '''rpcpassword=%x\r\n'''
43 '''Keep that password secret! After creating the file, restart Novacoin.''' % (conf_path, random.randrange(2**128)))
45 conf = open(conf_path, 'rb').read()
48 for line in conf.splitlines(True):
50 line = line[:line.index('#')]
53 k, v = line.split('=', 1)
54 contents[k.strip()] = v.strip()
56 if 'rpcpassword' not in contents.keys():
58 '''RPC password is not found in the %s file.''' % (conf_path))
61 rpcpassword = contents['rpcpassword']
63 rpclisten = '127.0.0.1'
65 if 'rpcport' in contents.keys():
66 rpcport = contents['rpcport']
68 if 'rpcuser' in contents.keys():
69 rpcuser = contents['rpcuser']
71 if 'rpclisten' in contents.keys():
72 rpcuser = contents['rpclisten']
74 url = "http://"+rpcuser+":"+rpcpassword+"@"+rpclisten+":"+rpcport+"/"
76 access = AuthServiceProxy(url)
77 data = json.load(urllib2.urlopen(random.choice(sources)))
82 access.addnode(node, 'add')