Are you a believer in Bitcoin? If you have a stake in the cryptocurrency, one way to support your investment is to run a fully-validating Bitcoin node. Doing so will help secure the Bitcoin network by verifying transactions and blocks — thus keeping miners honest — and also helping other new nodes sync to the network, making it more robust. One way you can run a full node is to leverage a cloud computing service such as Google Cloud.
To be clear, running a Bitcoin full node is not the same as mining Bitcoin. If you are a merchant running a Bitcoin business or just accepting Bitcoin payments, you should absolutely be running your own node to validate your transactions, instead of trusting a third party. Some critics argue that running a full node in the cloud centralizes Bitcoin and limits your privacy, but it’s an easy alternative for those who don’t have an “always on” computer at home, or bandwidth to contribute to the network.
This guide walks you through the steps required to get started.
Sign up for a free Google Cloud trial
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, but you should still be able to run your Bitcoin node for free for several months.
Create a VM Instance
Before launching a VM instance, you’ll have to create a new project in the dashboard. 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.75GB of memory should be sufficient. This configuration will take about six days to sync the blockchain. If you want a faster sync, beef up your VM — just remember to downgrade after the sync. For the boot disk, I chose Ubuntu 16.04 as the OS, and changed the size to 200GB (at the time of publishing, Bitcoin’s blockchain size was about 156GB).
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 Google Cloud, 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 –
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 whole syncing process took about six days for me.
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 Securing Your Financial Sovereignty by Jameson Lopp.