pyblock/PyBlock.py

1332 lines
39 KiB
Python
Raw Normal View History

2020-05-10 21:11:21 -03:00
#Developer: Curly60e
#PyBLOCK its a clock of the Bitcoin blockchain.
2020-07-13 19:28:56 -03:00
#Version: 0.6.0b
2020-05-10 21:11:21 -03:00
2020-05-06 16:34:55 -03:00
import os
import os.path
2020-05-06 16:34:55 -03:00
import time as t
import pickle
import psutil
2020-05-29 11:52:29 -03:00
import qrcode
2020-06-19 17:51:28 -03:00
import random
import xmltodict
2020-06-24 17:08:28 -03:00
import sys
2020-06-25 11:25:36 -03:00
import subprocess
2020-07-13 19:28:56 -03:00
import requests
import json
import simplejson as json
from clone import *
from donation import *
from feed import *
from art import *
from logos import *
from sysinf import *
from pblogo import *
from apisnd import *
2020-06-19 17:51:28 -03:00
from ppi import *
from nodeconnection import *
2020-05-29 11:52:29 -03:00
from terminal_matrix.matrix import *
2020-05-06 16:34:55 -03:00
def sysinfo(): #Cpu and memory usage
print(" \033[0;37;40m----------------------")
print(" \033[3;33;40mCPU Usage: \033[1;32;40m" + str(psutil.cpu_percent()) + "%\033[0;37;40m")
print(" \033[3;33;40mMemory Usage: \033[1;32;40m" "{}% \033[0;37;40m".format(int(psutil.virtual_memory().percent)))
print(" \033[0;37;40m----------------------")
def getblock(): # get access to bitcoin-cli with the command getblockchaininfo
bitcoincli = " getblockchaininfo"
2020-06-25 12:15:27 -03:00
a = os.popen(path['bitcoincli'] + bitcoincli).read()
b = json.loads(a)
d = b
print(d)
clear()
print("\033[1;32;40m")
blogo()
print("\033[0;37;40m")
print("<<< Back to the Main Menu Press Control + C.\n\n")
2020-06-25 20:27:22 -03:00
print("\n----------------------------------------------------------------------------------------------------")
print("""
Chain: {}
Blocks: {}
Best BlockHash: {}
Difficulty: {}
Verification Progress: {}
Size on Disk: {}
Pruned: {}
""".format(d['chain'], d['blocks'], d['bestblockhash'], d['difficulty'], d['verificationprogress'], d['size_on_disk'], d['pruned']))
2020-06-25 20:27:22 -03:00
print("----------------------------------------------------------------------------------------------------\n")
def getblockcount(): # get access to bitcoin-cli with the command getblockcount
bitcoincli = " getblockcount"
os.system(path['bitcoincli'] + bitcoincli)
def clear(): # clear the screen
os.system('cls' if os.name=='nt' else 'clear')
2020-06-10 19:02:49 -03:00
def getgenesis(): # get and decode Genesis block
bitcoincli = " getblock 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f 0 | xxd -r -p | hexyl -n 256"
os.system(path['bitcoincli'] + bitcoincli)
2020-06-10 19:02:49 -03:00
def close():
print("<<< Back to the Main Menu Press Control + C.\n\n")
2020-06-10 19:02:49 -03:00
def readHexBlock(): # Hex Decoder using Hexyl on local node
hexa = input("Add the Block Hash you want to decode: ")
blocknumber = input("Add the Block number: ")
decodeBlock = path['bitcoincli'] + " getblock {} {}".format(hexa, blocknumber) + " | xxd -r -p | hexyl -n 256"
os.system(decodeBlock)
2020-06-10 19:02:49 -03:00
def readHexTx(): # Hex Decoder using Hexyl on an external node
hexa = input("Add the Transaction ID. you want to decode: ")
decodeTX = path['bitcoincli'] + " getrawtransaction {}".format(hexa) + " | xxd -r -p | hexyl -n 256"
os.system(decodeTX)
2020-06-10 19:02:49 -03:00
def prt():
print("\033[1;32;40m")
blogo()
print("\033[0;37;40m")
def tmp():
t.sleep(15)
def console(): # get into the console from bitcoin-cli
print("\t\033[0;37;40mThis is \033[1;33;40mBitcoin-cli's \033[0;37;40mconsole. Type your respective commands you want to display.\n\n")
while True:
cle = input("\033[1;32;40mconsole $>: \033[0;37;40m")
lsd = os.popen(path['bitcoincli'] + " " + cle)
lsd0 = lsd.read()
lsd1 = str(lsd0)
print(lsd1)
lsd.close()
2020-05-29 11:52:29 -03:00
def screensv():
try:
doit()
except (KeyboardInterrupt, SystemExit):
matrix.close()
clear()
ptr()
menu()
2020-06-24 17:08:28 -03:00
def delay_print(s):
for c in s:
sys.stdout.write(c)
sys.stdout.flush()
time.sleep(0.25)
2020-06-04 14:28:45 -03:00
#------------------------------------------------------
def connected(info): # here we complete the connection to the external node
2020-06-25 18:53:52 +00:00
if info in ["Y", "y"]:
2020-05-13 19:47:58 -03:00
clear()
prt()
print("\nAdd your node information\n")
menuUserConn()
else:
2020-05-13 19:47:58 -03:00
menu()
2020-05-24 14:15:12 -03:00
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: ")
2020-06-25 18:53:52 +00:00
if custom in ["Y", "y"]:
while True:
try:
clear()
close()
design()
tmp()
except (KeyboardInterrupt, SystemExit):
menu()
raise
else:
while True:
try:
clear()
close()
getblockcount()
tmp()
except (KeyboardInterrupt, SystemExit):
menu()
raise
2020-05-10 21:11:21 -03:00
def design():
bitcoinclient = path['bitcoincli'] + " getblockcount"
2020-05-10 21:11:21 -03:00
block = os.popen(str(bitcoinclient)).read() # 'getblockcount' convert to string
2020-05-24 14:15:12 -03:00
b = block
print("\033[1;32;40m")
tprint(b, font="rnd-large")
print("\033[0;37;40m")
#--------------------------------- Hex Block Decoder Functions -------------------------------------
def getrawtx(): # show confirmatins from transactions
tx = input("Insert your TxID: ")
while True:
try:
clear()
prt()
close()
2020-05-27 17:34:26 -03:00
if tx == "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b":
print("""\t\t\n\033[1;35;40mThis transaction it's the first one of the Bitcoin Blockchain on Block 0 by Satoshi Nakamoto.
You can decode that block in HEX and see what's inside.\033[0;37;40m""")
t.sleep(10)
else:
2020-06-25 18:53:52 +00:00
bitcoincli = " getrawtransaction "
lsd = os.popen(path['bitcoincli'] + bitcoincli + tx + " 1")
2020-05-27 17:34:26 -03:00
lsd0 = lsd.read()
lsd1 = str(lsd0)
lsda = lsd1.split(',')
lsdb = lsda[-3]
2020-06-10 19:02:49 -03:00
lsdc = str(lsdb)
print("\033[0;37;40mTransaction " + "\033[1;31;40m{}\033[0;37;40m".format(tx) + " has:\n" + "\033[1;31;40m{}\033[0;37;40m".format(lsdc))
2020-05-27 17:34:26 -03:00
tmp()
lsd.close()
except (KeyboardInterrupt, SystemExit):
menu()
#--------------------------------- End Hex Block Decoder Functions -------------------------------------
2020-05-24 14:15:12 -03:00
#--------------------------------- Menu section -----------------------------------
def menu(): #Main Menu
2020-05-13 19:47:58 -03:00
clear()
prt()
sysinfo()
2020-05-13 19:47:58 -03:00
print("""\t\t
\033[1;31;40mPyBLOCK\033[0;37;40m Menu
Local Node
Version 0.6.0
\033[1;31;40mA.\033[0;37;40m Run PyBLOCK
\033[1;32;40mB.\033[0;37;40m Show Blockchain information
\033[1;32;40mC.\033[0;37;40m Show the Genesis Block
\033[1;32;40mD.\033[0;37;40m Decode in HEX any block
\033[1;32;40mE.\033[0;37;40m Decode in HEX any transaction
\033[1;32;40mF.\033[0;37;40m Show confirmations from a transaction
\033[1;32;40mH.\033[0;37;40m Advanced
2020-05-29 11:52:29 -03:00
\033[1;33;40mL.\033[0;37;40m Lightning Network
\033[1;34;40mS.\033[0;37;40m SatNode
2020-06-19 17:51:28 -03:00
\033[3;33;40mP.\033[0;37;40m Premium
\033[1;35;40mX.\033[0;37;40m Donate
\033[1;33;40mQ.\033[0;37;40m Exit
2020-07-13 19:28:56 -03:00
\n\n""".format(checkupdate()))
menuA(input("\033[1;32;40mSelect option: \033[0;37;40m"))
2020-05-24 14:15:12 -03:00
def menuUserConn(): #Menu before connection over ssh
clear()
prt()
sysinfo()
print("""\t\t
\033[1;31;40mPyBLOCK\033[0;37;40m Menu
Remote Node RPC
Version 0.6.0
\033[1;31;40mA.\033[0;37;40m Run PyBLOCK
\033[1;32;40mB.\033[0;37;40m Show Blockchain information
\033[1;33;40mL.\033[0;37;40m Lightning Network
\033[1;32;40mH.\033[0;37;40m Advanced
\033[1;34;40mS.\033[0;37;40m SatNode
2020-06-19 17:51:28 -03:00
\033[3;33;40mP.\033[0;37;40m Premium
\033[1;35;40mX.\033[0;37;40m Donate
\033[1;33;40mQ.\033[0;37;40m Exit
2020-07-13 19:28:56 -03:00
\n\n""".format(checkupdate()))
menuRemote(input("\033[1;32;40mSelect option: \033[0;37;40m"))
2020-05-24 14:15:12 -03:00
def advanceMenu(): # Advanced Menu
clear()
prt()
sysinfo()
print("""\t\t
\033[1;31;40mPyBLOCK\033[0;37;40m Menu
Version 0.6.0
\033[1;32;40mA.\033[0;37;40m Bitconi-cli Console
\033[1;32;40mB.\033[0;37;40m FunB
\033[1;32;40mC.\033[0;37;40m Show QR from a Bitcoin Address
\033[1;32;40mS.\033[0;37;40m Sysinfo
\033[1;36;40mR.\033[0;37;40m Return Main Menu
\n\n""")
menuB(input("\033[1;32;40mSelect option: \033[0;37;40m"))
2020-06-11 18:46:16 -03:00
def remoteadvanceMenu(): # Advanced Menu
clear()
prt()
sysinfo()
print("""\t\t
\033[1;31;40mPyBLOCK\033[0;37;40m Menu
Version 0.6.0
2020-06-11 18:46:16 -03:00
\033[1;32;40mA.\033[0;37;40m Bitconi-cli Console
\033[1;32;40mB.\033[0;37;40m FunB
\033[1;32;40mC.\033[0;37;40m Show QR from a Bitcoin Address
\033[1;32;40mS.\033[0;37;40m Sysinfo
\033[1;36;40mR.\033[0;37;40m Return Main Menu
\n\n""")
menuBA(input("\033[1;32;40mSelect option: \033[0;37;40m"))
def dnt(): # Donation selection menu
clear()
prt()
sysinfo()
print("""\t\t
\033[1;31;40mPyBLOCK\033[0;37;40m Menu
Version 0.6.0
2020-05-24 14:15:12 -03:00
\033[1;32;40mA.\033[0;37;40m Developers Donation
\033[1;32;40mB.\033[0;37;40m Testers Donation
\033[1;36;40mR.\033[0;37;40m Return Main Menu
\n\n""")
menuC(input("\033[1;32;40mSelect option: \033[0;37;40m"))
2020-05-24 14:15:12 -03:00
def dntDev(): # Dev Donation Menu
clear()
prt()
sysinfo()
print("""\t\t
\033[1;31;40mPyBLOCK\033[0;37;40m Menu
Version 0.6.0
2020-05-24 14:15:12 -03:00
\033[1;32;40mA.\033[0;37;40m PayNym
\033[1;32;40mB.\033[0;37;40m Bitcoin Address
\033[1;32;40mC.\033[0;37;40m Lightning Network
\033[1;36;40mR.\033[0;37;40m Return Main Menu
\n\n""")
menuE(input("\033[1;32;40mSelect option: \033[0;37;40m"))
2020-05-24 14:15:12 -03:00
def dntTst(): # Tester Donation Menu
clear()
prt()
sysinfo()
print("""\t\t
\033[1;31;40mPyBLOCK\033[0;37;40m Menu
Version 0.6.0
2020-05-24 14:15:12 -03:00
\033[1;32;40mA.\033[0;37;40m Bitcoin Address
\033[1;32;40mB.\033[0;37;40m Lightning Network
\033[1;36;40mR.\033[0;37;40m Return Main Menu
\n\n""")
menuF(input("\033[1;32;40mSelect option: \033[0;37;40m"))
2020-05-24 14:15:12 -03:00
def satnodeMenu(): # Satnode Menu
clear()
prt()
sysinfo()
print("""\t\t
\033[1;31;40mPyBLOCK\033[0;37;40m Menu
Version 0.6.0
\033[1;32;40mA.\033[0;37;40m Start SatNode
\033[1;32;40mB.\033[0;37;40m Feed
\033[1;32;40mC.\033[0;37;40m Setup
\033[1;34;40mS.\033[0;37;40m Send a Message to Space
\033[1;36;40mD.\033[0;37;40m Return Main Menu
\n\n""")
menuD(input("\033[1;32;40mSelect option: \033[0;37;40m"))
2020-05-29 11:52:29 -03:00
def menuLND():
clear()
prt()
sysinfo()
print("""\t\t
\033[1;31;40mPyBLOCK\033[0;37;40m Lightning Network Menu
Remote node connection
Version 0.6.0
2020-05-29 11:52:29 -03:00
\033[1;32;40mI.\033[0;37;40m New Invoice
2020-05-29 11:52:29 -03:00
\033[1;31;40mP.\033[0;37;40m Pay Invoice
2020-06-04 14:28:45 -03:00
\033[1;32;40mQ.\033[0;37;40m Channel Balance
\033[1;31;40mL.\033[0;37;40m List Invoices
\033[1;32;40mC.\033[0;37;40m Show Channels
\033[1;33;40mB.\033[0;37;40m New Bitcoin Address
\033[1;33;40mX.\033[0;37;40m List Onchain Transactions
2020-06-04 14:28:45 -03:00
\033[1;32;40mN.\033[0;37;40m Get Node Info
\033[1;32;40mO.\033[0;37;40m Onchain Balance
2020-05-29 11:52:29 -03:00
\033[1;36;40mR.\033[0;37;40m Return Main Menu
\n\n""")
menuLN(input("\033[1;32;40mSelect option: \033[0;37;40m"))
2020-05-24 14:15:12 -03:00
2020-06-10 19:02:49 -03:00
def menuLNDLOCAL():
clear()
prt()
sysinfo()
print("""\t\t
\033[1;31;40mPyBLOCK\033[0;37;40m Lightning Network Menu
Local node connection
Version 0.6.0
2020-06-10 19:02:49 -03:00
\033[1;32;40mI.\033[0;37;40m New Invoice
\033[1;31;40mP.\033[0;37;40m Pay Invoice
2020-06-10 20:28:39 -03:00
\033[1;32;40mK.\033[0;37;40m Make a KeySend Payment
\033[1;31;40mL.\033[0;37;40m List Invoices
2020-06-10 19:02:49 -03:00
\033[1;32;40mQ.\033[0;37;40m Channel Balance
2020-06-10 20:28:39 -03:00
\033[1;32;40mC.\033[0;37;40m Show Channels
2020-06-10 19:02:49 -03:00
\033[1;32;40mN.\033[0;37;40m Get Node Info
\033[1;32;40mW.\033[0;37;40m Get Network Information
2020-06-19 17:51:28 -03:00
\033[1;32;40mJ.\033[0;37;40m Lncli Console
2020-06-10 20:28:39 -03:00
\033[1;33;40mB.\033[0;37;40m New Bitcoin Address
\033[1;33;40mX.\033[0;37;40m List Onchain Transactions
\033[1;32;40mO.\033[0;37;40m Onchain Balance
2020-06-10 19:02:49 -03:00
\033[1;36;40mR.\033[0;37;40m Return Main Menu
\n\n""")
menuLNlocal(input("\033[1;32;40mSelect option: \033[0;37;40m"))
2020-06-19 17:51:28 -03:00
def APIMenu():
clear()
prt()
sysinfo()
print("""\t\t
\033[1;31;40mPyBLOCK\033[0;37;40m API \033[1;34;40mPremium\033[0;37;40m Menu
Version 0.6.0
2020-06-19 17:51:28 -03:00
\033[1;32;40mA.\033[0;37;40m TippinMe FREE
\033[1;32;40mB.\033[0;37;40m TallyCo FREE
\033[1;32;40mC.\033[0;37;40m LNBits \033[3;35;40m{lnbitspaid}\033[0;37;40m
\033[1;32;40mD.\033[0;37;40m LNPay \033[3;35;40m{lnpaypaid}\033[0;37;40m
\033[1;32;40mE.\033[0;37;40m OpenNode \033[3;35;40m{opennodepaid}\033[0;37;40m
2020-06-19 17:51:28 -03:00
\033[1;36;40mR.\033[0;37;40m Return Main Menu
\n\n""".format(lnbitspaid = "PAID" if os.path.isfile("lnbitSN.conf") else "PREMIUM", lnpaypaid = "PAID" if os.path.isfile("lnpaySN.conf") else "PREMIUM", opennodepaid = "PAID" if os.path.isfile("opennodeSN.conf") else "PREMIUM"))
2020-06-19 17:51:28 -03:00
menuPI(input("\033[1;32;40mSelect option: \033[0;37;40m"))
def APILnbit():
bitLN = {"NN":"","pd":""}
if os.path.isfile('lnbitSN.conf'): # Check if the file 'bclock.conf' is in the same folder
bitData= pickle.load(open("lnbitSN.conf", "rb")) # Load the file 'bclock.conf'
bitLN = bitData # Copy the variable pathv to 'path'
2020-06-19 17:51:28 -03:00
clear()
prt()
sysinfo()
print("""\t\t
\033[1;31;40mPyBLOCK\033[0;37;40m LNBits SN:{} \033[1;34;40mPremium\033[0;37;40m Menu
Version 0.6.0
2020-06-19 17:51:28 -03:00
\033[1;32;40mA.\033[0;37;40m New Invoice
\033[1;32;40mB.\033[0;37;40m Pay Invoice
\033[1;32;40mC.\033[0;37;40m New PayWall
\033[1;32;40mD.\033[0;37;40m Delete PayWall
\033[1;32;40mE.\033[0;37;40m List PayWalls
\033[1;36;40mR.\033[0;37;40m Return Main Menu
\n\n""".format(bitLN['NN']))
2020-06-19 17:51:28 -03:00
menuLNBPI(input("\033[1;32;40mSelect option: \033[0;37;40m"))
2020-06-22 14:26:07 -03:00
def APILnPay():
bitLN = {"NN":"","pd":""}
if os.path.isfile('lnpaySN.conf'): # Check if the file 'bclock.conf' is in the same folder
bitData= pickle.load(open("lnpaySN.conf", "rb")) # Load the file 'bclock.conf'
bitLN = bitData # Copy the variable pathv to 'path'
2020-06-22 14:26:07 -03:00
clear()
prt()
sysinfo()
print("""\t\t
\033[1;31;40mPyBLOCK\033[0;37;40m LNPay SN:{} \033[1;34;40mPremium\033[0;37;40m Menu
Version 0.6.0
2020-06-22 14:26:07 -03:00
\033[1;32;40mA.\033[0;37;40m New Invoice
\033[1;32;40mB.\033[0;37;40m Pay Invoice
\033[1;32;40mC.\033[0;37;40m Wallet Balance
\033[1;32;40mD.\033[0;37;40m List Invoices
\033[1;32;40mE.\033[0;37;40m Transfer Between Wallets
\033[1;36;40mR.\033[0;37;40m Return Main Menu
\n\n""".format(bitLN['NN']))
2020-06-22 14:26:07 -03:00
menuLNPAY(input("\033[1;32;40mSelect option: \033[0;37;40m"))
def APIOpenNode():
bitLN = {"NN":"","pd":""}
if os.path.isfile('opennodeSN.conf'): # Check if the file 'bclock.conf' is in the same folder
bitData= pickle.load(open("opennodeSN.conf", "rb")) # Load the file 'bclock.conf'
bitLN = bitData # Copy the variable pathv to 'path'
2020-06-22 14:26:07 -03:00
clear()
prt()
sysinfo()
print("""\t\t
\033[1;31;40mPyBLOCK\033[0;37;40m OpenNode SN:{} \033[1;34;40mPremium\033[0;37;40m Menu
Version 0.6.0
2020-06-22 14:26:07 -03:00
\033[1;32;40mA.\033[0;37;40m New Invoice
\033[1;32;40mB.\033[0;37;40m Pay Invoice
\033[1;32;40mC.\033[0;37;40m Wallet Balance
\033[1;32;40mD.\033[0;37;40m List Payments
\033[1;32;40mS.\033[0;37;40m Status
2020-06-22 14:26:07 -03:00
\033[1;36;40mR.\033[0;37;40m Return Main Menu
\n\n""".format(bitLN['NN']))
2020-06-22 14:26:07 -03:00
menuOpenNode(input("\033[1;32;40mSelect option: \033[0;37;40m"))
def APITippinMe():
clear()
prt()
sysinfo()
print("""\t\t
\033[1;31;40mPyBLOCK\033[0;37;40m TippinMe \033[1;34;40mFree\033[0;37;40m Menu
Version 0.6.0
\033[1;32;40mA.\033[0;37;40m New Invoice
\033[1;36;40mR.\033[0;37;40m Return Main Menu
\n\n""")
menuTippinMe(input("\033[1;32;40mSelect option: \033[0;37;40m"))
def APITallyCo():
clear()
prt()
sysinfo()
print("""\t\t
\033[1;31;40mPyBLOCK\033[0;37;40m TallyCoin \033[1;34;40mFree\033[0;37;40m Menu
Version 0.6.0
\033[1;32;40mA.\033[0;37;40m Get Payment
\033[1;32;40mB.\033[0;37;40m Tip User
\033[1;36;40mR.\033[0;37;40m Return Main Menu
\n\n""")
menuTallyCo(input("\033[1;32;40mSelect option: \033[0;37;40m"))
def menuSelection():
path = {"ip_port":"", "rpcuser":"", "rpcpass":"", "bitcoincli":""}
pathv = pickle.load(open("bclock.conf", "rb")) # Load the file 'bclock.conf'
path = pathv # Copy the variable pathv to 'path'
if path['bitcoincli']:
menu()
else:
menuUserConn()
def menuSelectionLN():
2020-06-10 19:02:49 -03:00
lndconnectload = {"ip_port":"", "tls":"", "macaroon":"", "lncli":""}
lndconnectData = pickle.load(open("blndconnect.conf", "rb")) # Load the file 'bclock.conf'
lndconnectload = lndconnectData # Copy the variable pathv to 'path'
if lndconnectload['ln']:
2020-06-10 19:02:49 -03:00
menuLNDLOCAL()
else:
menuLND()
2020-06-19 17:51:28 -03:00
def aaccPPiLNBits():
2020-06-22 22:51:41 -03:00
try:
bitLN = {"NN":"","pd":""}
if os.path.isfile('lnbitSN.conf'):
bitData= pickle.load(open("lnbitSN.conf", "rb"))
bitLN = bitData
APILnbit()
else:
qr = qrcode.QRCode(
version=1,
error_correction=qrcode.constants.ERROR_CORRECT_L,
box_size=10,
border=4,
)
bitLN['NN'] = randrange(10000000)
curl = 'curl -X POST https://lnbits.com/api/v1/payments -d ' + "'{" + """"out": false, "amount": 100000, "memo": "LNBits on PyBLOCK {}" """.format(bitLN['NN']) + "}'" + """ -H "X-Api-Key: 1d646820055e4e2da218e801eaacfc94 " -H "Content-type: application/json" """
sh = os.popen(curl).read()
2020-06-24 17:08:28 -03:00
clear()
prt()
2020-06-22 22:51:41 -03:00
n = str(sh)
d = json.loads(n)
q = d['payment_request']
c = q.lower()
while True:
print("\033[1;30;47m")
qr.add_data(c)
qr.print_ascii()
print("\033[0;37;40m")
qr.clear()
print("Lightning Invoice: " + c)
dn = str(d['checking_id'])
t.sleep(10)
checkcurl = 'curl -X GET https://lnbits.com/api/v1/payments/' + dn + """ -H "X-Api-Key: 1d646820055e4e2da218e801eaacfc94" -H "Content-type: application/json" """
rsh = os.popen(checkcurl).read()
2020-06-19 17:51:28 -03:00
clear()
blogo()
2020-06-22 22:51:41 -03:00
nn = str(rsh)
dd = json.loads(nn)
db = dd['paid']
2020-06-25 11:25:36 -03:00
if db is True:
2020-06-22 22:51:41 -03:00
clear()
blogo()
tick()
bitLN['pd'] = "PAID"
pickle.dump(bitLN, open("lnbitSN.conf", "wb"))
createFileConnLNBits()
break
else:
continue
except:
clear()
blogo()
print("\n\tSERIAL NUMBER NOT FOUND\n")
input("Continue...")
2020-06-19 17:51:28 -03:00
2020-06-22 14:26:07 -03:00
def aaccPPiLNPay():
2020-06-22 22:51:41 -03:00
try:
bitLN = {"NN":"","pd":""}
if os.path.isfile('lnpaySN.conf'): # Check if the file 'bclock.conf' is in the same folder
bitData= pickle.load(open("lnpaySN.conf", "rb")) # Load the file 'bclock.conf'
bitLN = bitData # Copy the variable pathv to 'path'
APILnPay()
else:
qr = qrcode.QRCode(
version=1,
error_correction=qrcode.constants.ERROR_CORRECT_L,
box_size=10,
border=4,
)
bitLN['NN'] = randrange(10000000)
curl = 'curl -X POST https://lnbits.com/api/v1/payments -d ' + "'{" + """"out": false, "amount": 100000, "memo": "LNPay on PyBLOCK {}" """.format(bitLN['NN']) + "}'" + """ -H "X-Api-Key: 1d646820055e4e2da218e801eaacfc94 " -H "Content-type: application/json" """
sh = os.popen(curl).read()
2020-06-24 17:08:28 -03:00
clear()
prt()
2020-06-22 22:51:41 -03:00
n = str(sh)
d = json.loads(n)
q = d['payment_request']
c = q.lower()
while True:
print("\033[1;30;47m")
qr.add_data(c)
qr.print_ascii()
print("\033[0;37;40m")
qr.clear()
print("Lightning Invoice: " + c)
dn = str(d['checking_id'])
t.sleep(10)
checkcurl = 'curl -X GET https://lnbits.com/api/v1/payments/' + dn + """ -H "X-Api-Key: 1d646820055e4e2da218e801eaacfc94" -H "Content-type: application/json" """
rsh = os.popen(checkcurl).read()
2020-06-22 14:26:07 -03:00
clear()
blogo()
2020-06-22 22:51:41 -03:00
nn = str(rsh)
dd = json.loads(nn)
db = dd['paid']
2020-06-25 11:25:36 -03:00
if db is True:
2020-06-22 22:51:41 -03:00
clear()
blogo()
tick()
bitLN['pd'] = "PAID"
pickle.dump(bitLN, open("lnpaySN.conf", "wb"))
createFileConnLNPay()
break
else:
continue
except:
clear()
blogo()
print("\n\tSERIAL NUMBER NOT FOUND\n")
input("Continue...")
2020-06-22 14:26:07 -03:00
def aaccPPiOpenNode():
2020-06-22 22:51:41 -03:00
try:
bitLN = {"NN":"","pd":""}
if os.path.isfile('opennodeSN.conf'): # Check if the file 'bclock.conf' is in the same folder
bitData= pickle.load(open("opennodeSN.conf", "rb")) # Load the file 'bclock.conf'
bitLN = bitData # Copy the variable pathv to 'path'
APIOpenNode()
else:
qr = qrcode.QRCode(
version=1,
error_correction=qrcode.constants.ERROR_CORRECT_L,
box_size=10,
border=4,
)
bitLN['NN'] = randrange(10000000)
curl = 'curl -X POST https://lnbits.com/api/v1/payments -d ' + "'{" + """"out": false, "amount": 100000, "memo": "OpenNode on PyBLOCK {}" """.format(bitLN['NN']) + "}'" + """ -H "X-Api-Key: 1d646820055e4e2da218e801eaacfc94 " -H "Content-type: application/json" """
sh = os.popen(curl).read()
2020-06-24 17:08:28 -03:00
clear()
prt()
2020-06-22 22:51:41 -03:00
n = str(sh)
d = json.loads(n)
q = d['payment_request']
c = q.lower()
while True:
print("\033[1;30;47m")
qr.add_data(c)
qr.print_ascii()
print("\033[0;37;40m")
qr.clear()
print("Lightning Invoice: " + c)
dn = str(d['checking_id'])
t.sleep(10)
checkcurl = 'curl -X GET https://lnbits.com/api/v1/payments/' + dn + """ -H "X-Api-Key: 1d646820055e4e2da218e801eaacfc94" -H "Content-type: application/json" """
rsh = os.popen(checkcurl).read()
2020-06-22 14:26:07 -03:00
clear()
blogo()
2020-06-22 22:51:41 -03:00
nn = str(rsh)
dd = json.loads(nn)
db = dd['paid']
2020-06-25 11:25:36 -03:00
if db is True:
2020-06-22 22:51:41 -03:00
clear()
blogo()
tick()
bitLN['pd'] = "PAID"
pickle.dump(bitLN, open("opennodeSN.conf", "wb"))
createFileConnOpenNode()
break
else:
continue
except:
clear()
blogo()
print("\n\tSERIAL NUMBER NOT FOUND\n")
input("Continue...")
def aaccPPiTippinMe():
if os.path.isfile('tippinme.conf'): # Check if the file 'bclock.conf' is in the same folder
APITippinMe()
else:
2020-06-22 22:02:00 -03:00
createFileTippinMe()
def aaccPPiTallyCo():
if os.path.isfile('tallyco.conf'): # Check if the file 'bclock.conf' is in the same folder
APITallyCo()
else:
createFileConnTallyCo()
2020-07-13 19:28:56 -03:00
def checkupdate():
r = requests.get('https://raw.githubusercontent.com/curly60e/pyblock/master/ver.txt')
2020-07-13 19:30:18 -03:00
version = "0.6.0"
2020-07-13 19:28:56 -03:00
r.headers['Content-Type']
n = r.text
di = json.loads(n)
if di['version'] == version:
q = print(" ")
2020-07-13 22:30:35 +00:00
else:
2020-07-13 19:28:56 -03:00
print("\n---------------------------------------------------")
q = print("\n \033[1;31;40mNew version available\033[0;37;40m > Press U to Upgrade\n")
print("---------------------------------------------------")
def upgrade():
2020-07-13 19:38:24 -03:00
gitfetch = "git fetch"
2020-07-13 19:28:56 -03:00
gitchekcout = "git checkout origin/master -- PyBlock.py ppi.py pblogo.py sysinf.py apisnd.py clone.py donation.py feed.py logos.py nodeconnection.py"
clear()
blogo()
2020-07-13 19:38:24 -03:00
b = os.popen(gitfetch).read()
2020-07-13 19:28:56 -03:00
a = os.popen(gitchekcout).read()
2020-07-13 19:38:24 -03:00
print(b)
2020-07-13 19:28:56 -03:00
print(a)
2020-07-13 19:38:24 -03:00
input("Continue...")
2020-06-10 19:02:49 -03:00
#--------------------------------- End Menu section -----------------------------------
#--------------------------------- Main Menu execution --------------------------------
2020-06-19 17:51:28 -03:00
def menuPI(menuWN):
2020-06-25 18:53:52 +00:00
if menuWN in ["A", "a"]:
aaccPPiTippinMe()
2020-06-25 16:03:22 -03:00
elif menuWN in ["B", "b"]:
aaccPPiTallyCo()
2020-06-25 16:03:22 -03:00
elif menuWN in ["C", "c"]:
aaccPPiLNBits()
2020-06-25 16:03:22 -03:00
elif menuWN in ["D", "d"]:
aaccPPiLNPay()
elif menuWN in ["E", "e"]:
2020-06-22 14:26:07 -03:00
aaccPPiOpenNode()
def menuTallyCo(menuTLC):
if menuTLC in ["A", "a"]:
tallycoGetPayment()
elif menuTLC in ["B", "b"]:
tallycoDonateid()
elif menuTLC in ["R", "r"]:
APIMenu()
def menuTippinMe(menuTM):
2020-06-25 18:53:52 +00:00
if menuTM in ["A", "a"]:
tippinmeGetInvoice()
2020-06-25 16:03:22 -03:00
elif menuTM in ["R", "r"]:
APIMenu()
2020-06-22 14:26:07 -03:00
def menuOpenNode(menuOP):
2020-06-25 18:53:52 +00:00
if menuOP in ["A", "a"]:
2020-06-22 14:26:07 -03:00
clear()
prt()
OpenNodecreatecharge()
2020-06-25 16:03:22 -03:00
elif menuOP in ["B", "b"]:
2020-06-22 14:26:07 -03:00
clear()
prt()
OpenNodeiniciatewithdrawal()
2020-06-25 16:03:22 -03:00
elif menuOP in ["C", "c"]:
2020-06-22 14:26:07 -03:00
clear()
prt()
OpenNodelistfunds()
2020-06-25 16:03:22 -03:00
elif menuOP in ["D", "d"]:
2020-06-22 14:26:07 -03:00
clear()
prt()
OpenNodeListPayments()
elif menuOP in ["S", "s"]:
clear()
prt()
OpenNodeCheckStatus()
2020-06-25 16:03:22 -03:00
elif menuOP in ["R", "r"]:
2020-06-22 14:26:07 -03:00
APIMenu()
def menuLNPAY(menuNW):
2020-06-25 18:53:52 +00:00
if menuNW in ["A", "a"]:
2020-06-22 14:26:07 -03:00
clear()
prt()
lnpayCreateInvoice()
2020-06-25 16:03:22 -03:00
elif menuNW in ["B", "b"]:
2020-06-22 14:26:07 -03:00
clear()
prt()
lnpayPayInvoice()
2020-06-25 16:03:22 -03:00
elif menuNW in ["C", "c"]:
2020-06-22 14:26:07 -03:00
clear()
prt()
lnpayGetBalance()
2020-06-25 16:03:22 -03:00
elif menuNW in ["D", "d"]:
2020-06-22 14:26:07 -03:00
clear()
prt()
lnpayGetTransactions()
2020-06-25 16:03:22 -03:00
elif menuNW in ["E", "e"]:
2020-06-22 14:26:07 -03:00
clear()
prt()
lnpayTransBWallets()
2020-06-25 16:03:22 -03:00
elif menuNW in ["R", "r"]:
2020-06-22 14:26:07 -03:00
APIMenu()
2020-06-19 17:51:28 -03:00
def menuLNBPI(menuLNQ):
2020-06-25 18:53:52 +00:00
if menuLNQ in ["A", "a"]:
2020-06-19 17:51:28 -03:00
clear()
prt()
lnbitCreateNewInvoice()
2020-06-25 16:03:22 -03:00
elif menuLNQ in ["B", "b"]:
2020-06-19 17:51:28 -03:00
clear()
prt()
lnbitPayInvoice()
2020-06-25 16:03:22 -03:00
elif menuLNQ in ["C", "c"]:
2020-06-19 17:51:28 -03:00
clear()
prt()
lnbitCreatePayWall()
2020-06-25 16:03:22 -03:00
elif menuLNQ in ["D", "d"]:
2020-06-19 17:51:28 -03:00
clear()
prt()
lnbitDeletePayWall()
2020-06-25 16:03:22 -03:00
elif menuLNQ in ["E", "e"]:
2020-06-19 17:51:28 -03:00
clear()
prt()
lnbitListPawWall()
2020-06-25 16:03:22 -03:00
elif menuLNQ in ["R", "r"]:
2020-06-19 17:51:28 -03:00
APIMenu()
def menuA(menuS): #Execution of the Main Menu options
2020-06-25 18:53:52 +00:00
if menuS in ["A", "a"]:
artist()
2020-06-25 18:53:52 +00:00
elif menuS in ["B", "b"]:
2020-05-13 19:47:58 -03:00
while True:
try:
clear()
close()
getblock()
tmp()
2020-06-13 19:23:52 -03:00
except:
break
2020-06-25 18:53:52 +00:00
elif menuS in ["C", "c"]:
clear()
prt()
getgenesis()
a = input("Do you want to return to the Main Menu? Y/n: ")
2020-06-25 18:53:52 +00:00
if a in ["Y", "y"]:
menuSelection()
else:
b = input("Do you want to exit? Y/n: ")
2020-06-25 18:53:52 +00:00
if b in ["Y", "y"]:
os._exit(0)
apisnd.close()
donation.close()
clone.close()
logos.close()
feed.close()
2020-05-27 11:01:03 -03:00
sysinf.close()
2020-06-01 09:25:57 -03:00
nodeconnection.close()
exit()
else:
menuSelection()
2020-06-25 18:53:52 +00:00
elif menuS in ["D", "d"]:
clear()
prt()
readHexBlock()
while True:
r = input("Do you want to continue decoding? Y/n: ")
2020-06-25 18:53:52 +00:00
if r in ["Y", "y"]:
clear()
prt()
readHexBlock()
else:
2020-06-13 19:23:52 -03:00
break
2020-06-25 18:53:52 +00:00
elif menuS in ["E", "e"]:
clear()
prt()
readHexTx()
while True:
r = input("Do you want to continue decoding? Y/n: ")
2020-06-25 18:53:52 +00:00
if r in ["Y", "y"]:
clear()
prt()
sysinfo()
readHexTx()
else:
2020-06-13 19:23:52 -03:00
break
2020-06-25 18:53:52 +00:00
elif menuS in ["F", "f"]:
getrawtx()
2020-06-25 18:53:52 +00:00
elif menuS in ["H", "h"]:
advanceMenu()
2020-06-25 18:53:52 +00:00
elif menuS in ["L", "l"]:
2020-05-29 11:52:29 -03:00
clear()
prt()
menuSelectionLN()
2020-06-25 18:53:52 +00:00
elif menuS in ["Q", "q"]:
os._exit(0)
apisnd.close()
donation.close()
clone.close()
logos.close()
feed.close()
sysinf.close()
nodeconnection.close()
exit()
2020-06-25 18:53:52 +00:00
elif menuS in ["S", "s"]:
clear()
prt()
satnodeMenu()
2020-06-25 18:53:52 +00:00
elif menuS in ["P", "p"]:
2020-06-19 17:51:28 -03:00
APIMenu()
2020-06-25 18:53:52 +00:00
elif menuS in ["X", "x"]:
dnt()
2020-07-13 19:28:56 -03:00
elif menuS in ["U", "u"]:
upgrade()
2020-06-25 18:53:52 +00:00
elif menuS in ["T", "t"]:
2020-06-24 17:08:28 -03:00
clear()
delay_print("\033[1;32;40mWake up, Neo...")
2020-06-24 17:08:28 -03:00
t.sleep(2)
clear()
delay_print("The Matrix has you...")
2020-06-24 17:08:28 -03:00
t.sleep(2)
clear()
delay_print("Follow the white rabbit.")
t.sleep(3)
clear()
print("Knock, knock, Neo.\033[0;37;40m\n")
t.sleep(2)
clear()
t.sleep(3)
screensv()
def menuRemote(menuS): #Execution of the Main Menu options
2020-06-25 18:53:52 +00:00
if menuS in ["A", "a"]:
while True:
try:
clear()
close()
remotegetblock()
tmp()
2020-06-13 19:23:52 -03:00
except:
break
2020-06-25 18:53:52 +00:00
elif menuS in ["B", "b"]:
while True:
try:
clear()
close()
remotegetblockcount()
tmp()
2020-06-13 19:23:52 -03:00
except:
break
2020-06-25 18:53:52 +00:00
elif menuS in ["H", "h"]:
2020-06-11 18:46:16 -03:00
remoteadvanceMenu()
2020-06-25 18:53:52 +00:00
elif menuS in ["L", "l"]:
clear()
prt()
menuSelectionLN()
2020-06-25 18:53:52 +00:00
elif menuS in ["Q", "q"]:
os._exit(0)
apisnd.close()
donation.close()
clone.close()
logos.close()
feed.close()
2020-05-27 11:01:03 -03:00
sysinf.close()
2020-06-01 09:25:57 -03:00
nodeconnection.close()
exit()
2020-06-25 18:53:52 +00:00
elif menuS in ["S", "s"]:
clear()
prt()
satnodeMenu()
2020-06-25 18:53:52 +00:00
elif menuS in ["P", "p"]:
2020-06-19 17:51:28 -03:00
APIMenu()
2020-06-25 18:53:52 +00:00
elif menuS in ["X", "x"]:
dnt()
2020-07-13 19:28:56 -03:00
elif menuS in ["U", "u"]:
upgrade()
2020-06-25 18:53:52 +00:00
elif menuS in ["T", "t"]: #Test feature fast access
2020-06-24 17:08:28 -03:00
clear()
delay_print("\033[1;32;40mWake up, Neo...")
2020-06-24 17:08:28 -03:00
t.sleep(2)
clear()
delay_print("The Matrix has you...")
2020-06-24 17:08:28 -03:00
t.sleep(2)
clear()
delay_print("Follow the white rabbit.")
t.sleep(3)
clear()
print("Knock, knock, Neo.\033[0;37;40m\n")
t.sleep(2)
clear()
t.sleep(3)
2020-05-29 11:52:29 -03:00
screensv()
2020-06-10 19:02:49 -03:00
#------------------------------------------REMOTE
2020-05-29 11:52:29 -03:00
def menuLN(menuLL):
2020-06-25 18:53:52 +00:00
if menuLL in ["I", "i"]:
2020-05-29 11:52:29 -03:00
clear()
prt()
2020-06-10 19:02:49 -03:00
getnewinvoice()
2020-06-25 18:53:52 +00:00
elif menuLL in ["P", "p"]:
2020-05-29 11:52:29 -03:00
clear()
prt()
payinvoice()
2020-06-25 18:53:52 +00:00
elif menuLL in ["Q", "q"]:
clear()
prt()
2020-06-04 14:28:45 -03:00
channelbalance()
2020-06-25 18:53:52 +00:00
elif menuLL in ["L", "l"]:
clear()
prt()
listinvoice()
2020-06-25 18:53:52 +00:00
elif menuLL in ["X", "x"]:
clear()
prt()
listonchaintxs()
2020-06-25 18:53:52 +00:00
elif menuLL in ["C", "c"]:
clear()
prt()
channels()
2020-06-25 18:53:52 +00:00
elif menuLL in ["B", "b"]:
clear()
prt()
2020-06-04 14:28:45 -03:00
getnewaddress()
2020-06-25 18:53:52 +00:00
elif menuLL in ["N", "n"]:
clear()
prt()
2020-06-10 19:02:49 -03:00
getinfo()
2020-06-25 18:53:52 +00:00
elif menuLL in ["O", "o"]:
clear()
prt()
2020-06-10 19:02:49 -03:00
balanceOC()
2020-06-25 18:53:52 +00:00
elif menuLL in ["R", "r"]:
menuUserConn()
2020-06-10 19:02:49 -03:00
#------------------------------------------END REMOTE
#------------------------------------------LOCAL
def menuLNlocal(menuLL):
2020-06-25 18:53:52 +00:00
if menuLL in ["I", "i"]:
2020-06-10 19:02:49 -03:00
clear()
prt()
localaddinvoice()
2020-06-25 18:53:52 +00:00
elif menuLL in ["P", "p"]:
2020-06-10 19:02:49 -03:00
clear()
prt()
localpayinvoice()
2020-06-25 18:53:52 +00:00
elif menuLL in ["Q", "q"]:
2020-06-10 19:02:49 -03:00
clear()
prt()
localchannelbalance()
2020-06-25 18:53:52 +00:00
elif menuLL in ["L", "l"]:
2020-06-10 19:02:49 -03:00
clear()
prt()
2020-06-10 20:28:39 -03:00
locallistinvoices()
2020-06-25 18:53:52 +00:00
elif menuLL in ["X", "x"]:
2020-06-10 19:02:49 -03:00
clear()
prt()
2020-06-10 20:28:39 -03:00
locallistchaintxns()
2020-06-25 18:53:52 +00:00
elif menuLL in ["C", "c"]:
2020-06-10 20:28:39 -03:00
clear()
prt()
locallistchannels()
2020-06-25 18:53:52 +00:00
elif menuLL in ["B", "b"]:
2020-06-10 20:28:39 -03:00
clear()
prt()
localnewaddress()
2020-06-25 18:53:52 +00:00
elif menuLL in ["N", "n"]:
2020-06-10 19:02:49 -03:00
clear()
prt()
localgetinfo()
2020-06-25 18:53:52 +00:00
elif menuLL in ["O", "o"]:
2020-06-10 19:02:49 -03:00
clear()
prt()
localbalanceOC()
2020-06-25 18:53:52 +00:00
elif menuLL in ["W", "w"]:
2020-06-10 19:02:49 -03:00
clear()
prt()
localgetnetworkinfo()
2020-06-25 18:53:52 +00:00
elif menuLL in ["J", "j"]:
2020-06-19 17:51:28 -03:00
while True:
try:
clear()
prt()
sysinfo()
close()
consoleLN()
t.sleep(5)
except:
break
2020-06-25 18:53:52 +00:00
elif menuLL in ["K", "k"]:
2020-06-10 19:02:49 -03:00
clear()
prt()
localkeysend()
2020-06-25 18:53:52 +00:00
elif menuLL in ["R", "r"]:
menuSelection()
2020-06-10 19:02:49 -03:00
#------------------------------------------END LOCAL
def menuB(menuR): # Advanced access Menu
2020-06-25 18:53:52 +00:00
if menuR in ["A", "a"]:
while True:
try:
clear()
prt()
sysinfo()
close()
console()
t.sleep(5)
2020-06-13 19:23:52 -03:00
except:
break
2020-06-25 18:53:52 +00:00
elif menuR in ["B", "b"]:
while True:
try:
clear()
prt()
close()
logoA()
tmp()
clear()
prt()
close()
logoB()
tmp()
clear()
prt()
close()
logoC()
tmp()
2020-06-13 19:23:52 -03:00
except:
break
2020-06-25 18:53:52 +00:00
elif menuR in ["C", "c"]:
while True:
try:
clear()
prt()
sysinfo()
close()
decodeQR()
t.sleep(50)
2020-06-13 19:23:52 -03:00
except:
break
2020-06-25 18:53:52 +00:00
elif menuR in ["S", "s"]:
while True:
try:
clear()
prt()
close()
sysinfoDetail()
t.sleep(1)
2020-06-13 19:23:52 -03:00
except:
break
2020-06-25 18:53:52 +00:00
elif menuR in ["R", "r"]:
2020-05-27 16:19:42 -03:00
try:
menuSelection()
2020-06-13 19:23:52 -03:00
except:
2020-05-27 16:19:42 -03:00
os._exit(0)
apisnd.close()
donation.close()
clone.close()
logos.close()
feed.close()
sysinf.close()
exit()
2020-06-11 18:46:16 -03:00
def menuBA(menuR): # Advanced access Menu
2020-06-25 18:53:52 +00:00
if menuR in ["A", "a"]:
2020-06-11 18:46:16 -03:00
while True:
try:
clear()
prt()
sysinfo()
close()
remoteconsole()
t.sleep(5)
2020-06-13 19:23:52 -03:00
except:
break
2020-06-25 18:53:52 +00:00
elif menuR in ["B", "b"]:
2020-06-11 18:46:16 -03:00
while True:
try:
clear()
prt()
close()
logoA()
tmp()
clear()
prt()
close()
logoB()
tmp()
clear()
prt()
close()
logoC()
tmp()
2020-06-13 19:23:52 -03:00
except:
break
2020-06-25 18:53:52 +00:00
elif menuR in ["C", "c"]:
2020-06-11 18:46:16 -03:00
while True:
try:
clear()
prt()
sysinfo()
close()
decodeQR()
t.sleep(50)
2020-06-13 19:23:52 -03:00
except:
break
2020-06-25 18:53:52 +00:00
elif menuR in ["S", "s"]:
2020-06-11 18:46:16 -03:00
while True:
try:
clear()
prt()
close()
sysinfoDetail()
t.sleep(1)
2020-06-13 19:23:52 -03:00
except:
break
2020-06-25 18:53:52 +00:00
elif menuR in ["R", "r"]:
2020-06-11 18:46:16 -03:00
try:
menuSelection()
2020-06-13 19:23:52 -03:00
except:
2020-06-11 18:46:16 -03:00
os._exit(0)
apisnd.close()
donation.close()
clone.close()
logos.close()
feed.close()
sysinf.close()
exit()
2020-06-10 19:02:49 -03:00
def menuC(menuO): # Donation access Menu
2020-06-25 18:53:52 +00:00
if menuO in ["A", "a"]:
dntDev()
2020-06-25 18:53:52 +00:00
elif menuO in ["B", "b"]:
dntTst()
2020-06-25 18:53:52 +00:00
elif menuO in ["R", "r"]:
menuSelection()
2020-05-24 14:15:12 -03:00
def menuD(menuN): # Satnode access Menu
2020-06-25 18:53:52 +00:00
if menuN in ["A", "a"]:
satnode()
2020-06-25 18:53:52 +00:00
elif menuN in ["B", "b"]:
readFile()
2020-06-25 18:53:52 +00:00
elif menuN in ["S", "s"]:
try:
close()
message = input("\n\033[0;37;40mYour message it's a \033[1;34;40mF\033[0;37;40mile or a plain \033[1;32;40mT\033[0;37;40mext? \033[1;34;40mF\033[0;37;40m/\033[1;32;40mT\033[0;37;40m: ")
2020-06-25 18:53:52 +00:00
if message in ["F", "f"]:
try:
clear()
prt()
close()
apisenderFile()
2020-05-26 20:48:23 -03:00
t.sleep(30)
menuSelection()
2020-06-13 19:23:52 -03:00
except:
menuSelection()
2020-06-25 18:53:52 +00:00
elif message in ["T", "t"]:
try:
clear()
prt()
close()
apisender()
2020-05-26 20:48:23 -03:00
t.sleep(30)
menuSelection()
2020-06-13 19:23:52 -03:00
except:
menuSelection()
2020-06-13 19:23:52 -03:00
except:
menuSelection()
2020-06-25 18:53:52 +00:00
elif menuN in ["C", "c"]:
print("\n\t This only will work on Linux or Unix systems.\n")
a = input("Do we continue? Y/n: ")
2020-06-25 18:53:52 +00:00
if a in ["Y", "y"]:
gitclone()
else:
menuSelection()
2020-06-25 18:53:52 +00:00
elif menuN in ["D", "d"]:
menuSelection()
2020-05-24 14:15:12 -03:00
def menuE(menuQ): # Dev Donation access Menu
2020-06-25 18:53:52 +00:00
if menuQ in ["A", "a"]:
try:
clear()
prt()
close()
donationPN()
t.sleep(50)
menuSelection()
2020-06-13 19:23:52 -03:00
except:
menuSelection()
2020-06-25 18:53:52 +00:00
elif menuQ in ["B", "b"]:
try:
clear()
prt()
close()
donationAddr()
t.sleep(50)
menuSelection()
2020-06-13 19:23:52 -03:00
except:
menuSelection()
2020-06-25 18:53:52 +00:00
elif menuQ in ["C", "c"]:
try:
clear()
prt()
close()
donationLN()
t.sleep(50)
menuSelection()
2020-06-13 19:23:52 -03:00
except:
menuSelection()
2020-06-25 18:53:52 +00:00
elif menuQ in ["R", "r"]:
menuSelection()
2020-05-24 14:15:12 -03:00
def menuF(menuV): # Tester Donation access Menu
2020-06-25 18:53:52 +00:00
if menuV in ["A", "a"]:
try:
clear()
prt()
close()
donationAddrTst()
t.sleep(50)
menuSelection()
2020-06-13 19:23:52 -03:00
except:
menuSelection()
2020-06-25 18:53:52 +00:00
elif menuV in ["B", "b"]:
try:
clear()
prt()
close()
donationLNTst()
t.sleep(50)
menuSelection()
2020-06-13 19:23:52 -03:00
except:
menuSelection()
2020-06-25 18:53:52 +00:00
elif menuV in ["R", "r"]:
menuSelection()
#--------------------------------- End Main Menu execution --------------------------------
2020-05-24 14:15:12 -03:00
2020-06-02 22:59:20 -03:00
while True: # Loop
clear()
path = {"ip_port":"", "rpcuser":"", "rpcpass":"", "bitcoincli":""}
2020-05-29 11:52:29 -03:00
if os.path.isfile('bclock.conf') or os.path.isfile('blnclock.conf'): # Check if the file 'bclock.conf' is in the same folder
pathv = pickle.load(open("bclock.conf", "rb")) # Load the file 'bclock.conf'
path = pathv # Copy the variable pathv to 'path'
else:
prt()
print("Welcome to \033[1;31;40mPyBLOCK\033[0;37;40m\n\n")
print("\n\tIf you are going to use your local node leave IP:PORT/USER/PASSWORD in blank.\n")
path['ip_port'] = "http://{}".format(input("Insert IP:PORT to access your remote Bitcoin-Cli node: "))
path['rpcuser'] = input("RPC User: ")
path['rpcpass'] = input("RPC Password: ")
print("\n\tLocal Bitcoin Core Node connection.\n")
path['bitcoincli']= input("Insert the Path to Bitcoin-Cli: ")
2020-06-10 19:02:49 -03:00
pickle.dump(path, open("bclock.conf", "wb"))
2020-06-25 18:53:52 +00:00
menuSelection()