Created
November 11, 2021 14:10
-
-
Save timothyylim/34dfab97aaba82bae77b7820676e6f98 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import lightning_pb2 as ln | |
import lightning_pb2_grpc as lnrpc | |
import codecs | |
import grpc | |
import os | |
# Due to updated ECDSA generated tls.cert we need to let gprc know that | |
# we need to use that cipher suite otherwise there will be a handhsake | |
# error when we communicate with the lnd rpc server. | |
os.environ["GRPC_SSL_CIPHER_SUITES"] = 'HIGH+ECDSA' | |
macaroon = codecs.encode(open('./admin.macaroon', 'rb').read(), 'hex') | |
print(macaroon) | |
cert = open(os.path.expanduser('./tls.cert'), 'rb').read() | |
creds = grpc.ssl_channel_credentials(cert) | |
print(creds) | |
channel = grpc.secure_channel('promisebot-node-1.t.voltageapp.io', creds) | |
stub = lnrpc.LightningStub(channel) | |
request = ln.Invoice(value=1000) | |
response = stub.AddInvoice(request, metadata=[('macaroon', macaroon)]) | |
print(response) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Returns the error: