Пример #1
0
def minerAll(etherbase):
    allBlocks = True
    # always connect first
    conn = db.connect()

    # get all the data for the template
    latestBlock = db.getLatestBlockFromDB(conn)
    #data = getLatestAllRewards(conn,etherbase)
    num = db.getRewardCount(conn, etherbase)
    data3 = db.getRewardCountByExtra(conn, etherbase)
    #last7 = getLast7Days(conn,etherbase)
    lastFive = db.getLatestAllRewards(conn, etherbase)
    #graphData = getGraphData(conn,etherbase)
    lastUpdate = db.getLastUpdateTime(conn)
    lastMined = lastFive[0]['timest']
    #close the connection so data will refresh each page
    conn.close()

    return render_template('miner.html',
                           lastMined=lastMined,
                           allBlocks=allBlocks,
                           lastFive=lastFive,
                           lastUpdate=lastUpdate,
                           latestBlock=latestBlock,
                           data=data,
                           etherbase=etherbase,
                           blockCount=num,
                           data3=data3)
Пример #2
0
def highScores():
    conn = db.connect()
    latestBlock = db.getLatestBlockFromDB(conn)
    day = 1
    week = 7
    month = 31
    limit = 50
    lastUpdate = db.getLastUpdateTime(conn)
    topWallets = db.getTopMiners(conn, limit)
    topRigs = db.getTopRigs(conn, limit)
    topWallets24 = db.getTopMinersLatest(conn, limit, day)
    topRigs24 = db.getTopRigsLatest(conn, limit, day)
    topWalletsWeek = db.getTopMinersLatest(conn, limit, week)
    topRigsWeek = db.getTopRigsLatest(conn, limit, week)
    topWalletsMonth = db.getTopMinersLatest(conn, limit, month)
    topRigsMonth = db.getTopRigsLatest(conn, limit, month)
    conn.close()

    return render_template('highscores.html',
                           latestBlock=latestBlock,
                           lastUpdate=lastUpdate,
                           topWallets=topWallets,
                           topRigs=topRigs,
                           topWallets24=topWallets24,
                           topRigs24=topRigs24,
                           topWalletsWeek=topWalletsWeek,
                           topRigsWeek=topRigsWeek,
                           topWalletsMonth=topWalletsMonth,
                           topRigsMonth=topRigsMonth)
Пример #3
0
def api():
    conn = db.connect()
    latestBlock = db.getLatestBlockFromDB(conn)
    lastUpdate = db.getLastUpdateTime(conn)
    conn.close()
    content = getAPIcontent()
    return render_template('api.html',
                           latestBlock=latestBlock,
                           lastUpdate=lastUpdate,
                           content=content)
Пример #4
0
def extra(extra):

    # always connect first
    conn = db.connect()
    #stuff for the template
    latestBlock = db.getLatestBlockFromDB(conn)
    lastUpdate = db.getLastUpdateTime(conn)
    total = db.getTotalByExtra(conn, extra)

    #extra stuff
    stats = db.getExtraStats(conn, extra)

    if (extra == 'Windows'):
        warning = 'Will only display 100 recent results for Default'
        limit = 100
        data = db.getDataForExtraLimited(conn, extra, limit)
        lastMined = data[0]['timest']
        return render_template('extra.html',
                               lastMined=lastMined,
                               warning=warning,
                               latestBlock=latestBlock,
                               lastUpdate=lastUpdate,
                               data=data,
                               extra=extra,
                               total=total,
                               stats=stats)

    if (extra == 'Linux'):
        warning = 'Will only display 100 recent results for Default'
        limit = 100
        data = db.getDataForExtraLimited(conn, extra, limit)
        lastMined = data[0]['timest']
        return render_template('extra.html',
                               lastMined=lastMined,
                               warning=warning,
                               latestBlock=latestBlock,
                               lastUpdate=lastUpdate,
                               data=data,
                               extra=extra,
                               total=total,
                               stats=stats)

    data = db.getDataForExtra(conn, extra)
    lastMined = data[0]['timest']

    conn.close()

    return render_template('extra.html',
                           lastMined=lastMined,
                           latestBlock=latestBlock,
                           lastUpdate=lastUpdate,
                           data=data,
                           extra=extra,
                           total=total,
                           stats=stats)
Пример #5
0
def transactionChart():
    conn = db.connect()
    latestBlock = db.getLatestBlockFromDB(conn)
    lastUpdate = db.getLastUpdateTime(conn)
    transactionGraph = db.getTransactionFrequencyGraph(conn)
    conn.close()

    return render_template('charts/transactions.html',
                           transactionGraph=transactionGraph,
                           latestBlock=latestBlock,
                           lastUpdate=lastUpdate)
