Set up Bitcoin Lightning Server on Google Cloud (GUIDE)

Li Labas
Coinmonks
5 min readJun 28, 2018

--

Lightning Network is one of the biggest scaling solutions to ever hit bitcoin network, as it finally makes it usable as an everyday currency and not just a store of value. Even though it’s still in its infancy, it works amazing an lightning fast, pun intended.

There are many guides on setting up your lightning network on your home computer or a Raspberry Pi, but if you want to set up a really reliable and scalable server that you would maybe want to use for your business in the future, then read on. I chose Google Cloud Services because they offer you a $300 gift bonus, which should actually be enough for your server to run for FREE for more than half a year! Enough time to really make something useful!

This guide will walk you through setting up your Bitcoin full node, Lightning network node, and a MEAN stack server to interact securely with your node.

Create your Google Cloud Services Account & launch a server

Just go to Google Cloud Services (GCS) and create a free trial account, which will grant you a $300 bonus. Yes, you have to put in your credit card, but you can cancel the subscription before you run out of the bonus. You can run a pretty powerful server for under $50, which means you can run it for free for more than half a year!

Once you’ve set up your account go ahead and create a new project. On the upper left side, you will see the Navigation menu, click on Cloud Launcher in the PRODUCTS section. In the search bar type “MEAN” and then choose “MEAN Certified by Bitnami”.

Here are the settings that worked best for me:

MEAN server settings

Click Deploy button on the bottom of the page and wait a few minutes…

Once your server is deployed type “External IP addresses” in the GC search bar and set up a static IP address, so you won’t be given a new IP every time your server restarts.

Next thing you want to do is open port 9735 in your firewall settings because this port is used by Lightning network nodes. If you leave this port closed, other nodes won’t be able to open a channel or connect to your node.

Notice, your node will still be able to connect to others if you leave it closed!

In your GC console go to “VPC network” and choose “Firewall rules”, click “CREATE FIREWALL RULE” and use the following settings:

Firewall rule

Click “Create” on the bottom of the page and your rule will be created.

Now go to Navigation menu on the left and click “Compute engine” under the “COMPUTE” section. Click on your server name and then click “EDIT” on top of the page.

In the “Network tags” section add the tag of the firewall rule you’ve created before:

Add a firewall rule to the server

I would also highly recommend that you set up SSH keys so you can securely connect to your server!

Follow this link on setting up SSH with Bitnami

Important! Set your SSH user as “bitnami”

Click “Save” on the bottom of the page, and your server should now be ready for the fun stuff!

Configuring your MEAN Lightning server

Open your Terminal and SSH into your newly deployed server

I have posted an All-In-One install script to GitHub, so this is pretty straightforward:

  1. Go to your home folder:

2. Run the following commands:

3. Edit the config file. The most important settings are:

You will find the right IP values if you go to the Navigation menu on the left and click “Compute engine” under the “COMPUTE” section. There you will see your “Internal IP” and your “External IP”, which you should copy to your config file.

4. Install by running:

4. Wait a couple of minutes for the installation to complete.

Now you wait even more!

It takes about 12+ hours for bitcoin blockchain to fully sync.

You can check the progress with:

When you see “progress=1.000” your node is fully synced.

Final step:

Run the following commands, replacing <mySecretToken> with your token:

It also good to have those programs to run on system reboot, just type:

Add this lines to the end of the file:

All done!

You can test your node by running:

Check the c-lightning and lightning-charge on GitHub for usage instructions!

To sum up:

Hope you enjoyed reading this guide. I tried to make it as simple as possible and the install script is something that has been asked for a while now and it’s a real time saver. Hope it was helpful for your project!

Now let the light in!

P.s. If you got your node working successfully, feel free to send me a lightning tip here! Thank you!

EDIT:

Some users are have experienced a few issues with setting up their server, that’s why I created a dedicated Telegram group where we can chat!

Anybody can join here!

--

--