June 20, 2019

Getting LND running on an old Android Phone

UPDATE: 07/09/2019: Upon trying to go through this process on another Android phone, I found I wasn’t able to get passed the go installation process, after much troubleshooting, I haven’t been able to figure it out. For now, I’m declaring this project a bit of a failure, but will continue to attempt to figure out the issue or otherwise find another way around.

In 2018, the Lightning Network hit mainnet. I spent the majority of the year wanting to get involved but wasn’t sure how to do it. I was able to buy a Casa node but I had to wait three months for it to ship. I wanted to get started right away so I decided that I would try to figure out how to setup a BTCPay server. Shortly thereafter I had a LN node running and I was able to do some transactions. Later on, I received my Casa node and realized how closed the interface was. This fueled my desire to have more direct control over my LND node.

To better understand what was going on under the hood” I had to learn the scary command line side of things. This started by SSHing into my BTCPay server. Later on, I was able to use Pierre’s Node Launcher to have LND running in Windows. This allowed me to learn some of the basics of the config side of things.

Sometime in 2019 I was on Twitter reading about Lawrence Nahum’s ABCore. ABCore is an Android app that allowed someone to run a Bitcoin full node on their phone. My first thought was: Could I run LND on an Android phone? Having used something called Termux before, I knew you could have a Linux running on top of Android. It seemed like running on LND in Termux was at least possible.

After some encouragement from Larry himself, I decided to see if I could get LND running on an old Samsung Note 5. This article is the manifestation of that encouragement and the desire to write out this idea so others can get inspired.

Installing Bitcoin

The first step is to get ABCore installed on your Android device:

Install ABCore

Once installed it will present you with an option to download the latest version of Bitcoind.

Please proceed to Settings-> Daemon Configuration-> Manually edit bitcoin.conf to edit your bitcoin.conf file.

Edit bitcoin.conf to include:

disablewallet=1
prune=10000
rpcuser=[choose_username] 
rpcpassword=[choose_password] 
server=1
deamon=1

Go back to the opening screen of ABCore to begin syncing the blockchain to your phone. This process took me several days on my Note 5 and might take longer on older devices. In the meantime, let’s go ahead and get LND setup.

Installing LND

To get started in that process you’ll need to install Termux.

Termux has limits, so we’ll need a version of Linux running in Termux that would allow more flexibility.

In my case, I found a script that allows you to use a version of Ubuntu along with proot to get LND installed within Termux.

The script is found here. Security tip: Double check that everything in the script is doing what you expect it to do or else you’re trusting some random code on the internet. Don’t trust, verify.

Run the following commands to get a Ubuntu shell running:

apt-get update && apt-get upgrade -y
apt-get install wget -y
apt-get install proot -y
apt-get install git -y
apt-get install coreutils -y
cd ~
git clone https://github.com/MFDGaming/ubuntu-in-termux.git
cd ubuntu-in-termux
chmod +x ubuntu.sh
./ubuntu.sh
cp ~/ubuntu-in-termux/resolv.conf ~/ubuntu-in-termux/ubuntu-fs/etc/

Ubuntu is now installed on Termux, all you have to do now is to start Ubuntu:

./start.sh

Make sure to update your repos/packages:

apt-get update && apt-get upgrade -y
apt-get install wget -y
apt-get install nano -y

Next up is getting GO installed and ready for our LND installation:

wget https://dl.google.com/go/go1.12.3.linux-amd64.tar.gz
sha256sum go1.12.3.linux-amd64.tar.gz | awk -F " " '{ print $1 }'

The final output of the command above should be 3924819eed16e55114f02d25d03e77c916ec40b7fd15c8acb5838b63135b03df. If it’s not, the file has been modified.

tar -C /usr/local -xzf go1.12.3.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
export GOPATH=~/gocode
export PATH=$PATH:$GOPATH/bin

Now that GO is installed, we are ready to install LND:

go get -d github.com/lightningnetwork/lnd
cd $GOPATH/src/github.com/lightningnetwork/lnd
make && make install

In my case, it took quite a while for LND to build, so go do something else for a bit and come back later. We’ll now need to create and set the configuration options using your lnd.conf.