Пример #6
0
def transaction(hashT):
    conn = db.connect()
    latestBlock = db.getLatestBlockFromDB(conn)
    lastUpdate = db.getLastUpdateTime(conn)
    transaction = db.getTransactionAPI(conn, hashT)
    conn.close()
    return render_template('transaction.html',
                           hash=hashT,
                           latestBlock=latestBlock,
                           lastUpdate=lastUpdate,
                           transaction=transaction)
Пример #7
0
def block(blockNum):
    conn = db.connect()
    latestBlock = db.getLatestBlockFromDB(conn)
    lastUpdate = db.getLastUpdateTime(conn)
    block = db.getBlock(conn, blockNum)
    transactions = db.getTransactionListBlock(conn, blockNum)
    conn.close()
    return render_template('block.html',
                           latestBlock=latestBlock,
                           lastUpdate=lastUpdate,
                           block=block,
                           transactions=transactions)
Пример #8
0
def countdown():
    conn = db.connect()
    latestBlock = db.getLatestBlockFromDB(conn)
    lastUpdate = db.getLastUpdateTime(conn)
    conn.close()
    if (latestBlock < 200000):
        showCountdown = 1
        return render_template('countdown.html',
                               showCountdown=showCountdown,
                               latestBlock=latestBlock,
                               lastUpdate=lastUpdate)
    return render_template('countdown.html',
                           latestBlock=latestBlock,
                           lastUpdate=lastUpdate)
Пример #9
0
def searchMiner():
    etherbase = request.form.get('etherbase')

    if goodEtherbase(etherbase):
        returnUrl = 'miner/' + etherbase + ''
        return redirect(returnUrl)

    conn = db.connect()
    latestBlock = db.getLatestBlockFromDB(conn)
    lastTen = db.getLatestNBlocks(conn, 10)
    lastUpdate = db.getLastUpdateTime(conn)
    conn.close()
    error = "Please Enter a Valid Wallet Address"
    return homepage(error)
Пример #10
0
def searchExtra():
    extra = request.form.get('extra')
    conn = db.connect()

    if db.foundExtra(conn, extra):
        returnUrl = 'extra/' + extra + ''
        return redirect(returnUrl)

    latestBlock = db.getLatestBlockFromDB(conn)
    lastTen = db.getLatestNBlocks(conn, 10)
    lastUpdate = db.getLastUpdateTime(conn)
    conn.close()
    error = "Extra Data Key Not Found! (This means your computer has not mined a block yet.)"
    return homepage(error)
Пример #11
0
def difficultyPage():
    conn = db.connect()
    latestBlock = db.getLatestBlockFromDB(conn)
    lastUpdate = db.getLastUpdateTime(conn)
    difficultyGraph = db.getDifficultyGraphData(conn)

    conn.close()

    for x in difficultyGraph:
        x['difficulty'] = float("{0:.2f}".format(x['difficulty'] /
                                                 difficultyHashMagnitude))

    return render_template('charts/difficulty.html',
                           latestBlock=latestBlock,
                           lastUpdate=lastUpdate,
                           difficultyGraph=difficultyGraph)
Пример #12
0
def miner(etherbase, page=1):
    perPage = 10
    # always connect first
    conn = db.connect()

    # get all the data for the template
    latestBlock = db.getLatestBlockFromDB(conn)
    #data = getLatestAllRewards(conn,etherbase)
    num = db.getRewardCount(conn, etherbase)
    data3 = db.getRewardCountByExtra(conn, etherbase)
    #last7 = getLast7Days(conn,etherbase)
    lastFive = db.getDataForMinerPaginated(conn, etherbase, perPage, page)
    #graphData = getGraphData(conn,etherbase)
    lastUpdate = db.getLastUpdateTime(conn)
    #close the connection so data will refresh each page
    conn.close()

    lastMined = lastFive[0]['timest']

    nextURL = '/miner/' + etherbase + '/' + str(page + 1)
    if (page >= 2):
        previous = '/miner/' + etherbase + '/' + str(page - 1)
        return render_template('miner.html',
                               lastMined=lastMined,
                               page=page,
                               prev_url=previous,
                               next_url=nextURL,
                               lastFive=lastFive,
                               lastUpdate=lastUpdate,
                               latestBlock=latestBlock,
                               data=data,
                               etherbase=etherbase,
                               blockCount=num,
                               data3=data3)

    return render_template('miner.html',
                           lastMined=lastMined,
                           page=page,
                           next_url=nextURL,
                           lastFive=lastFive,
                           lastUpdate=lastUpdate,
                           latestBlock=latestBlock,
                           data=data,
                           etherbase=etherbase,
                           blockCount=num,
                           data3=data3)
Пример #13
0
def emailRemove():
    conn = db.connect()
    etherbase = request.form.get('etherbaseRemove')
    email = request.form.get('emailRemove')
    extra = request.form.get('extraRemove')
    message = db.removeEmailAlert(conn, etherbase, email, extra)
    latestBlock = db.getLatestBlockFromDB(conn)
    conn.close()

    if message == "Sucsess":
        sendUnsubstribeConfirmation(etherbase, email)
        return render_template('alerts.html',
                               latestBlock=latestBlock,
                               message=message)
    else:
        return render_template('alerts.html',
                               latestBlock=latestBlock,
                               error=error)
