Esempio n. 1
0
                         'what you\'re doing.')

args = parser.parse_args()

config = configparser.ConfigParser()

config.read(args.configfile)

try:
    namecoind_session = AuthServiceProxy('http://' + 
                                         config['DEFAULT']['RpcUser'] + ':' + 
                                         config['DEFAULT']['RpcPassword'] + 
                                         '@' + config['DEFAULT']['RpcHost'] + 
                                         ':' + config['DEFAULT']['RpcPort'])
    
    print('namecoind is at block ' + str(namecoind_session.getblockcount()) )
except:
    print('Failed to connect to namecoind')

for domain in config:
    
    if str(domain) == 'DEFAULT':
        continue
    
    try:
        name = config[str(domain)]['Name']
        resolver = config[str(domain)]['Resolver']
        source = config[str(domain)]['Source']
        renew_blocks = int(config[str(domain)]['RenewBlocks'])
        #print(name)
        #print(resolver)
Esempio n. 2
0
if rpcpass == "":
    access = AuthServiceProxy("http://"+ip+":8332")
else:
    access = AuthServiceProxy("http://"+rpcuser+":"+rpcpass+"@"+ip+":8332")
try:
    cmd = sys.argv[1].lower()
except IndexError:
    cmd = "getblockcount"

print "# of connections: " + str(access.getconnectioncount())

mm1 = access.getrawmempool()  ; TT1 = time.time() ;  CC = 0  
try:
      while 1:
           hh = access.getblockcount()
           print "blockcount: " + str(hh)
           time.sleep(1.41)
           mm2 = access.getrawmempool()
           
           new_ = list(set(mm2) - set(mm1))
           #new_ = mm2
           
           for item in new_: 
              val, max_addr, n_outputs, n_inputs = txdetails(item)
           
              bigtag = '  '
              if float(val) >= 10:
                bigtag = '>>'
                time.sleep(0.3)
            
rpcpass = "******"
rpcip = "127.0.0.1"

hbase = happybase.Connection('localhost')
hbase_blocks_table = hbase.table('block_data')
hbase_transactions_table = hbase.table('realtime_transactions')

print "start monitoring"

if rpcpass == "":
    bitcoinrpc = AuthServiceProxy("http://" + rpcip + ":8332")
else:
    bitcoinrpc = AuthServiceProxy("http://" + rpcuser + ":" + rpcpass + "@" +
                                  rpcip + ":8332")

blockchain_height = bitcoinrpc.getblockcount()


def get_transaction(transaction_hash):
    hbase_transactions_table.delete(transaction_hash)
    print "Processing transaction " + transaction_hash
    try:
        transaction_json = bitcoinrpc.getrawtransaction(transaction_hash, 1)
        #pprint.pprint(transaction_json)
        load_dict = {'metadata:timestamp': str(time.time())}
        for key in transaction_json:
            if key == 'vin':
                for i, vin in enumerate(transaction_json[key]):
                    #load_dict['in:vin' + str(i) + '_scriptSigasm'] = str(vin['scriptSig']['asm'])
                    #load_dict['in:vin' + str(i) + '_scriptSighex'] = str(vin['scriptSig']['hex'])
                    if 'coinbase' in vin:
rpcuser = "******"
rpcpass = "******"
rpcip = "127.0.0.1"

hbase = happybase.Connection('localhost')
hbase_blocks_table = hbase.table('block_data')
hbase_transactions_table = hbase.table('realtime_transactions')

print "start monitoring"

if rpcpass == "":
    bitcoinrpc = AuthServiceProxy("http://"+rpcip+":8332")
else:
    bitcoinrpc = AuthServiceProxy("http://"+rpcuser+":"+rpcpass+"@"+rpcip+":8332")

blockchain_height = bitcoinrpc.getblockcount()


def get_transaction(transaction_hash):
    hbase_transactions_table.delete(transaction_hash)
    print "Processing transaction " + transaction_hash
    try:
        transaction_json = bitcoinrpc.getrawtransaction(transaction_hash, 1)
        #pprint.pprint(transaction_json)
        load_dict = {'metadata:timestamp':str(time.time())}
        for key in transaction_json:
            if key == 'vin':
                for i, vin in enumerate(transaction_json[key]):
                    #load_dict['in:vin' + str(i) + '_scriptSigasm'] = str(vin['scriptSig']['asm'])
                    #load_dict['in:vin' + str(i) + '_scriptSighex'] = str(vin['scriptSig']['hex'])
                    if 'coinbase' in vin: