Coder Social home page Coder Social logo

raspibolt / raspibolt Goto Github PK

View Code? Open in Web Editor NEW
1.2K 54.0 352.0 43.17 MB

RaspiBolt v3: Bitcoin & Lightning full node on a Raspberry Pi

Home Page: https://raspibolt.org

License: MIT License

Shell 7.44% SCSS 0.15% Markdown 88.84% Python 3.57%
bitcoin lightning cryptocurrency raspberry-pi

raspibolt's Introduction

raspibolt's People

Contributors

2pac1 avatar 53645714n avatar bitcoinite avatar bitcoinrabbit avatar blckbx avatar daniel-vera-g avatar danielpx1 avatar dennisreimann avatar diegogurpegui avatar fatrattombala avatar frennkie avatar giulnz avatar interrupt00 avatar kristapsk avatar lucasmoten avatar martinatime avatar mktech-gh avatar mynima avatar oitdmser avatar robclark56 avatar s373nz avatar sig-noi avatar stadicus avatar sutterseba avatar the-jade-rabbitt avatar twofaktor avatar vajraofindra avatar vicariousdrama avatar vindard avatar xmready avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

raspibolt's Issues

/usr/local/bin/raspibolt and https://bitnodes.earn.com/api/v1/nodes/me-${public_port}

Noticed today that the raspibolt script was saying:
Public Not reachable

Found out why.
https://bitnodes.earn.com/api/v1/nodes/me-${public_port} was returning:

{"detail":"Request was throttled."}

Considering that raspibolt runs rarely (only on login), the service can not be throttling on requests/hour. Maybe the total number of requests from my IP address is the problem.

Looking for an alternative service ... but no luck just yet.

raspberry bitcoin docker

Wouldn't it be better to dockerize the bitcoin lightning tutorial?

It'd be just a matter of mounting the external drive correctly and setting up passwords and private keys. I see that you require to add networking information before the first boot. I'm doing an SD file tree editor for raspberry pi that automates this entire part and installs things (like docker) at first run: https://github.com/lucaszanella/raspberry_script_setup

I'm just waiting for a pruned mode to be launched, then I'll certainly make a tutorial based on this one, but it'd be much easier if dockerized

EPS download releases

Thanks for creating a guide for Electrum Personal Server. I have an edit but not sure of the exact form it should take.

Right now the guide instructs users to clone the github repository, but this gives them the latest master branch. That might contain bugfixes, works-in-progress and untested-features. Ideally users would instead download a tagged release from https://github.com/chris-belcher/electrum-personal-server/releases

Problem is, each release has a different file name. The guide could instruct users to wget https://github.com/chris-belcher/electrum-personal-server/archive/v0.1.1.zip and then unzip v0.1.1.zip but then the directory inside will be called electrum-personal-server-v0.1.1. Those version numbers will change at every release. All this may actually cause a headache for people following that guide.

So I'm not sure how to write that part of the guide. Ideally users would download releases, but also the guide should hopefully be as simple as possible to follow. So what's the best way to do this?

admin.macaroon missing after installing lnd

Hi first of all thanks for the great guide!
i followed it to the letter but am stuck at creating a new address for the testnet coins (after creating the wallet with "lncli create")
lncli misses the admin.macaroon which should be in /home/bitcoin/.lnd/admin.macaroon but it just isnt there.

btw: I copied all the scripts

Did i miss a step? I just can't figure it out.

bitcoind.service switch from activating (auto-restart) to active (running) and so on

I copied blockchain (checked from bitcoin core on pc) into external hd connected to raspberry pi, but now i have this:


pi@raspberrypi:~ $ bitcoin-cli getblockchaininfo
error: couldn't connect to server: unknown (code -1)
(make sure server is running and you are connecting to the correct RPC port)
pi@raspberrypi:~ $ bitcoin-cli getblockchaininfo
error code: -28
error message:
Loading block index...