Please navigate to the LND directory and create a text file using nano:

cd ~/.lnd/
nano lnd.conf

Input the following into the lnd.conf file:

[Applications Options]
externalip=[Input your external IP]:9735
alias=[Name of your Node]
color=[Choose a color for your node]
listen=0.0.0.0:9735

[Bitcoin]
bitcoin.active=1
bitcoin.mainnet=1
bitcoin.node=bitcoind

[Bitcoind]
bitcoind.rpcuser=[use the username that you input above for bitcoin.conf]
bitcoind.rpcpass=[use the pass that you input above for bitcoin.conf]
bitcoind.zmqpubrawblock=tcp://127.0.0.1:28332
bitcoind.zmqpubrawtx=tcp://127.0.0.1:28333

One of the final steps is to configure your hosts file because it doesn’t map localhost by default:

cd /etc/
nano hosts

Add the following line to your hosts file:

127.0.0.1 localhost

Finishing Up

After these steps, all you have to do is wait for your Bitcoin node to finish syncing. Once that is complete, you’ll type LND into your ubuntu command line. You’ll select a password and write down your seed for your LND node.

You’ll then need to open up another session, swipe from the left of your screen to do so. You’ll need to run your Ubuntu shell again:

cd /ubuntu-in-termux/
./start.sh

Then you’ll need to unlock LND:

lncli unlock

You’ll be asked to enter your password and you should now be able to start using your LND node on your Android phone!

Some limitations:

  • It has been more challenging to figure out how to use an external GUI interface with this implementation. This is a work in progress and it is my hope that I can figure this out because right now, using command line only on Android is a huge pain.
  • On my old Samsung Note 5, I’ve noticed that after a few days of not touching the phone, I’d return to see that both Bitcoind and LND not running any longer. This is likely due to Samsung phones being aggressive with putting these apps to sleep. Future testing might include using a stripped down non-Samsung ROM.

Thank you to https://twitter.com/p_miller_ and https://twitter.com/mrcoolbp for their help in making this post even better.

Let me know if you found this guide useful and if you think there’s anything I can improve!

bitcoin crypto writing Lightning Network LND android phone
April 15, 2019

Adventures in the Lightning Network

One of my favorite Andreas Antonopoulos videos is where he introduces the Lightning Network and the concept of streaming money’ in his highly inspiring way. He tries to make sure everyone understands the general concept around the Lightning Network but he also wanted to wax poetic about the potential usecases of such a network.

Streaming money turned into an inspiration for me to look into the Lightning Network more in depth. Being paid monthly has always been a stress in my life and the concept of getting constant ongoing payment instead of waiting until the end of the month holds a lot of value for me.

It took a long time for me to finally be able to dig in on this vision. It was in early 2018 that the Lightning Network began to explode on Bitcoin. It probably wasn’t until October until I was able to spin up my own LND node in order to experiment myself. This started with a BTCPay server node hosted on a VPS that only charges around ~$17 per month for both a Bitcoin node and a LND node.

This began my adventure in playing with the Lightning Network. Right around the same time, many of the mobile LN wallets out there began to get even better. The Bitcoin Lightning Wallet was one of the first wallets to allow receiving on mobile. (Since then Eclair wallet has also added this functionality.) In Dececmber, I received my Casa node and began exploring even more. Eventually understanding the relationship of routing, fees, and generally how the UX is for possible n00bs in the system.

Currently the wallets that I am using:

Some planned writings relating to the Lightning Network:

  • Reviews of the wallets stated above.
  • Exploration of how a newbie might be able to get onboarded onto LN.
  • Exploring the idea of channel selection’ similar to the idea of coin selection’ in Bitcoin wallets like Samourai wallet.
  • Doing a deeper dive on streaming money’ and how it might be possible within less than 12 months.
bitcoin crypto writing Lightning Network
September 9, 2018

Crypto Transformation

In this update, I’m moving over to a new service provider to mark the final move away from the I’m going to be a photographer” Squarespace blog that I setup so long ago.

Time to move to a simpler platform that focuses on writing and just blog creation. What’s the subject matter? Bitcoin. Crypto. The only thing that keeps me excited, the only thing that keeps me fueled, the only thing that keeps me learning and pushing myself.

