def create_blockchain(): if the_settings().test_mode() == True: dprint("Creating new blockchain") system = Blockchain() system.minePendingTrans(Wallet_Import(0, 0)) else: dprint("Getting blockchain from nodes") sendme_full_chain()
def menu(): while True: show_menu() choices_input = question_maker(mode="main") if choices_input == "cbc": create_blockchain() if choices_input == "cw": Wallet_Create() if choices_input == "sm": send_message(input("Message: "),input("Please write receiver adress: ")) if choices_input == "sc": send_coin(input("Coin Amount: "),input("Please write receiver adress: ")) if choices_input == "gb": print(get_blockchain().getBalance(Wallet_Import(0,0))) if choices_input == "help": show_menu() if choices_input == "ndstart": ndstart(int(input("port: "))) if choices_input == "ndstop": ndstop() if choices_input == "ndconnect": ndconnect(str(input("node ip: ")),int(input("node port: "))) if choices_input == "ndconnectmix_blockchain_network": ndconnectmix_blockchain_network() if choices_input == "testmodeon": the_settings().test_mode(True) if choices_input == "testmodeoff": the_settings().test_mode(False) if choices_input == "debugmodeon": the_settings().debug_mode(True) if choices_input == "debugmodeoff": the_settings().debug_mode(False) if choices_input == "getfullnodelist": sendme_full_node_list() if choices_input == "getfullchain": sendme_full_chain() if choices_input == "0": exit()
def test_mode_off(self): the_settings().test_mode(False) messagebox.showinfo('Node', 'Test mode is OFF')
def test_mode_on(self): the_settings().test_mode(True) messagebox.showinfo('Node', 'Test mode is ON')
def dprint(text): from lib.settings import the_settings if the_settings().debug_mode(): print(str(text))
def ndstart(port): node = MyOwnPeer2PeerNode("", port) node.debug = the_settings().debug_mode() node.start()