From c071d9ae7ccf84e04a0133baaec038856147f9ca Mon Sep 17 00:00:00 2001 From: curly60e <55191248+curly60e@users.noreply.github.com> Date: Sun, 10 May 2020 21:11:21 -0300 Subject: [PATCH] New update v0.0.2.2 --- Python-BlockClock.py | 67 ++++++++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 30 deletions(-) diff --git a/Python-BlockClock.py b/Python-BlockClock.py index 020cccc..c645f84 100644 --- a/Python-BlockClock.py +++ b/Python-BlockClock.py @@ -1,3 +1,7 @@ +#Developer: Curly60e +#Python BlockClock its a clock of the Bitcoin blockchain. +#Version: 0.0.2.2 + import os import time as t from art import * @@ -7,19 +11,20 @@ def getblock(): # get access to bitcoin-cli with the command getblockchaininfo bitcoincli = " getblockchaininfo" os.system(path + bitcoincli) - def getblockcount(): # get access to bitcoin-cli with the command getblockcount bitcoincli = " getblockcount" os.system(path + bitcoincli) def clear(): # clear the screen os.system('cls' if os.name=='nt' else 'clear') - + +#-------------------From this line the program starts---------------------- def connection(conn): # here we initiate the connection function if conn == "Y" or conn == "y": nodeinfo() # call 'nodeinfo' function that makes the connection to an external node else: + clear() a = input("Do you want to see just Block height? 'Yes', for just Block Height. 'No', for full blockchain data. Y/n: ") if a == "y" or a == "Y": while True: @@ -35,52 +40,54 @@ def connection(conn): # here we initiate the connection function def connected(info): # here we complete the connection to the external node if info == "Y" or info == "y": - user = input("USER@NODE: ") - s = input("Do you want to see the blockheight? Y/n: ") - if s == "Y" or s == "y": - c = input("Do you want to see custom design? Y/n: ") - if c == "Y" or c == "y": - while True: # connection via ssh - clear() - sshb = "ssh " + user + " '" + "{}".format(path) + "'" + " getblockcount" - sshc = os.popen(str(sshb)).read() - sshd = sshc - tprint(sshd, font="rnd-large") - tmp() - - else: - while True: # connection via ssh - clear() - sshb = "ssh " + user + " '" + "{}".format(path) + "'" + " getblockchaininfo" - os.system(sshb) - sshc = os.popen(str(sshb)).read() - sshd = sshc - tmp() + userconn() else: connection(input("Are you going to connect to an external node? Y/n: ")) - def nodeinfo(): print("\nAdd your node information\n") connected(input("Are you sure you want to connect to a node? Y/n: ")) # call 'connected' function to make the connection with the node information - def artist(): # here we convert the result of the command 'getblockcount' on a random art design custom = input("Do you want random designs? Y/n: ") if custom == "Y" or custom == "y": while True: clear() - bitcoinclient = path + " getblockcount" - block = os.popen(str(bitcoinclient)).read() # 'getblockcount' convert to string - b = block - tprint(b, font="rnd-large") + design() tmp() else: while True: clear() getblockcount() tmp() - + +def design(): + bitcoinclient = path + " getblockcount" + block = os.popen(str(bitcoinclient)).read() # 'getblockcount' convert to string + b = block + tprint(b, font="rnd-large") + +def userconn(): + user = input("USER@NODE: ") + s = input("Do you want to see the blockheight? Y/n: ") + if s == "Y" or s == "y": + clear() + c = input("Do you want to see custom design? Y/n: ") + if c == "Y" or c == "y": + while True: # connection via ssh + clear() + sshb = "ssh " + user + " '" + "{}".format(path) + "'" + " getblockcount" + sshc = os.popen(str(sshb)).read() + sshd = sshc + tprint(sshd, font="rnd-large") + tmp() + + else: + while True: # connection via ssh + clear() + sshb = "ssh " + user + " '" + "{}".format(path) + "'" + " getblockchaininfo" + os.system(sshb) + tmp() def tmp(): t.sleep(15)