adrienemery / lnd-grpc-client

A python grpc client/async client for LND ⚡⚡⚡
MIT License
35 stars 21 forks source link

can not create new wallet with lndgrpc. #15

Open ShaAmos opened 5 years ago

ShaAmos commented 5 years ago

hi there, I can't create new wallet with lndgrpc. do you know what's the problem?

adrienemery commented 5 years ago

hi @ShaAmos I haven't implemented it yet unfortunately.

ShaAmos commented 5 years ago

hi Adrienemery, based on the lightning API and i can create the new wallet with below python3 code: could you combine this to you python package ? i think you can do that better than me.

import grpc import os, codecs import rpc_pb2 as ln import rpc_pb2_grpc as lnrpc

os.environ['GRPC_SSL_CIPHER_SUITES'] = 'HIGH+ECDSA' cert = open('/Users/amos/Library/Application Support/Lnd/tls.cert', 'rb').read() ssl_creds = grpc.ssl_channel_credentials(cert) channel = grpc.secure_channel('localhost:10009', ssl_creds) stub = lnrpc.WalletUnlockerStub(channel) request = ln.GenSeedRequest() response = stub.GenSeed(request)

myseed = str(response).split('\n') # convert the response to list from GenSeed function. myGenSeed = [] mywords = [] for seeds in myseed: seed = seeds.replace("cipher_seed_mnemonic: ","") myGenSeed.append(seed)

for word in myGenSeed[:-2]: myword = word.strip('"') mywords.append(myword) # to get 24-word mnemonic print(mywords) print(type(mywords))

password = bytes('12345678',encoding='utf-8') request2 = ln.InitWalletRequest(wallet_password=password, cipher_seed_mnemonic=mywords) wallet_response = stub.InitWallet(request2) print(wallet_response)