Run Your Own Goerli Ethereum Testnet Faucet
Updated: Oct 2, 2021

This tutorial will set up a Goerli Ethereum Testnet Faucet on an Ubuntu virtual private server (VPS). This implementation will mirror the appearance of faucet.geekbyte.com. You can host the faucet on a small, low-performance server.
Virtual Private Server Recommendations
A VPS with the following specifications should be sufficient:
Virtual CPUs: 1 Core
Memory Size: 0.5 GB
Disk Space: 10 GB
Bandwidth: 0.5 TB
Virtual CPUs: 1 Core
Memory Size: 0.5 GB
Disk Space: 10 GB
Bandwidth: Unlimited @ 400mbps
Price: $2.00 USD Monthly
Virtual CPUs: 1 Core
Memory Size: 0.5 GB
Disk Space: 10 GB
Bandwidth: 0.5 TB
Price: $2.50 USD Monthly
Virtual CPUs: 1 Core
Memory Size: 1 GB
Disk Space: 15 GB
Bandwidth: 1TB @ 1000mbps
Price: $3.20 USD Monthly
Virtual CPUs: 4 Cores
Memory Size: 6 GB
Disk Space: 80 GB
Bandwidth: Unlimited @ 100mbps
Price: $7.00 USD Monthly
Virtual CPUs: 4 Cores
Memory Size: 4 GB
Disk Space: 200 GB
Bandwidth: Unlimited @ 100mbps
Price: $48USD Annually
Prerequisites
You should complete the following guides to secure your server.
IMPORTANT: DO NOT COMPLETE STEPS 2, 3 & 4 FROM THE BELOW GUIDE. WE WILL BE BUILDING OUR FAUCET WITH THE ROOT ACCOUNT
YOU MAY COMPLETE THIS GUIDE IN ITS ENTIRETY
Create a reCAPTCHA v2 (v3 does not work for this project) and save the site and secret key later in this guide.
Make sure you enter your IP address of the faucet server under Domains.

