Commit 2fb448b7 authored by ketominer's avatar ketominer

Initial public release

parent f0405909
<html>
<head>
<title>Admin</title>
<meta http-equiv="refresh" content="0; URL=/admin/">
</head>
<body>
<a href="/admin/">Open admin</a>
</body>
</html>
\ No newline at end of file
......@@ -56,12 +56,12 @@ $bitcoin->getblock('000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8c
// When a call fails for any reason, it will return FALSE and put the error message in $this->error
// Example:
echo $bitcoin->error;
echo __FILE__.'('.__LINE__.') '.$bitcoin->error;
// The HTTP status code can be found in $this->status and will either be a valid HTTP status code
// or will be 0 if cURL was unable to connect.
// Example:
echo $bitcoin->status;
echo __FILE__.'('.__LINE__.') '.$bitcoin->status;
*/
......
......@@ -4,14 +4,16 @@
class LightningClient
{
public $macaroon = '';
public $rest_url = '';
function __construct($mac) {
$this->macaroon = $mac;
function __construct($mac, $url = 'https://localhost:8080') {
$this->macaroon = $mac;
$this->rest_url = $url;
}
private function LnRest($add,$post= "")
{
$url = 'https://localhost:8080'.$add;
$url = $this->rest_url.$add;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 25);
......@@ -30,7 +32,7 @@ class LightningClient
}
private function LnRestDEL($add)
{
$url = 'https://localhost:8080'.$add;
$url = $this->rest_url.$add;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 25);
......@@ -88,32 +90,18 @@ class LightningClient
$res = LightningClient::LnRest('/v1/unlockwallet',$pass);
return json_decode($res,true);
}
/*
> var fs = require('fs');
> var request = require('request');
> var options = {
url: 'https://localhost:8080/v1/genseed',
// Work-around for self-signed certificates.
rejectUnauthorized: false,
json: true,
};
> request.get(options, function(error, response, body) {
console.log(body);
});
{
"cipher_seed_mnemonic": <array string>,
"enciphered_seed": <byte>,
}
*/
// public function genseed() {
// }
public function genseed() {
$res = LightningClient::LnRest('/v1/genseed');
return json_decode($res,true);
}
public function create_wallet($pass) {
$pass = json_encode(array('password' => base64_encode($pass)));
$res = LightningClient::LnRest('/v1/createwallet',$pass);
public function initwallet($pass, $seed) {
$payload = json_encode(array('wallet_password' => base64_encode($pass), 'cipher_seed_mnemonic' => $seed));
$res = LightningClient::LnRest('/v1/initwallet',$payload);
return json_decode($res,true);
}
public function getWalletBalance() {
$res = LightningClient::LnRest('/v1/balance/blockchain');
return json_decode($res,true);
......
This diff is collapsed.
<?php
syslog(LOG_INFO, __FILE__.'('.__LINE__.') ');
$db_host = 'localhost';
$db_name = 'nodladmin';
$db_user = 'nodladmin';
......@@ -9,6 +11,24 @@ $bitcoind_rpchost = '127.0.0.1';
$bitcoind_rpcport = '8332';
$bitcoind_rpcuser = 'rpc';
$bitcoind_rpcpassword = file('/etc/nodl/bitcoind-rpc.pwd', FILE_IGNORE_NEW_LINES)[0];
$bitcoind_cookie = '';
try {
$bitcoind_cookie = file('/opt/bitcoin/.bitcoin/.cookie', FILE_IGNORE_NEW_LINES)[0];
$bitcoind_rpcuser = explode(':', $bitcoind_cookie)[0];
$bitcoind_rpcpassword = explode(':', $bitcoind_cookie)[1];
syslog(LOG_INFO, __FILE__.'('.__LINE__.') ');
} catch (Exception $e) {
syslog(LOG_INFO, __FILE__.'('.__LINE__.') ');
}
$lnd_macaroon='/opt/bitcoin/.lnd/data/chain/bitcoin/mainnet/admin.macaroon';
$lnd_rest_url = 'https://localhost:8090';
$lnd_admin_macaroon='/opt/bitcoin/.lnd/data/chain/bitcoin/mainnet/admin.macaroon';
$lnd_readonly_macaroon='/opt/bitcoin/.lnd/data/chain/bitcoin/mainnet/readonly.macaroon';
$lnd_password = file('/etc/nodl/lnd-wallet.pwd', FILE_IGNORE_NEW_LINES)[0];
$lnd_public_ip = '';
try {
$lnd_public_ip = explode('=', file('/etc/nodl/publicip', FILE_IGNORE_NEW_LINES)[0])[1];
} catch (Exception $e) {
}
#!/bin/bash
# Put things in the correct places
mkdir -p /etc/nodl/
cp etc/nodl-config.php /etc/nodl/config.php
mkdir -p /var/www/html/admin
cp -r www/* www/.htaccess /var/www/html/admin/
cp admin-redirect.html /var/www/html/index.html
mkdir -p /usr/share/nodl
cp -r share/* /usr/share/nodl/
cp -r bin/* /usr/local/bin/
chmod +x /usr/local/bin/nodl-service.sh
cp etc/nodl.service /etc/systemd/system/nodl.service
mkdir -p /var/log/supervisor
mkdir -p /var/log.hdd/supervisor
mkdir -p /etc/nginx/modules-available/
mkdir -p /etc/nginx/modules-enabled/
cp /usr/share/nodl/files/99-grpc-lnd.conf /etc/nginx/modules-available/
if [ ! -e /etc/nginx/modules-enabled/99-grpc-lnd.conf ]; then
ln -s /etc/nginx/modules-available/99-grpc-lnd.conf /etc/nginx/modules-enabled/99-grpc-lnd.conf
touch /tmp/nginx-restart
fi
if ! grep -q modules-enabled /etc/nginx/nginx.conf ; then
cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.old
cat /usr/share/nodl/files/nginx-include.snippet /etc/nginx/nginx.conf.old > /etc/nginx/nginx.conf
touch /tmp/nginx-restart
fi
#!/bin/bash
DOTNET_CLI_TELEMETRY_OPTOUT=1
PATH=$PATH:/opt/dotnet/
DOTNET_ROOT=/opt/dotnet/
stream {
server {
listen 10009;
proxy_pass localhost:10019;
}
}
daemon=1
server=1
#proxy=127.0.0.1:9050 #TOR
#listen=1 #TOR
#bind=127.0.0.1 #TOR
#onlynet=onion #TOR
whitelist=127.0.0.1
rpcbind=127.0.0.1
rpcport=8332
rpcuser=rpc
#rpcpassword=BITCOINRPCPASS
rpcallowip=127.0.0.1
zmqpubrawblock=tcp://127.0.0.1:29000
zmqpubrawtx=tcp://127.0.0.1:29001
[Unit]
Description=Bitcoin daemon
After=network.target
[Service]
ExecStart=/usr/local/bin/bitcoind -daemon -pid=/run/bitcoind/bitcoind.pid
# Creates /run/bitcoind owned by bitcoin
RuntimeDirectory=bitcoind
User=bitcoin
Type=forking
PIDFile=/run/bitcoind/bitcoind.pid
Restart=on-failure
# Hardening measures
####################
# Provide a private /tmp and /var/tmp.
PrivateTmp=true
# Mount /usr, /boot/ and /etc read-only for the process.
ProtectSystem=full
# Disallow the process and all of its children to gain
# new privileges through execve().
NoNewPrivileges=true
# Use a new /dev namespace only populated with API pseudo devices
# such as /dev/null, /dev/zero and /dev/random.
PrivateDevices=true
# Deny the creation of writable and executable memory mappings.
MemoryDenyWriteExecute=true
[Install]
WantedBy=multi-user.target
### Global settings ###
network=mainnet
### Server settings ###
port=23000
bind=127.0.0.1
### Database ###
mysql=User ID=btcpay;Password=MARIABTCPAY;Host=localhost;Port=3306;Database=btcpay;
### NBXplorer settings ###
BTC.explorer.url=http://127.0.0.1:24444/
BTC.explorer.cookiefile=/opt/btcpay/.nbxplorer/Main/.cookie
### BTC.external.lnd.grpc=https://lnd:lnd@127.0.0.1:8080/;allowinsecure=true
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQENBFmMHhMBCADJErQPmbQYFlVwtKD7UDLfm28ZKUyAt7WDzgYN/aPL3eQb1xOT
NHI20F8TN3GXb3yy+57ETLy4GXADrb7BxXbvYOsFMZuoadcbnRmgKV28R6VRsSGL
Zyp5Ol5KrR39I5G6FdIIP/qSER0oSe/2KySRgob8YQlF24NLI/5RKgyayj4kdaou
j7ghVpWv8MpMzM1TEKlerOBhU88B6l0vjmJcxHxbCkc5xqqDQya7Ll8VAnLIYYNF
WTduugWn8JC9Ys3+emLI78VMoaMEMkBeUS/zrTFDZB6DufDCsNtw9YhM/anok74d
5kvcQctnrINiHP5EJf7yJ1PREAmW22ZMla7TABEBAAG0I0pvaGFuIFQgSGFsc2V0
aCA8am9oYW50aEBnbWFpbC5jb20+iQFUBBMBCAA+FiEEerPX9ZEXCIQnllE0Fbqt
op2iDSYFAlmMHhMCGwMFCQPCZwAFCwkIBwIGFQgJCgsCBBYCAwECHgECF4AACgkQ
Fbqtop2iDSbrnQgAsmGF5Iv8DSNcnN6VLP79I7IvRvWreUwD/Vre9x7V/BZDxqSy
hu6zznN4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SWUK4vZ5Kf9JTiMnFcw==
=+jj+
-----END PGP PUBLIC KEY BLOCK-----
This diff is collapsed.
[Application Options]
debuglevel=info
maxpendingchannels=5
alias=nodl [LND]
color=#0000FF
restlisten=127.0.0.1:8090
rpclisten=127.0.0.1:10019
[Bitcoin]
bitcoin.active=1
bitcoin.mainnet=1
bitcoin.node=bitcoind
[autopilot]
autopilot.active=0
autopilot.maxchannels=5
autopilot.allocation=0.6
[Unit]
Description=LND Lightning Daemon
Wants=bitcoind.service
After=bitcoind.service
[Service]
EnvironmentFile=/etc/nodl/publicip
ExecStart=/usr/local/bin/lnd --externalip=${PUBLICIP}
PIDFile=/home/bitcoin/.lnd/lnd.pid
User=bitcoin
Group=bitcoin
LimitNOFILE=128000
Type=simple
KillMode=process
TimeoutSec=240
Restart=always
RestartSec=60
[Install]
WantedBy=multi-user.target
btc.rpc.url=http://127.0.0.1:8332
btc.rpc.user=BITCOINRPCUSER
btc.rpc.password=BITCOINRPCPASS
btc.node.endpoint=127.0.0.1:8333
chains=btc
verbose=1
port=24444
bind=127.0.0.1
mainnet=1
map $http_x_forwarded_proto $proxy_x_forwarded_proto {
default $http_x_forwarded_proto;
'' $scheme;
}
map $http_upgrade $proxy_connection {
default upgrade;
'' close;
}
upstream btcpay {
server 127.0.0.1:23000;
}
server {
listen 8080 default_server;
listen [::]:8080 default_server;
access_log /var/log/nginx/access-lnd-rest.log;
error_log /var/log/nginx/error-lnd-rest.log;
root /var/www/html;
index index.html;
location / {
proxy_pass https://localhost:8090;
}
}
server {
listen 8338 default_server;
listen [::]:8338 default_server;
access_log /var/log/nginx/access-admin.log;
error_log /var/log/nginx/error-.log;
root /var/www/html;
index index.php index.html;
proxy_http_version 1.1;
proxy_buffering off;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $proxy_connection;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto;
location /admin/ {
try_files $uri $uri/ =404;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
}
server {
listen 80 default_server;
listen [::]:80 default_server;
access_log /var/log/nginx/access-btcpay.log;
error_log /var/log/nginx/error-btcpay.log;
root /var/www/html;
index index.html;
proxy_http_version 1.1;
proxy_buffering off;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $proxy_connection;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto;
location / {
proxy_pass http://btcpay;
}
}
include /etc/nginx/modules-enabled/*.conf;
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFuZwYcBEAD6U9MeAg5qbIroOhPer/dCVXkvMykPUUjde+nvGCeFmpzcG2Fx
XjJBUnINX8O0CN/OTPMyqRMjVnOw00OUKebLlkqF/aEXpuYfkkChOjuIey1WfEPA
DTbJEIhTuVEoj7/fMR1z/jPQS5to/G5wa3f1YaK3Jk6ogz+ebtQEe01jY42Wduul
0v5l5AeJTdmXwkZsjpA/7XLlsvQf21gzFTdywVsdvKx1p1+fe8IXQKxrEHXrkIdt
Qlz/cS6Hq+z20qoYRLGwhfoyxJMRQlu4Pe8KQJCtIhF5Jq91BRewHoRA51ZL5e8K
yCio1AZs45iMqHeRiLXQ7B2OogHCuU7gycG5X07i4ELhjW5AiFgXkhlMLiOVmb8u
7rQYL+5iXtZ2+B20efw/8isb94rwP5oKCgccj169q37WsXtBtC3UtPdMZA7PEN12
BkJglNN6YU9+4o4uwK+3mSBO8/rTwKJmPvVxMmk+LvLB8+EWlKlb5pYCJS+m+geK
O/rn/cu9jQgVbUOYYTKnFic7OSFupUTBvDTqIcbXw0uRaWeFi8HkK7SFIegrUj1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gWj3KEUrWGYp07d8jD6qr7xh8MuZJekNbVOb2bVkUScqfwAR
AQABiQI8BBgBCgAmFiEEvVmWcsgErydwhpoEi4DNK7i9gTIFAluZwqECGyAFCQHh
M4AACgkQi4DNK7i9gTL7nRAA0TFE4ejpzTo49HORh2DgLhbmAUGavuMzKgVo79i1
XOOX5HsuabpxOhihIWGDGJYdg5kcEGQqmeXfsYb/ZD14B4cYVLOmKQG/rUQ1mF5D
gn7DRwOaibsNb4vRt/q3qsbJtgJk6QZdq8bsbxmAJl0+06eYYTon87nOPjDpAJ/+
k1SpOlFK59cKaOxMxt0aldmPax3fMjac8vRcCeDJTcRfY7aZbwpWjU7dhnvS8CMu
3AIcpay9iNP7B/3ov3gdRwG7jzkYYem6xtREGWSHng1S6gUuE/OExi9+5XZOwCen
+bAGYCUeGpr5Yu/EoWu27nuRwAfh/rOX6zT7HbgCX9FL2jNWLJbbAthSR8wmTWWw
TU03AatO55zkAAh+9Y+zZT7uxp8aCDj8xLSYR11AmyyI6hwrM/Sz6wt8tL0YTVJY
YdFC4QnHQhBIkyPCs9lAEOlMbG8qcRr9mQFAEtSfHO+GqdinINFGOqcghg0nxpNA
96n2g+I/oFy3U7OVvNGzD4RB/xx15H0Pc3y4Q5PMt98SUcgZg6xIVyYf60qdsqRR
7Oe2ronu140nV4ek1YU4EoMFTInw2/Dik88xM+vH+ggPnckfkc1zzAHOv8j7KxX3
udiRmLkjQDYZ94GxxogmuzqHmnpmMq/9lhEfnszz3sHfDj3IvbytGj3/0xtoAMGr
I+U=
=j2gl
-----END PGP PUBLIC KEY BLOCK-----
[program:btcpayserver]
command=/opt/dotnet/dotnet /opt/btcpay/btcpayserver/BTCPayServer.dll
directory=/opt/btcpay/btcpayserver/
user=btcpay
group=btcpay
autostart=true
autorestart=true
redirect_stderr=true
environment=HOME=/opt/btcpay/,PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/dotnet/
[program:nbxplorer]
command=/opt/dotnet/dotnet /opt/btcpay/NBxplorer/NBXplorer.dll
directory=/opt/btcpay/NBxplorer/
user=btcpay
group=btcpay
autostart=true
autorestart=true
redirect_stderr=true
environment=HOME=/opt/btcpay/,PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/dotnet/
#!/bin/bash
cd "$(dirname "$0")"
### download and install bitcoin core
# return values:
# 1 - download failed
# 2 - signature check failed
# 3 - other failure
# 0 - success
mkdir -p /opt/tmp
cd /opt/tmp
rm -rf *
wget -q https://bitcoincore.org/bin/bitcoin-core-0.17.0/bitcoin-0.17.0-aarch64-linux-gnu.tar.gz || exit 1
wget -q https://bitcoincore.org/bin/bitcoin-core-0.17.0/SHA256SUMS.asc || exit 1
gpg --import /usr/share/nodl/files/laanwj-releases.asc || exit 2
sha256sum --check SHA256SUMS.asc --ignore-missing || exit 2
gpg --verify SHA256SUMS.asc || exit 2
tar zxf bitcoin-0.17.0-aarch64-linux-gnu.tar.gz || exit 3
install -m 0755 -o root -g root -t /usr/local/bin bitcoin-*/bin/* || exit 3
useradd -d /opt/bitcoin -s /bin/bash -m bitcoin
mkdir -p /opt/bitcoin/.bitcoin
cp /usr/share/nodl/files/bitcoin.conf /opt/bitcoin/.bitcoin/bitcoin.conf
chown -R bitcoin: /opt/bitcoin/.bitcoin
cp /usr/share/nodl/files/bitcoind.service /etc/systemd/system/bitcoind.service
systemctl enable bitcoind
bitcoindrpc=$(</etc/nodl/bitcoind-rpc.pwd)
sed -e "s/BITCOINRPCPASS/$bitcoindrpc/" -i /opt/bitcoin/.bitcoin/bitcoin.conf
exit 0
#!/bin/bash
# Build
DOTNET_CLI_TELEMETRY_OPTOUT=1
BUIDL_DIR=/opt/tmp
TARGET_DIR=/opt/rel
BTCPAY_VER=v1.0.3.31
NBXPLO_VER=v2.0.0.7
ARCH=arm32
export DEBIAN_FRONTEND=noninteractive
DOTNET_URL=https://download.visualstudio.microsoft.com/download/pr/3690b37f-002a-4e8b-9563-cf30fbba8c57/36498efa5d47af3b9e9addb50d839db6/dotnet-sdk-2.1.502-linux-arm.tar.gz
DOTNET_FILE=dotnet-sdk-2.1.502-linux-arm.tar.gz
dpkg --add-architecture armhf
apt-get update
apt-get -y install libc6:armhf libstdc++6:armhf libssl-dev:armhf libssl1.0.0:armhf libzstd1:armhf libicu-dev:armhf
cp /usr/share/nodl/files/99-dotnet.sh /etc/profile.d/99-dotnet.sh
chmod +x /etc/profile.d/99-dotnet.sh
source /etc/profile.d/99-dotnet.sh
rm -rf $BUIDL_DIR
mkdir -p $BUIDL_DIR
mkdir -p $TARGET_DIR
cd $BUIDL_DIR
wget $DOTNET_URL || exit 1
mkdir -p /opt/dotnet
tar zxf $DOTNET_FILE -C /opt/dotnet || exit 1
export DOTNET_ROOT=/opt/dotnet
export PATH=$PATH:/opt/dotnet
cd $BUIDL_DIR
git clone https://github.com/dgarage/NBxplorer || exit 1
git clone https://github.com/btcpayserver/btcpayserver || exit 1
cd $BUIDL_DIR/NBxplorer
git checkout $NBX_VER
dotnet restore || exit 4
dotnet publish --output $TARGET_DIR/NBxplorer --configuration Release || exit 4
cd $BUIDL_DIR/btcpayserver
git checkout $BTCPAY_VER
dotnet restore || exit 4
dotnet publish --output $TARGET_DIR/btcpayserver --configuration Release || exit 4
cd $TARGET_DIR
tar czf btcpayserver.$BTCPAY_VER-$ARCH.tgz btcpayserver
tar czf NBxplorer.$NBX_VER-$ARCH.tgz NBxplorer
sha256sum btcpayserver.$BTCPAY_VER-$ARCH.tgz > btcpayserver.$BTCPAY_VER-$ARCH.tgz.sha256
sha256sum NBxplorer.$NBX_VER-$ARCH.tgz > NBxplorer.$NBX_VER-$ARCH.tgz.sha256
rm -rf $BUIDL_DIR
# Install
useradd -d /opt/btcpay -s /bin/bash -m btcpay
sudo -H -u btcpay bash -c "cd; tar zxf $TARGET_DIR/btcpayserver.$BTCPAY_VER-$ARCH.tgz" || exit 5
sudo -H -u btcpay bash -c "cd; tar zxf $TARGET_DIR/NBxplorer.$NBX_VER-$ARCH.tgz" || exit 5
pwgen 32 > /etc/nodl/maria-btcpay.pwd
chmod 600 /etc/nodl/maria-btcpay.pwd
apt-get -y install supervisor || exit 5
cp /usr/share/nodl/files/supervisor-btcpayserver.conf /etc/supervisor/conf.d/
cp /usr/share/nodl/files/supervisor-nbxplorer.conf /etc/supervisor/conf.d/
bitcoindrpc=$(</etc/nodl/bitcoind-rpc.pwd) mariabtcpay=$(</etc/nodl/maria-btcpay.pwd) mariaroot=$(</etc/nodl/maria-root.pwd)
sed -e "s/MARIABTCPAY/$mariabtcpay/" -i /usr/share/nodl/sql/install-btcpay.sql
mysql -u root -p$mariaroot < /usr/share/nodl/sql/install-btcpay.sql || exit 6
sudo -H -u btcpay bash -c "mkdir -p /opt/btcpay/.btcpayserver/Main/"
cp /usr/share/nodl/files/btcpayserver-settings.config /opt/btcpay/.btcpayserver/Main/settings.config
chown btcpay:btcpay /opt/btcpay/.btcpayserver/Main/settings.config
sudo -H -u btcpay bash -c "mkdir -p /opt/btcpay/.nbxplorer/Main/"
cp /usr/share/nodl/files/nbxplorer-settings.config /opt/btcpay/.nbxplorer/Main/settings.config
chown btcpay:btcpay /opt/btcpay/.nbxplorer/Main/settings.config
sed -e "s/MARIABTCPAY/$mariabtcpay/" -i /opt/btcpay/.btcpayserver/Main/settings.config
systemctl stop supervisor
systemctl disable supervisor
exit 0
#!/bin/bash
cd "$(dirname "$0")"
### download and install lnd
# return values:
# 1 - download failed
# 2 - signature check failed
# 3 - other failure
# 0 - success
mkdir -p /opt/tmp
cd /opt/tmp
rm -rf *
wget -q https://github.com/lightningnetwork/lnd/releases/download/v0.5.1-beta/lnd-linux-arm64-v0.5.1-beta.tar.gz || exit 1
wget -q https://github.com/lightningnetwork/lnd/releases/download/v0.5.1-beta/manifest-v0.5.1-beta.txt || exit 1
wget -q https://github.com/lightningnetwork/lnd/releases/download/v0.5.1-beta/manifest-v0.5.1-beta.txt.sig || exit 1
gpg --import /usr/share/nodl/files/halseth-releases.asc || exit 2
gpg --import /usr/share/nodl/files/roasbeef-releases.asc || exit 2
sha256sum --check manifest-v0.5.1-beta.txt --ignore-missing || exit 2
gpg --verify manifest-v0.5.1-beta.txt.sig || exit 2
tar zxf lnd-linux-arm64*tar.gz
install -m 0755 -o root -g root -t /usr/local/bin lnd-linux-arm64-*/*
mkdir -p /opt/bitcoin/.lnd
cp /usr/share/nodl/files/lnd.conf /opt/bitcoin/.lnd/lnd.conf || exit 3
chown -R bitcoin: /opt/bitcoin/.lnd
cp /usr/share/nodl/files/lnd.service /etc/systemd/system/lnd.service || exit 3
echo PUBLICIP=127.0.0.1 > /etc/nodl/publicip
systemctl enable lnd || exit 3
exit 0
CREATE DATABASE btcpay;