DEV Community

Vasilis Aivalis
Vasilis Aivalis

Posted on

Run a full bitcoin node on Azure

In this post, we’ll walk you through the process of setting up and running a full Bitcoin node on Microsoft Azure. Whether you're a Bitcoin enthusiast, developer, or just curious about contributing to the network, deploying your own node helps strengthen the Bitcoin ecosystem while giving you full control over your transactions and data.

We’ll guide you through:

  • Deploying a virtual machine (VM) in Azure
  • Installing and configuring Bitcoin Core (bitcoind)
  • Optimizing storage and network settings
  • Modifying firewall rules to allow RPC communication

By the end, you’ll have a fully operational Bitcoin node running in the cloud, ready to validate transactions and support the decentralized network. Let’s get started!

1. Deploy a Virtual Machine (VM)

Go to Azure Portal
Click: Create a resource → Compute → Virtual Machine
Choose OS: Ubuntu 24.04 LTS x64 Gen2 (Recommended)
Choose Size: Select a VM with:
You can choose any type of machine you like. On the budget side a Standard_DS1_v1 with 1vCPU and 3.5GB RAM will do , but its recommended at least a Standard_D2s_v3 with 2vCPU's and 8GB RAM . Machines with more RAM would be able to sync much faster.
SSD storage, you will need At least 1TB, as the blockchain is growing
Standard, or Premium SSD will do the job.

Image description

Authentication Method:
Use SSH key (Recommended)

Networking:
Allow SSH (port 22)

Attach a Data Disk for Blockchain Storage:
Click Disks → Create and Attach a New Data Disk
Click Create and wait for deployment.

2. Connect to the VM via SSH

If you have chosen to use SSH Key as the authentication method, download the .pem file that contains the key pair information.

ssh -i C:\path\to\your-key.pem user@hostname

replace @hostname with the public IP address as given in the azure portal Virtual Machine Overview

If you are using windows and receiving errors of type "Permissions for .pem are too open." either move .pem file to your \users\youruser\Documents folder where the permissions are restricted or right-click the .pem file and navigate to the Security tab to Remove all inherited permissions, and add a Basic read-only permission only for your user.

3. Install Bitcoin Core

Step 1: Update and Install Dependencies

sudo apt update && sudo apt upgrade -y
sudo apt install -y software-properties-common curl jq
Enter fullscreen mode Exit fullscreen mode

Step 2: Download Bitcoin Core

curl -O https://bitcoincore.org/bin/bitcoin-core-26.0/bitcoin-26.0-x86_64-linux-gnu.tar.gz
Enter fullscreen mode Exit fullscreen mode

Step 3: Extract and Install

tar -xvf bitcoin-26.0-x86_64-linux-gnu.tar.gz
sudo install -m 0755 -o root -g root -t /usr/local/bin bitcoin-26.0/bin/*

Enter fullscreen mode Exit fullscreen mode

4. Create and configure data directory

Once the disk is attached, you need to initialize, partition, and format it.

  1. List the available disks: lsblk and look for the new disk for example /dev/sdc
  2. Create a partition sudo fdisk /dev/sdc
    • Press n (new partition).
    • Press p (primary partition).
    • Accept defaults.
    • Press w to write changes.
  3. Format the partition: sudo mkfs.ext4 /dev/sdc1
  4. Create a mount directory: sudo mkdir /mnt/datadisk
  5. Mount the disk: sudo mount /dev/sdc1 /mnt/datadisk
  6. Create a folder in /mnt/datadisk mkdir /mnt/datadisk/bitcoin

5. Configure Bitcoin Node

Modify the bitcoind configuration file :
nano ~/bitcoin-26.0/bitcoin.conf

server=1
daemon=1
txindex=1
rpcuser=myusername
rpcpassword=mysupersecurepwd
rpcbind=0.0.0.0
rpcallowip=0.0.0.0/0
prune=0
datadir=/mnt/datadisk/bitcoin
rpcport=8332
listen=1
externalip=40.113.xx.xx
Enter fullscreen mode Exit fullscreen mode

save and exit.

ExternalIP is the same that you have used to connect via SSH, (the public IP address of the VM).
you may set rpcbindallowip to 0.0.0.0/0 to allow everybody to connect via RPC to this node, or whitelist your IP address only.

6. Start the bitcoin deamon

bitcoind -daemon -conf=~/bitcoin-26.0/bitcoin.conf

you may verify a successful start by using the command :
bitcoin-cli -conf=~/bitcoin-26.0/bitcoin.conf getblockchaininfo

or also by checking the bitcoin daemon running in the process list :
ps -aux |grep -i bitcoind

checking the disk usage the datadisk folder size should be increasing
du -h /mnt/datadisk/bitcoin/

Image description

7. Open Firewall for Public P2P Connections

sudo ufw allow 8332/tcp
sudo ufw allow 8333/tcp
sudo systemctl restart ufw
Enter fullscreen mode Exit fullscreen mode

We must also allow the ports through azure firewall. so back in the azure portal, inside the Virtual Machine -> Network Settings we configure the following inbound port rules:

Image description

8. Testing the rpc communication

Create a powershell script :

$headers = @{"Content-Type" = "application/json"}
$rpcUser = "myusername"
$rpcPassword = "mysupersecurepwd"
$uri = "http://40.113.xx.xx:8332/"
$body = '{"jsonrpc":"1.0","id":"curl","method":"getblockchaininfo","params":[]}'

Invoke-WebRequest -Uri $uri -Method Post -Headers $headers -Body $body -Credential (New-Object PSCredential $rpcUser, (ConvertTo-SecureString $rpcPassword -AsPlainText -Force))

Enter fullscreen mode Exit fullscreen mode

by running it you should be able to get a success response.

Image description

Top comments (0)