Пример #14
0
def emailSubmit():
    conn = db.connect()
    etherbase = request.form.get('etherbase')
    email = request.form.get('email')
    extra = request.form.get('extra')
    message = db.addEmailAlert(conn, etherbase, email, extra)
    latestBlock = db.getLatestBlockFromDB(conn)
    conn.close()

    if message == "Sucsess":
        sendSignupConfirmation(etherbase, email, extra)
        return render_template('alerts.html',
                               latestBlock=latestBlock,
                               message=message)
    else:
        return render_template('alerts.html',
                               latestBlock=latestBlock,
                               error=error)
Пример #15
0
def statistics():
    conn = db.connect()
    latestBlock = db.getLatestBlockFromDB(conn)
    lastUpdate = db.getLastUpdateTime(conn)
    days = 30

    maxTransactions = db.getMaxTransactions(conn)
    maxDifficulty = db.getMaxDifficulty(conn)
    maxDifficulty[
        'difficulty'] = maxDifficulty['difficulty'] / difficultyHashMagnitude
    maxDifficulty['difficulty'] = '%.2f' % (maxDifficulty['difficulty'])
    activeWallets = db.getActiveWallets(conn)
    totalTransactions = db.getTotalTransactions(conn)
    averageDifficulty = db.getAverageDifficulty(conn)
    averageDifficulty['average'] = float(
        averageDifficulty['average']) / difficultyHashMagnitude
    averageDifficulty['average'] = '%.2f' % (averageDifficulty['average'])

    maxTransactions90 = db.getMaxTransactions90(conn, days)
    maxDifficulty90 = db.getMaxDifficulty90(conn, days)
    maxDifficulty90[
        'difficulty'] = maxDifficulty90['difficulty'] / difficultyHashMagnitude
    maxDifficulty90['difficulty'] = '%.2f' % (maxDifficulty90['difficulty'])
    activeWallets90 = db.getActiveWallets90(conn, days)
    totalTransactions90 = db.getTotalTransactions90(conn, days)
    averageDifficulty90 = db.getAverageDifficulty90(conn, days)
    averageDifficulty90['average'] = float(
        averageDifficulty90['average']) / difficultyHashMagnitude
    averageDifficulty90['average'] = '%.2f' % (averageDifficulty90['average'])

    #averageTransactins = getAverageTransactions(conn)

    conn.close()

    return render_template('stats.html',days=days,averageDifficulty=averageDifficulty, \
      totalTransactions=totalTransactions, activeWallets=activeWallets,highestDifficulty=maxDifficulty, \
      peakTransactions=maxTransactions,latestBlock = latestBlock, lastUpdate = lastUpdate, \
      averageDifficulty90=averageDifficulty90, \
      totalTransactions90=totalTransactions90, activeWallets90=activeWallets90,highestDifficulty90=maxDifficulty90, \
      peakTransactions90=maxTransactions90)
Пример #16
0
def homepage(error="None"):
    page, per_page, offset = get_page_args(page_parameter='page',
                                           per_page_parameter='per_page')
    per_page = 5
    conn = db.connect()
    latestBlock = db.getLatestBlockFromDB(conn)
    lastUpdate = db.getLastUpdateTime(conn)
    lastTen = db.getLatestNBlocksOffset(conn, per_page, page)
    graph = db.getDifficultyGraphData(conn)
    conn.close()

    for x in graph:
        x['difficulty'] = float("{0:.2f}".format(x['difficulty'] /
                                                 difficultyHashMagnitude))
    #pagination = Pagination(page=page, per_page=per_page, total = int(latestBlock),
    #                       css_framework='bootstrap4')

    if (error != "None"):
        return render_template('home.html',
                               graph=graph,
                               latestBlock=latestBlock,
                               lastTen=lastTen,
                               lastUpdate=lastUpdate,
                               error=error)

    if (latestBlock < 200000):
        showCountdown = 1
        return render_template('home.html',
                               graph=graph,
                               latestBlock=latestBlock,
                               lastTen=lastTen,
                               lastUpdate=lastUpdate,
                               showCountdown=showCountdown)

    return render_template('home.html',
                           graph=graph,
                           latestBlock=latestBlock,
                           lastUpdate=lastUpdate,
                           lastTen=lastTen)
Пример #17
0
def howto():
    conn = db.connect()
    latestBlock = db.getLatestBlockFromDB(conn)
    conn.close()

    return render_template('howto.html', latestBlock=latestBlock)
Пример #18
0
def alert():
    conn = db.connect()
    latestBlock = db.getLatestBlockFromDB(conn)
    conn.close()
    return render_template('alerts.html', latestBlock=latestBlock)