예제 #1
0
import sys, string, getpass, time, datetime
import happybase
import pprint

rpcuser = "******"
rpcpass = "******"
rpcip = "127.0.0.1"

hbase = None
hbase_settings_table = None
hbase_blocks_table = None
hbase_transactions_table = None
blockchain_height = 0

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


def hbase_connect():
    global hbase, hbase_blocks_table, hbase_transactions_table, hbase_settings_table
    hbase = None
    hbase_blocks_table = None
    hbase_transactions_table = None
    hbase = happybase.Connection('localhost')
    hbase_blocks_table = hbase.table('block_data')
    hbase_settings_table = hbase.table('settings')
    hbase_transactions_table = hbase.table('block_transactions')
예제 #2
0
파일: DyName.py 프로젝트: voidit/DyName
                    help='Allows use of d/ names instead of dd/ names.  This '
                         'is a security risk under most circumstances and '
                         'could allow someone to permanently steal control '
                         'of your domain.  Only use this if you really know '
                         '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']
예제 #3
0
ip = "127.0.0.1"


def txdetails(it):
    rawtx = access.getrawtransaction(it)
    decoded = access.decoderawtransaction(rawtx) 
    VV = str(sum(p['value'] for p in decoded['vout']))  # /1e8
    LL = len (decoded['vout'])
    NN = len (decoded['vin'])
    return VV  , decoded['vout'][0]['scriptPubKey']['addresses'][0] , str(LL) , str(NN)




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)
import sys, string, getpass, time, datetime
import happybase
import pprint

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:
예제 #5
0
import sys, string, getpass, time, datetime
import happybase
import pprint

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':