You’ll find that the blog might have some broken image links, I’m going to be fixing these over time.

bitcoin crypto writing next chapter
August 11, 2017

Evolution as a Choice

It has been a while since I’ve written here. It has been a while since I’ve written much of anything at all. 

It is somewhat embarrassing to have a blog with no updates for more than a year. However, much has been happening in my life. Lost one job, went through several others, then found my absolute dream job, in my dream industry. Learning more than ever. Changing my worldviews. 

It is my desire to write more, it is my choice to create more. More photography, more writing, more video. 

Let this be a symbol of my next form, my next evolution. 

Hopefully more to come and not years before the next followup to this blog.

April 10, 2016

Saga of Technology

In the 1993 movie Demolition Man, Sylvester Stallone starred as a cop cryogenically frozen for 36 years. John Spartan finds himself in the year 2032.  Things are a bit of a dystopian pseudo-Utopian future where language is sterilized, anything considered bad for you is illegal, everyone is tracked by biochips’ implanted in their hands, and Taco Bell is the only restaurant left standing after the great franchise wars.

While this movie isn’t the highest rated movie of all time. It is certainly cheesy in parts and almost prophetic in others. It has self driving cars, video chat, cryogenic reanimation, and virtual reality sex. It has its local government tracking everyone’s movements all of the time via biochips’ that allow instantaneous localization at all times of anyone. These chips would likely to have been used for a citizen’s entire identity and would allow for easy frictionless payment.

This movie gives us a good example of the meme of one day that all payment systems or identity systems will converge on the ever so scary microchip’. We will adorn ourselves with the technology that we currently keep in our pocket?

Will this be a negative?

Does it have to be?

While the idea of a sub-dermal chip being able to track me at all times is frightening, this is almost the reality today. Our phones are as close to being sub-dermal without literally being so. They are on us 24/7. But we still at least have the luxury of not having to dig our phone out of our hand with a scalpel to escape tracking.

Bitcoin could serve as the underlying philosophy of how a frictionless payment chip could work and in a way that wouldn’t allow external control. Hopefully we’ll still get self driving cars and virtual reality sex.

bitcoin future bioimplants implants money Bitcoin Writing technology
December 31, 2014

Focusing on Virtual Reality

A lot has changed since I last posted…

My Oculus Rift arrived!

The Oculus’ certainly was a gigantic step above the Google Cardboard. From the sheer quality of head tracking to the seeming level of immersion and new plateaus of presence’ never felt before. My brain was so very easy to trick with JUST the Oculus Configuration Utility — with a plant that I knew’ was there in front of me. But it truly was not, my first instinct was to attempt to touch it, this instinct on a level somewhere below the conscious knowledge that I’m looking at a Note 3 screen a few inches from my face. It is truly humbling to see the reptile/mammal brain coexisting in my own cognition.

We, as Humans, seem so trivial to fool. This basic technology seems almost good enough’ at this stage. But my biggest roadblock with really enjoying the DK2 was the inability to afford a monster rig’ to power some of the higher end experiences with at least 75 FPS. My laptop is a gaming laptop with a Nvidia laptop GPU and was able to at least get around 80 FPS on virtual desktop, which was my primary enjoyment of Oculus. But the biggest contract to this experience would arrive about a month later in December…

I got the Gear VR and the Note 4. This experience was insanely better and far more polished than that of the DK2. But this was mostly Samsung’s doing in this case… Oculus is still building their backend for their store/more official offering for the Oculus Rift and Gear VR. This is evidenced by the lack of a payment platform for the Oculus store. But Gear VR is still a beta’ product, more or less, it isn’t really meant to be considered a real’ consumer release. Even though it was a consumer release. The Gear VR managed to be fairly impressive, even compared to the DK2 that has a lot more GPU muscle and power behind it compared to the Note 4…

With all that being the case, it is my hope to start putting up more virtual reality related content up and to begin to really focus on learning Android development with that leading into Gear VR development. I really want to continue to create artistic things but perhaps within the venue of virtual reality melded with real reality? A much bigger less explored playground is calling me…

virtual reality DK2 gearvr gear vr oculus oculus rift video writing Writing technology mobile gaming