Updates
Depending on your VPS provider, the server could be ready instantly or take up to 24 hours.
Once the VPS has been created successfully, your provider will send you a confirmation email that contains the server IP address and password.
Establish an SSH connection with your server. Make sure your server is fully updated using the following command:
sudo apt update -y && sudo apt full-upgrade -y && sudo apt autoremove -y && sudo apt clean -y && sudo apt autoclean -y
This command will perform the following:
update - updates the list of packages but do not install
upgrade - install new versions of packages if new versions are available
full-upgrade - performs the function of an upgrade but will remove currently installed packages if this is needed to upgrade the system as a whole (fixing bad dependencies)
autoremove, autoclean and clean - clean old packages which are not needed anymore
option -y does not request permission on every step
&& states that it runs the next command if the previous was successfully executed
Building from source
First, let's take a clone of the GeekByte Goerli Faucet using the following command:
sudo git clone https://github.com/GeekByteGit/goerli-faucet.git
Modifying the config.json file
Change directory to goerli-faucet:
cd goerli-faucet
Now let's make a copy of the config.json.prod file so we can revert any mistakes:
cp config.json.prod config.json
Edit the new config.json file:
sudo nano config.json
Inside this file, we will modify several sections:
Change INSERT YOUR GOOGLE RECAPTCHA SECRET KEY HERE to your secret key created during the prerequisites.
Change INSERT YOUR GOERLI ETHEREUM ADDRESS HERE to your address that will be dispensing the Goerli Ethereum.
Change INSERT YOUR GOERLI ETHEREUM ADDRESS PRIVATE KEY HERE MINUS THE INITIAL 0x to your Goerli Ethereum private key minus the first to digits, 0x.
(Optional) You can change milliEtherToTransfer to increase or decrease the per transaction dispersal of Goerli. 1000 milliEther = 1 Goerli Eth.
(Optional) You can change gasLimit to increase the gwei cost per transaction. Minimum gasLimit= 21000.
Hit Ctrl+X, Y for Yes, and then Enter to confirm the File Name to Write (Save).
Modifying the public/index.html file
Modify the public/index.html file using nano:
sudo nano public/index.html
Scroll down and change INSERT YOUR GOOGLE DATA RECAPTCHA SITE KEY to your site key created during the prerequisites.
Hit Ctrl+X, Y for Yes, and then Enter to confirm the File Name to Write (Save).
Install the Node.js package manager
Run the following command to install npm:
sudo apt install npm
Hit Y to confirm the installation when prompted.
Build the faucet source code
Change directory to goerli-faucet if you're not already there:
cd goerli-faucet
Build the faucet source using the following command:
sudo npm install
You might see some failures, but the faucet should run fine.
Now we will fix any deprecated, failed, or insecure packages. Don't worry if all the vulnerabilities aren't patched, and don't use --force to fix them.
sudo npm audit fix
Let's open the default 5001 faucet port:
sudo ufw allow 5001
(Optional) You can change the default faucet port from the index.js file located at the root of goerli-faucet:
cd goerli-faucet
sudo nano index.js
Scroll down until you see port 5001. Modify this to your liking, e.g., 80 for external HTTP facing.
Start the faucet
Start your GeekByte Goerli Faucet using the following command (Use this command over and over to start your faucet after making any changes):
sudo npm start
Now open a web browser and in the URL field enter your faucet server IP:5001, e.g., similar to this example: 192.120.98.65:5001. You should now see the GeekByte Goerli Faucet!
(Optional) Currently, the faucet will only run if we have the SSH window open and actively running our node. If you wish to run the faucet as a background task so you can close your SSH terminal window, use the following commands:
cd goerli-faucet
Install the process manager:
sudo npm install pm2 -g
The log file generated by the process manager will grow indefinitely. To prevent that, we are going to install logrotate, which will neatly split up our log file into several log files (one for each day) and delete files that are older than 30 days. It can be installed with the following command:
sudo pm2 install pm2-logrotate
Run the process manager. You can change the word Faucet to whatever you would like the process to be called:
sudo pm2 --name Faucet start npm -- start
You can monitor this process using the following command:
sudo pm2 monit
You can now close your SSH terminal session and the Goerli faucet will remain running!
(Optional) Modifying the appearance of the faucet
You can modify the look of the GeekByte Goerli Faucet by modifying the following files:
This is the main configuration file for most appearance adjustments:
sudo nano public/index.html
To change the images you will need to use SFTP to replace them from here:
public/assets
To change the favicons you will need to use SFTP to replace them from here:
public/favicons
The background color is modified via:
sudo nano public/assets/stylesheets/index/faucet.scss
(Optional) Running your faucet with a domain and HTTPS SSL Let's Encrypt certificate
If you wish to publish your Goerli faucet to the world and maintain a secure connection with a certificate, please follow these steps:
Change directory to goerli-faucet if you're not already there:
cd goerli-faucet
Install the Let's Encrypt CertBot using the following command:
sudo certbot certonly --standalone
Enter your email when prompted to receive renewal and security notices.
Accept the Terms of Service.
Accept or deny sharing your email with the Electronic Frontier Foundation.
Enter the domain name you would like on your certificate, e.g., faucet.geekbyte.com
You will now see Successfully received certificate.
The certificates are saved at:

Change directory to goerli-faucet if you're not already there:
cd goerli-faucet
We will be modifying the index.js to use port 80 and include our new certificate:
sudo nano index.js
Scroll down until you see the following:
app.set('port', (process.env.PORT || 5001))
Change port 5001 to port 80 so it looks like the following:
app.set('port', (process.env.PORT || 80))
Scroll down to the very bottom and add a space after the final }). Now paste the following code:
// import required packages
const cors = require('cors');
const https = require('https');
const http = require('http');
// Listen both http & https ports
const httpServer = http.createServer(app);
const httpsServer = https.createServer({
key: fs.readFileSync('/etc/letsencrypt/live/faucet.geekbyte.com/privkey.pem'),
cert: fs.readFileSync('/etc/letsencrypt/live/faucet.geekbyte.com/fullchain.pem'),
}, app);
httpsServer.listen(443, () => {
console.log('HTTPS Server running on port 443');
});
Modify this pasted code by changing faucet.geekbyte.com to your domain name.
Hit Ctrl+X, Y for Yes, and then Enter to confirm the File Name to Write (Save).
Now let's open up port 80 (if it's not already):
sudo ufw allow 80
And secure HTTPS port 443:
sudo ufw allow 443
Start your GeekByte Goerli Faucet using the following command (If it's not already running from the optional background process manager):
pm2 --name Faucet start npm -- start
In this tutorial, you have learned how to install, modify, and build a GeekByte Goerli Faucet. Optionally, you have learned how to run the faucet as a background process and customize the appearance with your branding. Implementing a Goerli faucet opens up one more avenue for developers and amateurs to obtain the necessary coin for experimenting with the Ethereum ecosystem.
Feel free to comment below with any questions or comments.
If you found this article informative, please support my efforts by donating to my Ethereum ENS address: geekbyte.eth