Skip to main content [aditude-amp id="stickyleaderboard" targeting='{"env":"staging","page_type":"article","post_id":2172656,"post_type":"story","post_chan":"none","tags":null,"ai":false,"category":"none","all_categories":"cloud,commerce,dev,","session":"A"}']

How to run a bitcoin full node on Google Cloud

Visualization of nodes in the bitcoin network

Visualization of nodes in the bitcoin network. Currently around 10,000 nodes are online.

Image Credit: Bitnodes

By running a fully validating bitcoin node you’re helping secure the bitcoin network by verifying transactions. You are also helping other new nodes sync to the network. You are not mining bitcoin. And although you can argue that running a full node in the cloud centralizes bitcoin and limits your privacy, it’s an easy option for those who don’t have an “always on” computer at home, or bandwidth to contribute to the network.

Sign up for a free trial on Google Cloud

If you haven’t already signed up, Google Cloud offers a $300 credit for 365 days: https://console.cloud.google.com/freetrial. You will need to enter your credit card information, however you can still run your bitcoin node for free for several months.

[aditude-amp id="flyingcarpet" targeting='{"env":"staging","page_type":"article","post_id":2172656,"post_type":"story","post_chan":"none","tags":null,"ai":false,"category":"none","all_categories":"cloud,commerce,dev,","session":"A"}']

Create a VM Instance

Before launching a VM instance, you’ll have to create a new project in the dashboard first. Next, enable the Compute Engine API in the Google API Console. Go to the VM Instances tab under Compute Engine, and click Create Instance.

Configuring the VM

For machine type, 1 vCPU and 3.75 GB memory should be sufficient. For the boot disk I chose Ubuntu 16.04 as the OS, and changed the size to 200 GB (at the time of writing blockchain size is 156GB).

AI Weekly

The must-read newsletter for AI and Big Data industry written by Khari Johnson, Kyle Wiggers, and Seth Colaner.

Included with VentureBeat Insider and VentureBeat VIP memberships.

Configuring firewall rules

You will need to add a firewall rule for tcp ports 8332 and 8333. Port 8333 is used to communicate with other nodes via the bitcoin protocol, and port 8332 is used for JSON-RPC communications. To do this in Gcloud, click on your instance to see the details, and under Network Interfaces click on default under Network. Under firewall rules, click Add firewall rule. For targets – I applied to all instances in the network; for source ip ranges – 0.0.0.0/0; for protocols and ports – tcp:8332;tcp:8333.

Install Bitcoin Core

Go back to your instance and SSH into the VM, then follow installation instructions for Linux from bitcoin core. You will have to go with the bitcoind option. After you run bitcoind -daemon, the daemon will start downloading the blockchain. This can take a while, but you can check progress by seeing how many blocks have been downloaded with bitcoin-cli getblockcount. To see how big the blockchain is, check https://blockchain.info/q/getblockcount. The sync took about 6 days. In hindsight I should’ve beefed up my VM CPU for a faster sync, and then downgraded after the blockchain was downloaded. Oh well.

Test inbound connections to your bitcoin node to make sure other nodes on the bitcoin network can connect to it. Just enter the external ip of your vm instance, and click Check Node. If you see a green bar, you’re accepting inbound connections. Nice! You can also run bitcoin-cli getnetworkinfo in the VM to see how many total connections your node has.

You can also configure your node in different ways, perhaps to save bandwidth or set up an API to talk to it. For more on running full nodes and configuring them read this piece by Jameson Lopp – Securing Your Financial Sovereignty.

[aditude-amp id="medium1" targeting='{"env":"staging","page_type":"article","post_id":2172656,"post_type":"story","post_chan":"none","tags":null,"ai":false,"category":"none","all_categories":"cloud,commerce,dev,","session":"A"}']

VentureBeat's mission is to be a digital town square for technical decision-makers to gain knowledge about transformative enterprise technology and transact. Learn More