Doccumentation on LND RPC libs

This commit is contained in:
Christian Rotzoll 2019-04-12 11:48:51 +01:00
parent 93ab42678f
commit 78d2855142
9 changed files with 46 additions and 3 deletions

View File

@ -338,7 +338,6 @@ if [ "${binaryChecksum}" != "${bitcoinSHA256}" ]; then
exit 1
fi
# check gpg finger print
sudo -u admin wget https://bitcoin.org/laanwj-releases.asc
if [ ! -f "./laanwj-releases.asc" ]
@ -480,6 +479,21 @@ if [ ${#installed} -eq 0 ]; then
exit 1
fi
# prepare python for lnd api use
# https://dev.lightning.community/guides/python-grpc/
#
echo ""
echo "*** LND API for Python ***"
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 2
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.5 1
echo "to switch between python2/3: sudo update-alternatives --config python"
sudo apt-get -f -y install virtualenv
sudo -u admin virtualenv lnd
sudo -u admin source lnd/bin/activate
sudo -u admin pip install grpcio grpcio-tools googleapis-common-protos
echo ""
# Go is needed for ZAP connect later
echo "*** Installing Go ***"
wget https://storage.googleapis.com/golang/go1.11.linux-armv6l.tar.gz

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
import codecs, grpc, os, sys, base64
from lnd060libs import rpc_pb2 as ln
from lnd060libs import rpc_pb2_grpc as lnrpc
from lndlibs import rpc_pb2 as ln
from lndlibs import rpc_pb2_grpc as lnrpc
# display config script info
if len(sys.argv) <= 1 or sys.argv[1] == "-h" or sys.argv[1] == "help":

View File

@ -0,0 +1,29 @@
For every new LND version the LND RPC libs need to be compiled from the matching protobuff files.
Do this on a raspberrypi with the exact same python version the scripts will be are running on.
See https://dev.lightning.community/guides/python-grpc/
Make sure Virtual Environment is setup:
```
sudo apt-get -f -y install virtualenv
virtualenv lnd
source lnd/bin/activate
pip install grpcio grpcio-tools googleapis-common-protos
```
Normally that is already done by build_sdcard.sh for user admin user. So just run:
```
source lnd/bin/activate
````
Now to generate the lnd RPC libs:
```
git clone https://github.com/googleapis/googleapis.git
curl -o rpc.proto -s https://raw.githubusercontent.com/lightningnetwork/lnd/master/lnrpc/rpc.proto
python -m grpc_tools.protoc --proto_path=googleapis:. --python_out=. --grpc_python_out=. rpc.proto
````
*NOTE: If LND master branch is already a version ahead .. use the rpc.proto from the version tagged branch.*
Now copy the generated RPC libs per SCP over to your Laptop and add them to the `/home/admin/config.scripts/lndlibs`.