|
|
@ -51,3 +51,21 @@ def mempool(update, context):
|
|
|
|
update.message.reply_text('The current number of transactions in mempool is: {0}'.format(txs))
|
|
|
|
update.message.reply_text('The current number of transactions in mempool is: {0}'.format(txs))
|
|
|
|
except:
|
|
|
|
except:
|
|
|
|
update.message.reply_text('Something borked -_-')
|
|
|
|
update.message.reply_text('Something borked -_-')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@log_event
|
|
|
|
|
|
|
|
@check_debug
|
|
|
|
|
|
|
|
def network(update, context):
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
payload = {'jsonrpc':'2.0', 'id':'0', 'method':'get_info'}
|
|
|
|
|
|
|
|
headers = {'Content-Type':'application/json'}
|
|
|
|
|
|
|
|
r = requests.post(config.DAEMON_URI + '/json_rpc', json=payload, headers=headers, timeout=5)
|
|
|
|
|
|
|
|
r.raise_for_status()
|
|
|
|
|
|
|
|
j = r.json()
|
|
|
|
|
|
|
|
height = j['result']['height']
|
|
|
|
|
|
|
|
diff = j['result']['difficulty']
|
|
|
|
|
|
|
|
hashrate = float(diff)/120
|
|
|
|
|
|
|
|
update.message.reply_text('The current block height is {0:,}. Difficulty is {1:,}. Hashrate is {2:.2f} Mh/s.'.format(
|
|
|
|
|
|
|
|
height, diff, hashrate/1e6
|
|
|
|
|
|
|
|
))
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
update.message.reply_text('Something borked -_-')
|