pi@raspberrypi:~ $ systemctl status bitcoind.service
● bitcoind.service - Bitcoin daemon
Loaded: loaded (/etc/systemd/system/bitcoind.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Tue 2018-05-01 03:59:35 CEST; 30s ago
Process: 1067 ExecStart=/usr/local/bin/bitcoind -pid=/home/pi/.bitcoin/bitcoind.pid (code=exited, status=0/SUCCESS)
Main PID: 1068 (code=exited, status=1/FAILURE)

May 01 03:59:35 raspberrypi systemd[1]: bitcoind.service: Main process exited, code=exited, status=1/FAILURE
May 01 03:59:35 raspberrypi systemd[1]: bitcoind.service: Unit entered failed state.
May 01 03:59:35 raspberrypi systemd[1]: bitcoind.service: Failed with result 'exit-code'.
May 01 04:00:05 raspberrypi systemd[1]: bitcoind.service: Service hold-off time over, scheduling restart.
May 01 04:00:05 raspberrypi systemd[1]: Stopped Bitcoin daemon.
May 01 04:00:05 raspberrypi systemd[1]: Starting Bitcoin daemon...

pi@raspberrypi:~ $ systemctl status bitcoind.service
● bitcoind.service - Bitcoin daemon
Loaded: loaded (/etc/systemd/system/bitcoind.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2018-05-01 04:00:06 CEST; 4s ago
Process: 1244 ExecStart=/usr/local/bin/bitcoind -pid=/home/pi/.bitcoin/bitcoind.pid (code=exited, status=0/SUCCESS)
Main PID: 1245 (bitcoind)
CGroup: /system.slice/bitcoind.service
└─1245 /usr/local/bin/bitcoind -pid=/home/pi/.bitcoin/bitcoind.pid

May 01 04:00:05 raspberrypi systemd[1]: Starting Bitcoin daemon...
May 01 04:00:06 raspberrypi systemd[1]: Started Bitcoin daemon.

and so on.. it switched from activating to active (running state)

I'm using only one user (pi) instead of more like the guide.

Access credentials

I misread your comment about not changing the password when moving to mainnet. What do you mean by 'recreate access credentials?'

Thanks

Verification of bitcoind operations (testnet)

Great guide!! I'm a total noob and have been following along and feeling like I'm making pretty good progress.

I have run into an issue though under the section Bitcoin -> Verification of bitcoind operations. Note: running on testnet.

When I run the command..

$ sudo tail -f /home/bitcoin/.bitcoin/testnet3/debug.log

..it returned multiple lines that read "Potential stale tip detected, will try using extra outbound peer" and

$ bitcoin-cli getblockchaininfo

showed blocks are 0 and headers are 0 and verificationprogress was not really moving.

A quick google search lead me to a potential solution where I added the following lines to the bitcoin.conf file:

addnode=104.237.131.138
addnode=151.80.205.132
addnode=192.155.82.123
addnode=74.220.255.190
addnode=80.100.203.151

And now it seems it might be syncing.

My question is, is this the proper way of solving this, and will this fix hold up when I switch over to mainnet?

Thanks!

REQUEST: add the procedure to securely upgrade BITCOIN and LND bin

Why not add in the guide the procedure to upgrade LND and BITCOIN bin as now are both surpassed?

I hope these are the correct steps (all from ADMIN user):

$ sudo systemctl stop lnd
$ sudo systemctl stop bitcoind

then download releases:

cd /home/admin/download
wget https://bitcoin.org/bin/bitcoin-core-0.16.1/test.rc1/bitcoin-0.16.1rc1-arm-linux-gnueabihf.tar.gz
tar -xvf bitcoin-0.16.1rc1-arm-linux-gnueabihf.tar.gz
sudo install -m 0755 -o root -g root -t /usr/local/bin bitcoin-0.16.1/bin/*

cd /home/admin/download
$ wget https://github.com/lightningnetwork/lnd/releases/download/v0.4.2-beta/lnd-linux-arm-v0.4.2-beta.tar.gz
tar -xzf lnd-linux-arm-v0.4.2-beta.tar.gz
sudo install -m 0755 -o root -g root -t /usr/local/bin lnd-linux-arm-v0.4.2-beta/*

$ sudo systemctl start lnd
$ sudo systemctl start bitcoind

bitcoin@raspberrypi:~ $ bitcoin-cli -version
Bitcoin Core RPC client version v0.16.1rc1
bitcoin@raspberrypi:~ $ lncli -v
lncli version 0.4.2 commit=7cf5ebe2650b6798182e10be198c7ffc1f1d6e19

LND Lightning Daemon keeps rescanning

Hi
I have run into an issue. My LND Lightning Daemon keeps rescanning from different blocks. It seems that it never finishes these tasks. Therefore, it seems it does not update the correct status of channels, either. Also, I can not close any channels nor make payments. Not sure, if it's related to this issue: lightningnetwork/lnd#760
I have some funds in those channels. Any recommendations how to get these funds back?
screenshot 2018-04-03 00 16 08

Channels are not being created?

I've followed the guide, (a lot of fun, thanks),
I've now been synced and running for 3 days (testnet). I'm unable to make payments and I can't workout what is wrong.

Here is my 'getinfo' information:
"alias": "YOUR_NAME [LND]",
"num_pending_channels": 0,
"num_active_channels": 0,
"num_peers": 3,
"block_height": 1311616,
"block_hash": "0000000000035ba197ff3c9276f3452923fc868beef26cda780a6dd17e400aad",
"synced_to_chain": true,
"testnet": true,
"chains": [
"bitcoin"

Here's the message I get when I try starblocks:

"payment_error": "unable to route payment to destination: UnknownNextPeer",
"payment_preimage": "",
"payment_route": null

Here's the message I receive when I try Y'alls:

    "payment_error": "unable to find a path to destination",
    "payment_preimage": "",
    "payment_route": null

Lightning Wallet

Hi, when initially trying to unlock my new lightning wallet i'm getting a message saying wallet is encrypted. I'm assuming i'm putting in the wrong password, I must have accidentally mispelled it twice when creating it. How do I go about setting up a new one?
Thanks,

Cannot send payment to Starblocks

I have followed Stadicus's guide (with thanks!) and setup my testnet lnd wallet without issue. Payments to Y'alls work instantly (Fish likes Milk). Unfortunately payments to Starblocks aren't working. I use the same command "lncli sendpayment --pay_req=lnt...." to both sites. I get the following timeout

"payment_error": "payment attempt not completed before timeout of 1m0s",
"payment_preimage": "",
"payment_route": null

I have had the lightning wallet up and running on testnet for about 72 hours and have and the same error the whole time. I have 4 peers and 6 channels. Using LND version 0.4.2

TFT

Fully trustless bitcoin nodes

A couple of times this guide uses the phrase "fully trustless bitcoin node". Especially in the bitcoin node page it says that using a full node makes bitcoin trustless. This is true but incomplete, and it might be worth rephrasing.

Full nodes check all the validity rules of bitcoin. Miners set the history of transactions.

Bitcoin's security model requires both full nodes and miners to be decentralized. The full-node-using economy must be decentralized to stop fake bitcoins being accepted as payment, the miners must be decentralized to stop censorship of transactions and to make transactions irreversible.

In your guide you could say something like "full nodes are required to make bitcoin trustless". Maybe mention this analogy I like: "If bitcoin is digital gold, then a full node wallet is your own personal goldsmith who checks for you that received payments are genuine" or "If bitcoin is digital cash, then a full node wallet is your own personal laboratory which checks for you that received banknotes are real."

Raspbolt

In the guide for raspberry you make this steps:
sudo systemctl enable bitcoind
sudo shutdown -r now

But you don't take into account that we have synced datadir and it kills the chainstate so you have to reindex.

This question is concerning the raspibolt, please help!

This question is concerning the raspibolt, please help!

issue with ip uri on test net explorer acinq showing all zeros and moving the locale, it is also clustered with 19 other nodes the nodes. Locale on the map should be north Carolina but it shows it off the coast of Africa @Stadicus https://explorer.acinq.co/n/03013321192df9ccd975baf68436c451957aac1498b759a8f066ef51ca9339abfb

03013321192df9ccd975baf68436c451957aac1498b759a8f066ef51ca9339abfb@0:0:0:0:0:0:0:0:9735

Thanks!

raspibolt_balance

raspibolt_balance

I found that the way I used RaspiBolt was that I was always checking my channels I had open - with the local & remote balances. This is especially interesting when someone else opens a channel with me.

So I wrote the code below. I am not sure how to do a pull request with only 1 (of the many) files I have been working on. So I have included here. Not elegant ...but...

A few notes:

  1. As written there are 2 versions of the channel balance display. Naturally only one is needed. Rather than delete Version 1 - it is in the code ... easy to delete or comment out V1 or V2 as needed.
  2. /bin/bash compatible (As you can guess this is based on the original raspibolt which uses /bin/sh)
  3. Has a command line switch (--testnet) which is optional ... and allows it to display either the default or alternative lnd info. (.... I have both running on my RaspiBolt ... so for me the default = mainnet, and alternate = testnet)

:-)
Rob


#!/bin/bash
# RaspiBolt channel balance display
# /usr/local/bin/raspibolt_balance
# root must be able to execute bitcoin-cli and lncli

# Usage
# $ raspibolt_balance            to display lnd mainnet status
# $ raspibolt_balance --testnet  to display lnd testnet status

# Set Default (mainnet)
lncli='/usr/local/bin/lncli'
lnd_pid=$(systemctl show -p MainPID lnd | awk -F"=" '{print $2}')
chain='main'

# read cli args
for i in "$@"
do
case $i in
    --testnet*)
    lncli="/usr/local/bin/lncli  --rpcserver=localhost:11009"
    lnd_pid=$(systemctl show -p MainPID lnd_testnet | awk -F"=" '{print $2}')
    chain='test'
    shift # past argument=value
    ;;
esac
done

# set colors
color_red='\033[0;31m'
color_green='\033[0;32m'
color_yellow='\033[0;33m'
color_gray='\033[0;37m'

# get LND info
wallet_color="${color_yellow}"
if [ "$lnd_pid" -ne "0" ]; then
 ${lncli} getinfo 2>&1 | grep "Please unlock" >/dev/null
 wallet_unlocked=$?
 if [ "$wallet_unlocked" -eq 0 ] ; then
  wallet_color="${color_red}"
  ln_walletbalance="Locked"
 else
  ln_walletbalance="$(${lncli} walletbalance | jq -r '.confirmed_balance')" 2>/dev/null
  ln_channelbalance="$(${lncli} channelbalance | jq -r '.balance')" 2>/dev/null
  ln_channels_active="$(${lncli} listchannels --active_only| jq '.[] | length')" 2>/dev/null
  ln_channels_inactive="$(${lncli} listchannels --inactive_only| jq '.[] | length')" 2>/dev/null
  active_remote="$(${lncli} listchannels --active_only | jq -r '.channels |.[] | .remote_balance ' | jq -s 'add')"
  active_local="$(${lncli} listchannels --active_only | jq -r '.channels |.[] | .local_balance ' | jq -s 'add')"
  inactive_remote="$(${lncli} listchannels --inactive_only | jq -r '.channels |.[] | .remote_balance ' | jq -s 'add')"
  active_fees="$(${lncli} listchannels --active_only | jq -r '.channels |.[] | .commit_fee ' | jq -s 'add')"
  inactive_fees="$(${lncli} listchannels --inactive_only | jq -r '.channels |.[] | .commit_fee ' | jq -s 'add')"
  inactive_local="$(${lncli} listchannels --inactive_only | jq -r '.channels |.[] | .local_balance ' | jq -s 'add')"
 if [ "${active_local}" = 'null' ];then active_local=0;fi
 if [ "${active_remote}" = 'null' ];then active_remote=0;fi
 if [ "${inactive_local}" = 'null' ];then inactive_local=0;fi
 if [ "${active_fees}" = 'null' ];then active_fees=0;fi
 if [ "${inactive_fees}" = 'null' ];then inactive_fees=0;fi
 if [ "${inactive_remote}" = 'null' ];then inactive_remote=0;fi
 if [ "${ln_walletbalance}" = 'null' ];then ln_walletbalance=0;fi
 if [ "${ln_walletbalance}" = 'Locked' ];then ln_walletbalance=0;fi
 total_local=$(( ${ln_walletbalance} + ${active_local} + ${inactive_local} ))
 total_remote=$(( ${active_remote} + ${inactive_remote} ))
 total_fees=$(( ${active_fees} + ${inactive_fees} ))
 ln_channels=$(( ${ln_channels_active} + ${ln_channels_inactive} ))
 fi
else
 wallet_color="${color_red}"
 ln_walletbalance="Not Running"
fi

#### VERSION 1  ####
margin='                    '
printf "
${margin}${color_red}|    Inactive Channels    ${color_yellow}|   %7s   |${color_green}     Active Channels     |
${margin}${color_red}|Remote              Local${color_yellow}|    Wallet   |${color_green}Local              Remote|
${margin}${color_red}|%-12s %12s${color_yellow}|${wallet_color}%12s ${color_yellow}|${color_green}%-12s %12s|
" \
"${chain}net" \
"${inactive_remote}" "${inactive_local}"  "${ln_walletbalance}" "${active_local}" "${active_remote}"


#### VERSION 2  ####
margin=''
printf "
${margin}${color_yellow}%-21s${color_gray}|       ${color_yellow}Local${color_gray}|      ${color_yellow}Remote${color_gray}|${color_yellow}Commitment Fees${color_gray}|
${margin}${color_gray}%-21s|${color_green}%12s${color_gray}|%12s|%15s|
${margin}${color_gray}%-18s%3s|${color_green}%12s${color_gray}|${color_yellow}%12s${color_gray}|${color_red}%15s${color_gray}|
${margin}${color_gray}%-18s%3s|${color_red}%12s${color_gray}|${color_red}%12s${color_gray}|${color_red}%15s${color_gray}|
${margin}${color_gray}%-18s%3s|%12s|%12s|${color_red}%15s${color_gray}|
" \
"${chain}net (sat)" \
"Wallet" "${ln_walletbalance}" "" "" \
"Active Channels" "${ln_channels_active}" "${active_local}" "${active_remote}" "${active_fees}" \
"Inactive Channels" "${ln_channels_inactive}" "${inactive_local}"  "${inactive_remote}" "${inactive_fees}" \
"Total" "${ln_channels}" "${total_local}" "${total_remote}" "${total_fees}"


echo "$(tput -T xterm sgr0)"


Does RaspiBolt support Dynamic public IP?

I understand that getpublicip.service updates /run/publicip with the public IP every 10 mins.

What I am unclear about is ... if the Public IP changes after startup, does lnd get restarted with that new publicip?

  • Yes? : Great. Which code is doing the restart?
  • No?: Not much point in updating /run/publicip every 10 mins

The reason I ask is that I do not have a static IP address from my ISP and I use a service like www.dyn.com to give me a static FQDN instead.

If RaspiBolt does not support dynamic external IP addresses - then I was thinking of developing a script to notice if /run/publicip changed ... and then restart lnd. But, that brings up the ugly issue of the wallet needs to be unlocked again. :-(

sudo rm /var/swap ERROR

Hi guys,

I should start by saying I'm not especially tech savvy and this is the first time I've tried doing something like this. So far the guide has been super straightforward and I'm enjoying the process, but now I've hit a wall.

When I run sudo rm /var/swap I get the following in return:

rm: cannot remove '/var/swap': Operation not permitted

Anyone know how to get past this?

Thanks

Hardening Pi

Hi, I cannot install firewall or fail2ban.
admin@raspi:~ $ sudo apt-get install ufw
[sudo] password for admin:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package ufw is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or is only available from another source
E: Package 'ufw' has no installation candidate

admin@raspi:~ $ sudo apt-get install fail2ban
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package fail2ban

Thanks for your great work

After unlock - No connection available

Very helpful walkthrough. Thanks.

Created passwords and seeds, all smooth. Upon attempting to create a new address, or even getinfo, I am getting this error.

[lncli] rpc error: code = Unavailable desc = grpc: the connection is unavailable

I checked the lnd log:

2018-03-25 00:00:33.154 [INF] RPCS: password RPC server listening on 127.0.0.1:10009
2018-03-25 00:00:33.154 [INF] LTND: Waiting for wallet encryption password. Use lncli create to create wallet, or lncli unlock to unlock already created wallet.
2018-03-25 00:07:13.458 [INF] LNWL: Opened wallet
2018-03-25 00:07:13.921 [ERR] SRVR: invalid password
2018-03-25 00:08:14.567 [INF] LTND: Version 0.4.0-alpha
2018-03-25 00:08:14.567 [INF] LTND: Active chain: Bitcoin (network=testnet)
2018-03-25 00:08:14.591 [INF] CHDB: Checking for schema update: latest_version=0, db_version=0
2018-03-25 00:08:14.618 [INF] RPCS: password RPC server listening on 127.0.0.1:10009
2018-03-25 00:08:14.619 [INF] RPCS: password gRPC proxy started at 127.0.0.1:8080
2018-03-25 00:08:14.619 [INF] LTND: Waiting for wallet encryption password. Use lncli create to create wallet, or lncli unlock to unlock already created wallet.

I can go on an unlocking, successfully, and then attempting to create a new address, but this cycle keeps happening.

Help would be much appreciated.

some issue on the guide

From the manual:
Adding main user "admin"
This guide uses the main user "admin" instead of "pi" to make it more reusable with other platforms.

Create the new user and add it to the group "sudo"
$ sudo adduser admin ***
$ sudo adduser admin sudo
Set the password to your password [A] and set the standard shell (command line interface) to "bash"
$ sudo passwd admin <---- THIS LINE IS NOT NECESSARY IN MY OPINION (THE PASSWORD IS REQUESTED JUST AT ***)


From the manual:
Prepare Bitcoin Core directory
We use the Bitcoin daemon, called “bitcoind”, that runs in the background without user interface and stores all data in a the directory /home/bitcoin/.bitcoin. Instead of creating a real directory, we create a link that points to a directory on the external hard disk.

Change to user “bitcoin” and enter the password.
$ sudo su bitcoin <---- DOING THIS COMMAND FROM ADMIN, IT DOESN'T REQUEST THE PASSWORD LIKE WROTE IN THE COMMENT

IS NOT SPECIFY TO LOGIN WITH ADMIN, (BETTER TO SPECIFY).

Updates to new LND versions

More a question than an "issue".
I want to update from LND 0.4.0 to the newest version. Do I understand it right that I only need to run the install steps as described here: https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_40_lnd.md#install-lnd ? Probably would need to stop the LND service first, just to be sure?

Perhaps it would be good to add a note to the guide for people who are starting off on older versions (and also the advice to check for newer version every once in a while).

Also, after the update, should I be deleting the files in the Pi's "download" folder, so the HDD space doesn't get cluttered over the long run?

LN cant start 'runtime: out of memory'

bitcoind fully synced (testnet)

Memory usage:

              total        used        free      shared  buff/cache   available
Mem:           976M        101M        818M        1.0M         56M        826M
Swap:          2.0G        380M        1.6G

After LN unlock:

Apr 04 23:42:41 RaspiB lnd[6528]: 2018-04-04 23:42:41.766 [INF] LNWL: The wallet has been unlocked without a time limit
Apr 04 23:42:41 RaspiB lnd[6528]: 2018-04-04 23:42:41.766 [INF] LTND: LightningWallet opened
Apr 04 23:44:20 RaspiB lnd[6528]: runtime: out of memory: cannot allocate 374341632-byte block (1032159232 in use)
Apr 04 23:44:20 RaspiB lnd[6528]: fatal error: out of memory
Apr 04 23:44:20 RaspiB lnd[6528]: runtime stack:
Apr 04 23:44:20 RaspiB lnd[6528]: runtime.throw(0x8c7f9c, 0xd)
Apr 04 23:44:20 RaspiB lnd[6528]:         /usr/local/go/src/runtime/panic.go:619 +0x60
Apr 04 23:44:20 RaspiB lnd[6528]: runtime.largeAlloc(0x16500000, 0x60101, 0x76f39000)
Apr 04 23:44:20 RaspiB lnd[6528]:         /usr/local/go/src/runtime/malloc.go:828 +0xdc
Apr 04 23:44:20 RaspiB lnd[6528]: runtime.mallocgc.func1()
Apr 04 23:44:20 RaspiB lnd[6528]:         /usr/local/go/src/runtime/malloc.go:721 +0x38
Apr 04 23:44:20 RaspiB lnd[6528]: runtime.systemstack(0x0)
Apr 04 23:44:20 RaspiB lnd[6528]:         /usr/local/go/src/runtime/asm_arm.s:349 +0x80
Apr 04 23:44:20 RaspiB lnd[6528]: runtime.mstart()
Apr 04 23:44:20 RaspiB lnd[6528]:         /usr/local/go/src/runtime/proc.go:1170
Apr 04 23:44:20 RaspiB lnd[6528]: goroutine 84 [running]:
Apr 04 23:44:20 RaspiB lnd[6528]: runtime.systemstack_switch()
Apr 04 23:44:20 RaspiB lnd[6528]:         /usr/local/go/src/runtime/asm_arm.s:294 +0x4 fp=0x12f4ac54 sp=0x12f4ac50 pc=0x68c0c
Apr 04 23:44:20 RaspiB lnd[6528]: runtime.mallocgc(0x16500000, 0x81f080, 0x4282a601, 0x179f4)
Apr 04 23:44:20 RaspiB lnd[6528]:         /usr/local/go/src/runtime/malloc.go:720 +0x86c fp=0x12f4acb4 sp=0x12f4ac54 pc=0x21130
Apr 04 23:44:21 RaspiB systemd[1]: lnd.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Apr 04 23:44:21 RaspiB systemd[1]: lnd.service: Unit entered failed state.
Apr 04 23:44:21 RaspiB systemd[1]: lnd.service: Failed with result 'exit-code'.

Memory usage at time around error:

              total        used        free      shared  buff/cache   available
Mem:           976M        916M         39M        672K         20M         25M
Swap:          2.0G        596M        1.4G

Reboot, restart, not helped.

error: couldn't connect to server: unknown (code -1)

Hello,

First off, thank you so much for writing this. I'm not entirely new to running a full node as this is now my third time but I'm having the following problem:

When I run

$ systemctl status bitcoind.service

My screenshot seems to match yours
image

When I run the log command, it also seems to be downloading the testnet3 blocks:

$ sudo tail -f /home/bitcoin/.bitcoin/testnet3/debug.log
image

But when I follow the next step, I get the following error:
$ bitcoin-cli getblockchaininfo

error: couldn't connect to server: unknown (code -1)
(make sure server is running and you are connecting to the correct RPC port)

From my limited experieince of running a node, this is usually because I have yet to run the command

bitcoind -daemon

However, I can see the blocks downloading due to the service we created. Any ideas as to why I am getting this error? This is all from the admin user created through the tutorial.

Testnet

Hii thx for the manual!

the status is:

● bitcoind.service - Bitcoin daemon Loaded: loaded (/etc/systemd/system/bitcoind.service; enabled; vendor preset: enabled) Active: active (running) since Sun 2018-04-22 12:39:07 CEST; 6min ago Process: 321 ExecStart=/usr/local/bin/bitcoind -pid=/home/bitcoin/.bitcoin/bitcoind.pid (code=exited, status=0/SUCCESS) Main PID: 405 (bitcoind) CGroup: /system.slice/bitcoind.service └─405 /usr/local/bin/bitcoind -pid=/home/bitcoin/.bitcoin/bitcoind.pid

but in the log have connection probs:

2018-04-22 10:40:45 init message: Loading banlist... 2018-04-22 10:40:45 init message: Starting network threads... 2018-04-22 10:40:45 DNS seeding disabled 2018-04-22 10:40:45 net thread start 2018-04-22 10:40:45 opencon thread start 2018-04-22 10:40:45 init message: Done loading 2018-04-22 10:40:45 msghand thread start 2018-04-22 10:40:45 addcon thread start 2018-04-22 10:40:45 Imported mempool transactions from disk: 80 succeeded, 0 fai led, 0 expired, 0 already there 2018-04-22 10:40:45 connect() to 144.76.220.17:9090 failed after select(): Conne ction refused (111) 2018-04-22 10:41:01 connect() to 51.15.78.11:8333 failed after select(): Connection refused (111) 2018-04-22 10:41:01 connect() to 5.135.180.61:8333 failed after select(): Connection refused (111) 2018-04-22 10:41:01 connect() to 46.233.43.155:8333 failed after select(): Connection refused (111) 2018-04-22 10:41:06 connect() to 69.55.64.221:8333 failed after select(): Connection refused (111) 2018-04-22 10:41:23 connect() to 83.163.223.145:8333 failed after select(): Connection refused (111) 2018-04-22 10:41:33 connect() to 147.91.82.116:8333 failed after select(): Connection refused (111) 2018-04-22 10:41:47 connect() to 34.253.24.13:8333 failed after select(): Connection refused (111) 2018-04-22 10:41:47 connect() to 163.172.4.66:8333 failed after select(): Connection refused (111)

do you have an idea what the problem could be?

many thanks!

Bonus: Raspibolt eth0: error fetching interface information: Device not found

Added the Bonus section for the Raspibolt MOTD.

But I get this error:
eth0: error fetching interface information: Device not found

Which is not surprising as eth0 is not a known interface on my Pi
admin ~ ฿ ifconfig
enxb827ebba577c: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.141 netmask 255.255.255.0 broadcast 192.168.0.255
......
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
.....

I am using a LAN cable connected to the Raspi LAN port

I edited /usr/local/bin/raspibolt as below .. and all good

#network_rx=$(ifconfig eth0 | grep 'RX packets' | awk '{ print $6$7 }' | sed 's/[()]//g')
#network_tx=$(ifconfig eth0 | grep 'TX packets' | awk '{ print $6$7 }' | sed 's/[()]//g')
network_rx=$(ifconfig enxb827ebba577c | grep 'RX packets' | awk '{ print $6$7 }' | sed 's/[()]//g')
network_tx=$(ifconfig enxb827ebba577c | grep 'TX packets' | awk '{ print $6$7 }' | sed 's/[()]//g')

? Did I miss a step defining eth0 somewhere?

raspibolt_channels

[ Still can't workout how to create a branch with ONLY this change in it.]
capture

This is a candidate for the Bonus section

Rob


#!/bin/bash
###############################################
#  /usr/local/bin/raspibolt_channels
#
#  Shows details of current channels
#
###############################################

# Usage
# $ raspibolt_channels            to display lnd mainnet channels
# $ raspibolt_channels --testnet  to display lnd testnet channels

# Set Default (mainnet)
lncli='/usr/local/bin/lncli'
lnd_pid=$(systemctl show -p MainPID lnd | awk -F"=" '{print $2}')
chain='main'

# read cli args
for i in "$@"
do
case $i in
    --testnet*)
    lncli="/usr/local/bin/lncli  --rpcserver=localhost:11009"
    lnd_pid=$(systemctl show -p MainPID lnd_testnet | awk -F"=" '{print $2}')
    chain='test'
    shift # past argument=value
    ;;
esac
done

if [ "$lnd_pid" -eq "0" ]; then
 echo lnd not runnning.
 exit
fi

# set colors
color_red='\033[0;31m'
color_green='\033[0;32m'
color_yellow='\033[0;33m'
color_gray='\033[0;37m'

# gather values
a_active=( $(${lncli} listchannels | jq -r ' .channels[].active'))
a_remote_pubkey=( $(${lncli} listchannels | jq -r ' .channels[].remote_pubkey'))
a_capacity=( $(${lncli} listchannels | jq -r ' .channels[].capacity'))
a_local_balance=( $(${lncli} listchannels | jq -r ' .channels[].local_balance'))
a_remote_balance=( $(${lncli} listchannels | jq -r ' .channels[].remote_balance'))
a_commit_fee=( $(${lncli} listchannels | jq -r ' .channels[].commit_fee'))
a_channel_point=( $(${lncli} listchannels | jq -r ' .channels[].channel_point'))

total=${#a_active[*]}
total_capacity=0
total_fee=0
total_local=0
total_remote=0

#display
printf "${color_yellow}%-7s%60s %11s\n" "${chain}net" 'Commit ------- Balance ---------' '--- Fee ----'
printf "%-21s %12s %5s %12s %12s %6s %5s\n" 'Alias or Pubkey' 'Capacity' 'Fee' 'Local' 'Remote' 'Base' 'PerMil'
horiz_line="-------------------- ------------- ------ ------------ ------------ ----- ------"
echo $horiz_line
for (( i=0; i<=$(( $total -1 )); i++ ));do
 if [ ${a_active[$i]} == 'true' ];  then
  color_line=${color_gray}
 else
  color_line=${color_red}
 fi
 alias=$(${lncli} getnodeinfo ${a_remote_pubkey[$i]} | jq -r .node.alias)
 if [ "${alias}" == "" ] ; then
  alias_short=$(echo ${a_remote_pubkey[$i]} | cut -c-17)...
 else
  alias_short=$(echo ${alias} | cut -c-20)
 fi
 active_short=$(echo ${a_active[$i]} | cut -c1)
 # get fee report details
 base_fee_msat=$(${lncli} feereport | jq -r ".channel_fees[] | select(.channel_point | test(\"${a_channel_point[$i]}\")) | .base_fee_msat")
 fee_per_mil=$(${lncli} feereport | jq -r ".channel_fees[] | select(.channel_point | 
 test(\"${a_channel_point[$i]}\")) | .fee_per_mil")
 # Display line 
 printf "${color_line}%-21s %12s %6s %12s %12s %5s %6s\n" \
        "${alias_short}" "${a_capacity[$i]}" "${a_commit_fee[$i]}" "${a_local_balance[$i]}" \
        "${a_remote_balance[$i]}" "${base_fee_msat}" "${fee_per_mil}"
 total_capacity=$(( ${total_capacity} + ${a_capacity[$i]} ))
 total_fee=$(( ${total_fee} + ${a_commit_fee[$i]} ))
 total_local=$(( ${total_local} + ${a_local_balance[$i]} ))
 total_remote=$(( ${total_remote} + ${a_remote_balance[$i]} ))
done
printf "${color_yellow}%s\n" "${horiz_line}"
printf "Totals%14s %13s %6s %12s %12s" "${total} ch" "${total_capacity}" "${total_fee}" "${total_local}" "${total_remote}"
echo "$(tput -T xterm sgr0)"

lncli newaddress np2wkh - grpc error

I followed the guide in order to add lnd for mainnet (at blockchain level it's all working nice) but after created lncli..

admin@raspberrypi:~ $ lncli newaddress np2wkh
[lncli] Wallet is encrypted. Please unlock using 'lncli unlock', or set password using 'lncli create' if this is the first time starting lnd.
admin@raspberrypi:~ $ lncli unlock
Input wallet password:

lnd successfully unlocked!
admin@raspberrypi:~ $ lncli newaddress np2wkh
[lncli] rpc error: code = Unavailable desc = grpc: the connection is unavailable
admin@raspberrypi:~ $ sudo journalctl -f -u lnd
-- Logs begin at Thu 2016-11-03 18:16:42 CET. --
May 05 14:08:30 raspberrypi lnd[2263]: 2018-05-05 14:08:30.303 [INF] RPCS: password RPC server listening on 127.0.0.1:10009
May 05 14:08:30 raspberrypi lnd[2263]: 2018-05-05 14:08:30.304 [INF] RPCS: password gRPC proxy started at 127.0.0.1:8080
May 05 14:08:30 raspberrypi lnd[2263]: 2018-05-05 14:08:30.304 [INF] LTND: Waiting for wallet encryption password. Use lncli create to create wallet, or lncli unlock to unlock already created wallet.
May 05 14:09:12 raspberrypi lnd[2263]: 2018-05-05 14:09:12.467 [INF] LNWL: Opened wallet
May 05 14:09:12 raspberrypi lnd[2263]: 2018-05-05 14:09:12.899 [INF] LTND: Primary chain is set to: bitcoin
May 05 14:09:12 raspberrypi lnd[2263]: 2018-05-05 14:09:12.900 [INF] LTND: Initializing bitcoind backed fee estimator
May 05 14:09:19 raspberrypi lnd[2263]: 2018-05-05 14:09:19.136 [INF] LNWL: Opened wallet
May 05 14:09:19 raspberrypi systemd[1]: lnd.service: Main process exited, code=exited, status=1/FAILURE
May 05 14:09:19 raspberrypi systemd[1]: lnd.service: Unit entered failed state.
May 05 14:09:19 raspberrypi systemd[1]: lnd.service: Failed with result 'exit-code'.

Could not login as lncli listchannels would hang

Reporting here in case it happens to someone else.

For reasons I have yet to understand, right now on my RaspiBolt, this command is hanging
lncli listchannels

As a consequence, that means that the raspibolt script (admin MOTD) was hanging => I could not get a prompt when logging in as admin.

I have seen reports from others on Google of lncli listchannels hanging.

I managed to get to the prompt (by rebooting and logging in ASAP) and commented out this line (for now) so at least I can login

Commented out this line in /usr/local/bin/raspibolt
#ln_channels_total="........."

Still investigating but so far ......

A)
lncli connect [email protected]:9735
[lncli] rpc error: code = Unknown desc = chain backend is still syncing, server not active yet

B)
bitcoin /home/admin ฿ bitcoin-cli getblockchaininfo
{
"verificationprogress": 0.9999970407145348 <--- this number is DECREASING over time
}

C)
bitcoin /home/admin ฿ lncli getinfo
{
"num_pending_channels": 0,
"num_active_channels": 0,
"num_peers": 0, <----------- ????
"synced_to_chain": false, <---------- ????
"testnet": true,
"chains": [
"bitcoin"
],
}

sudo needed when setting up bitcoin.conf

only a minor annoyance, but instead of

$ nano /home/bitcoin/.bitcoin/bitcoin.conf

it should be

$ sudo nano /home/bitcoin/.bitcoin/bitcoin.conf

otherwise the user will find that he cannot save the edited file.

Channel OFFLINE if LND Wallet Locked

Not sure if this an issue with LND, or something that can be fixed in RaspiBolt

ISSUE
The Eclair Testnet Wallet App sees a channel that exists to a RaspiBolt as OFFLINE if the LND wallet has not been unlocked. This is an issue as that means if a RaspiBolt just boots up (or recovers from a power failure) then the channel remains offline.

NETWORK

[LIGHTNING TESTNET] ---฿฿฿฿--- [My RaspiBolt] ---฿฿฿฿--- [Eclair]

---฿฿฿฿--- = Funded channel

DETAILS

eclair

Clearing logs

In the Known Issues section at the end of Mainnet you give a fix for systems that run out of space due to the logs (which works fine)

Typo?

$ cd /var/logs

Should be

$ cd /var/log

"Get external IP script" not discussed

We set up a daemon which requires "getpublicip.service", but we did not implement that yet.
There is a missing part in the instructions which is about getting the public IP and saving it
to a temp file in memory. You do have those scripts in the repo, though.

No password input when entering lnd unlock password, remotely off site, in Putty

I'm not sure if this is an issue with Putty settings or LND.

I'm not home this weekend, so I setup ufw to accept the IP where I'm staying. I signed in fine on admin. I got into user bitcoin fine, with the admin password, yet, when i do lncli unlock, the password prompt comes up but it seems no input is being accepted to the Putty shell.

After entering the password, correctly, I get the prompt:

"[lncli] Wallet is encrypted. Please unlock using 'lncli unlock', or set password using 'lncli create' if this is the first time starting lnd."

As if I didn't enter any input, whatsoever. Putty doesn't act this way, locally, when I'm at home. It goes through, no problem.

Does anyone out there know what could be the problem? I didn't want to post this to the LND issues page because I'm a total newb when it comes to Linux/Unbuntu and this could be a common problem with beginners and, imo, it would be better served here,

Sending payment not working

My node is online:
https://explorer.acinq.co/#/n/0366e4191c0271562700edfcfadca560c1a999b0b76731cf97eed1c5695bc418d9

Got 3 peers and 6 Channels.

Balance is as following:
"total_balance": "61109819",
"confirmed_balance": "61109819",
"unconfirmed_balance": "0"

When making a transaction I input following:
``$ lncli sendpayment --pay_req=lntb19u1pdt07h5pp5ra6qa7hmpd3qatr.........07g46mu97u5s2q2jsyjvg`

The issue is that nothing happens after this step. The "cursor" just stays one line below without the prefix
admin@AURORA:~ $

I can press Ctrl+C and then enter $ lncli listpayments

Result is: "payments": [
]

Tried 5 times with different payment requests.

What may the reason be that I can't perform payments?

FAQ: Public Not reachable

On raspibolt script from few days i have this:

฿itcoin (mainnet)
Sync OK
Public Not reachable

In past, Public was OK, but now it's on "Not reachable" state.
I didn't change anything.. what could be happened?
The node however is working good, i can see it online from eclair wallet as i use that node.

Can we use microSD instead of an external HDD

Thanks for the great guide! Just a quick question, i checked online and ~512GB microSD are pretty cheap (~20$). Can we avoid using an external HDD and download the entire blockchain on the microSD.

Insecure permissions when moving Swap File

Not able to enable new swap configuration because of insecure permissions.

When executing the command sudo dphys-swapfile swapon, the following error occurs:

swapon: /mnt/hdd/swapfile: insecure permissions 0777, 0600 suggested.
swapon: /mnt/hdd/swapfile: read swap header failed

My node's dphys-swapfile file (using default settings only changing CONF_SWAPFILE and CONF_SWAPSIZE:

  GNU nano 2.7.4                   File: /etc/dphys-swapfile

# /etc/dphys-swapfile - user settings for dphys-swapfile package
# author Neil Franklin, last modification 2010.05.05
# copyright ETH Zuerich Physics Departement
#   use under either modified/non-advertising BSD or GPL license

# this file is sourced with . so full normal sh syntax applies

# the default settings are added as commented out CONF_*=* lines

# where we want the swapfile to be, this is the default
#CONF_SWAPFILE=/var/swap
CONF_SWAPFILE=/mnt/hdd/swapfile

# set size to absolute value, leaving empty (default) then uses computed value
#   you most likely don't want this, unless you have an special disk situation
CONF_SWAPSIZE=1000

# set size to computed value, this times RAM size, dynamically adapts,
#   guarantees that there is enough swap without wasting disk space on excess
#CONF_SWAPFACTOR=2

# restrict size (computed and absolute!) to maximally this limit
#   can be set to empty for no limit, but beware of filled partitions!
#   this is/was a (outdated?) 32bit kernel limit (in MBytes), do not overrun it
#   but is also sensible on 64bit to prevent filling /var or even / partition
#CONF_MAXSWAP=2048

ufw and fail2ban not in repositories

The packages ufw and fail2ban are not in the current raspbian repositories. I suggest removing those from the guide, adding instructions on how to install them anyway, or modify the section using alternative approaches.

Otherwise, I have worked through major parts of this nicely prepared guide without problems, thanks!

Can't use bitcoin-cli unless restart

shutdown -r now
Login as admin

admin ~ ฿ sudo su bitcoin

bitcoin /home/admin ฿ systemctl status bitcoind
● bitcoind.service - Bitcoin daemon
Loaded: loaded (/etc/systemd/system/bitcoind.service; enabled; vendor preset:
Active: active (running) since Sun 2018-03-25 17:39:23 AWST; 12min ago
Process: 539 ExecStart=/usr/local/bin/bitcoind -pid=/home/bitcoin/.bitcoin/bit
Main PID: 555 (bitcoind)
CGroup: /system.slice/bitcoind.service
└─555 /usr/local/bin/bitcoind -pid=/home/bitcoin/.bitcoin/bitcoind.pi

bitcoin /home/admin ฿ tail -f /home/bitcoin/.bitcoin/testnet3/debug.log
[...]
2018-03-25 09:55:58 UpdateTip: new best=00000000794c2c0158a5e35820aec55cc84bdceb4a992154042b509a76756e2c height=1289135 version=0x20000000 log2_work=69.810808 tx=17649803 date='2018-03-25 09:55:51' progress=1.000000 cache=0.1MiB(543txo)

[Bitcoind is Running - OK (testnet), and synced]

bitcoin /home/admin ฿ bitcoin-cli getblockchaininfo
error: couldn't connect to server: unknown (code -1)
(make sure server is running and you are connecting to the correct RPC port)

bitcoin /home/admin ฿ systemctl restart bitcoind

bitcoin /home/admin ฿ bitcoin-cli getblockchaininfo
{
"chain": "test",
"blocks": 1289135,
[...]
},
"warnings": ""
}

Now all good.

100% reproducable
????

Segmentation fault

Thanks a lot for your hard work. Everything works fine until I try to execute bitcoind (or check the version) with "bitcoind --version". The immediate output I get then is "Segmentation fault".

I've tried to find out what it means without much avail. Someone suggested it could be caused by too low power for the hard drive so, I've changed the HDD but the behavior remains the same (both HDDs had an external power supply). Went through the whole tutorial from scratch three times with the same result, tried bitcoin-0.16.0 and also bitcoin-0.15.0.

When I check the status of the bitcoind.service I get this output:
● bitcoind.service - Bitcoin daemon Loaded: loaded (/etc/systemd/system/bitcoind.service; enabled; vendor preset: enabled) Active: activating (auto-restart) (Result: signal) since Sat 2018-03-31 18:19:39 CEST; 3s ago Process: 496 ExecStart=/usr/local/bin/bitcoind -pid=/home/bitcoin/.bitcoin/bitcoind.pid (code=killed, signal=SEGV)

Any suggestions on what the error message means and how I could get rid of it or how to investigate further would be highly appreciated.

Edit: The hard drive is mounted and linked, I can create and remove files. The only file located in ".bitcoin" is the "bitcoin.conf" file which is created during the tutorial. So there is no "debug.log" file which could contain helpful information.

create chat / support forum for these guides (and others?)

what do you think about creating or linking to a Riot, Mattermost, or IRC type chat room whereby ppl can get real time chat support with setting up their RaspiBolt / Thundroid / other possible future similar offerings?

this is not remotely a criticism of @Stadicus wonderful guides. thank you so much for your outstanding creation here 😄 my thinking is just that real time chat can provide welcoming help to curious newcomers and help build community in a way that issue trackers can not.

i would definitely be up for idling in such a chan and helping out if theres interest.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.