def scb(stub, wallet_password="", seed_words="", seed_password="", file_path_scb=""): with open(file_path_scb, 'rb') as f: content = f.read() scb_hex_str = binascii.hexlify(content) print(scb_hex_str) request = lnrpc.InitWalletRequest( wallet_password=wallet_password.encode(), cipher_seed_mnemonic=[x.encode() for x in seed_words], recovery_window=5000, aezeed_passphrase=seed_password.encode(), channel_backups=scb_hex_str.encode()) try: response = stub.InitWallet(request) except grpc.RpcError as rpc_error_call: code = rpc_error_call.code() print(code, file=sys.stderr) details = rpc_error_call.details() print("err='RPCError InitWallet'") print("errMore=\"" + details + "\"") sys.exit(1) except: e = sys.exc_info()[0] print(e, file=sys.stderr) print("err='InitWallet'") sys.exit(1) # TODO(rootzoll) implement creating from seed/scb print("err='TODO: implement creating from seed/scb'") sys.exit(1)
def new(stub, wallet_password="", seed_entropy=None): if seed_entropy: # provide 16-bytes of static data to get reproducible seeds for TESTING!) print("WARNING: Use this for testing only!!") request = lnrpc.GenSeedRequest(seed_entropy=seed_entropy) else: request = lnrpc.GenSeedRequest() try: response = stub.GenSeed(request) seed_words = response.cipher_seed_mnemonic seed_words_str = ', '.join(seed_words) print("seedwords='" + seed_words_str + "'") # add a 6x4 formatted version to the output seed_words_6x4 = "" for i in range(0, len(seed_words)): if i % 6 == 0 and i != 0: seed_words_6x4 = seed_words_6x4 + "\n" single_word = str(i + 1) + ":" + seed_words[i] while len(single_word) < 12: single_word = single_word + " " seed_words_6x4 = seed_words_6x4 + single_word print("seedwords6x4='" + seed_words_6x4 + "'") except grpc.RpcError as rpc_error_call: code = rpc_error_call.code() print(code, file=sys.stderr) details = rpc_error_call.details() print("err='RPCError GenSeedRequest'") print("errMore=\"" + details + "\"") sys.exit(1) except: e = sys.exc_info()[0] print(e, file=sys.stderr) print("err='GenSeedRequest'") sys.exit(1) request = lnrpc.InitWalletRequest( wallet_password=wallet_password.encode(), cipher_seed_mnemonic=seed_words ) try: response = stub.InitWallet(request) except grpc.RpcError as rpc_error_call: code = rpc_error_call.code() print(code, file=sys.stderr) details = rpc_error_call.details() print("err='RPCError InitWallet'") print("errMore=\"" + details + "\"") sys.exit(1) except: e = sys.exc_info()[0] print(e, file=sys.stderr) print("err='InitWallet'") sys.exit(1)
def seed(stub, wallet_password="", seed_words="", seed_password=""): request = lnrpc.InitWalletRequest( wallet_password=wallet_password.encode(), cipher_seed_mnemonic=[x.encode() for x in seed_words], recovery_window=5000, aezeed_passphrase=seed_password.encode()) try: response = stub.InitWallet(request) except grpc.RpcError as rpc_error_call: code = rpc_error_call.code() print(code, file=sys.stderr) details = rpc_error_call.details() print("err='RPCError InitWallet'") print("errMore=\"" + details + "\"") sys.exit(1) except: e = sys.exc_info()[0] print(e, file=sys.stderr) print("err='InitWallet'") sys.exit(1)