예제 #1
0
파일: bot.py 프로젝트: bomb-on/conceal-bot
async def stats():
    """ .stats - Returns all network stats """
    data = daemon.getlastblockheader()
    hashrate = format_hash(float(data["block_header"]["difficulty"]) / 120)
    data = daemon.getlastblockheader()
    height = int(data["block_header"]["height"])
    deposits = int(data["block_header"]["deposits"]) / 1000000
    supply = get_supply()
    data = daemon.getlastblockheader()
    difficulty = float(data["block_header"]["difficulty"])
    stats_embed = discord.Embed(title="Conceal",
                                url="https://github.com/TheCircleFoundation/",
                                description="Complete Network Stats",
                                color=0x7F7FFF)
    stats_embed.set_thumbnail(url=config['logo_url'])
    hashFromPools = 0
    allPools = session2.query(pool).all()
    totalPools = len(allPools)
    for poolNumber in range(0, totalPools):
        poolHash = allPools[poolNumber].hashrate
        hashFromPools = hashFromPools + poolHash
    stats_embed.add_field(name="Hashrate (from Pools)",
                          value="{}KH/s".format(hashFromPools / 1000))
    stats_embed.add_field(name="Hashrate (from Difficulty)",
                          value="{}/s".format(hashrate))
    stats_embed.add_field(name="Height", value="{:,}".format(height))
    stats_embed.add_field(name="Difficulty",
                          value="{0:,.0f}".format(difficulty))
    stats_embed.add_field(name="Circulating Supply",
                          value="{:0,.2f} CCX".format(supply))
    stats_embed.add_field(name="Deposits", value="{:0,.2f}".format(deposits))
    stats_embed.set_footer(
        text="Powered by the Conceal Discord bot. Message @katz for any issues."
    )
    await client.say(embed=stats_embed)
예제 #2
0
async def difficulty():
    """ Returns network difficulty """
    data = daemon.getlastblockheader()
    difficulty = float(data["block_header"]["difficulty"])
    await client.say(
        "The current difficulty is **{0:,.0f}**".format(difficulty))
예제 #3
0
async def hashrate():
    """ Returns network hashrate """
    data = daemon.getlastblockheader()
    hashrate = format_hash(float(data["block_header"]["difficulty"]) / 30)
    await client.say("The current global hashrate is **{}/s**".format(hashrate)
                     )
예제 #4
0
파일: bot.py 프로젝트: bomb-on/conceal-bot
async def height():
    """ .height - Returns the current blockchain height """
    data = daemon.getlastblockheader()
    height = int(data["block_header"]["height"])
    await client.say("The current block height is **{:,}**".format(height))