Exemple #1
0
def generate_stats():
  stats = StatsBackend()

  # 1. Count the amount of wallets
  if platform.system() == "Darwin": # This could be removed at one point, just here for development
    wallet_path = "/tmp/wallets"
  else:
    wallet_path = "/var/lib/omniwallet/wallets"
  try:
    wallet_files = os.listdir(wallet_path)
    amount_of_wallets = len(wallet_files)
  except IOError as e:
    print "Error retrieving wallets: %s" % e

  stats.put("amount_of_wallets", amount_of_wallets)

  # 2. Count the amount of watch-only and full addresses, we could split this at one point
  address_count = 0 
  for wallet in wallet_files:
    try:
      f = open("%s/%s" % (wallet_path, wallet))
      accounts = json.loads(f.read())
      address_count += len(accounts["addresses"])
    except IOError as e:
      print "File could not be read for %s" % wallet
    except ValueError as e:
      print "JSON Could not be decoded for %s" % wallet

  stats.put("amount_of_addresses_managed", address_count)
Exemple #2
0
def generate_stats():
    stats = StatsBackend()

    # 1. Count the amount of wallets
    if platform.system() == "Darwin":  # This could be removed at one point, just here for development
        wallet_path = "/tmp/wallets"
    else:
        wallet_path = "/var/lib/omniwallet/wallets"
    try:
        wallet_files = os.listdir(wallet_path)
        amount_of_wallets = len(wallet_files)
    except IOError as e:
        print "Error retrieving wallets: %s" % e

    stats.put("amount_of_wallets", amount_of_wallets)
Exemple #3
0
def generate_stats():
    stats = StatsBackend()

    # 1. Count the amount of wallets
    if platform.system(
    ) == "Darwin":  # This could be removed at one point, just here for development
        wallet_path = "/tmp/wallets"
    else:
        wallet_path = "/var/lib/omniwallet/wallets"
    try:
        wallet_files = os.listdir(wallet_path)
        amount_of_wallets = len(wallet_files)
    except IOError as e:
        print "Error retrieving wallets: %s" % e

    stats.put("amount_of_wallets", amount_of_wallets)
Exemple #4
0
def pushtx(signed_tx):
    info(signed_tx)

    f = tempfile.NamedTemporaryFile(mode='r+b',prefix='signedtx-', delete=False, dir='/var/lib/omniwallet/tmptx')
    f.write(signed_tx)
    f.close()

    # validate tx first
    ret=validate_tx(f.name)
    if ret != None:
        return ret
    
    # broadcast
    ret=broadcast_tx(f.name)
    if ret != None:
        return ret
    else:
        stats = StatsBackend()
        stats.increment("amount_of_transactions")
        return 'success'
Exemple #5
0
def pushtx(signed_tx):
    info(signed_tx)

    f = tempfile.NamedTemporaryFile(mode='r+b',prefix='signedtx-', delete=False, dir='/var/lib/omniwallet/tmptx')
    f.write(signed_tx)
    f.close()

    # validate tx first
    ret=validate_tx(f.name)
    if ret != None:
        return ret
    
    # broadcast
    ret=broadcast_tx(f.name)
    if ret != None:
        return ret
    else:
        stats = StatsBackend()
        stats.increment("amount_of_transactions")
        return 'success'
Exemple #6
0
def generate_stats():
    stats = StatsBackend()

    # 1. Count the amount of wallets
    if platform.system(
    ) == "Darwin":  # This could be removed at one point, just here for development
        wallet_path = "/tmp/wallets"
    else:
        wallet_path = "/var/lib/omniwallet/wallets"
    try:
        wallet_files = os.listdir(wallet_path)
        amount_of_wallets = len(wallet_files)
    except IOError as e:
        print "Error retrieving wallets: %s" % e

    stats.put("amount_of_wallets", amount_of_wallets)

    # 2. Count the amount of watch-only and full addresses, we could split this at one point
    address_count = 0
    for wallet in wallet_files:
        try:
            f = open("%s/%s" % (wallet_path, wallet))
            accounts = json.loads(f.read())
            address_count += len(accounts["addresses"])
        except IOError as e:
            print "File could not be read for %s" % wallet
        except ValueError as e:
            print "JSON Could not be decoded for %s" % wallet

    stats.put("amount_of_addresses_managed", address_count)