Run Your Own Mirror Node with Google Cloud Storage (GCS)
Last updated
Last updated
A Google Cloud Platform account.
Basic understanding of Hedera Mirror Nodes.
Docker (>= v20.10.x)
installed and opened on your machine. Run docker -v
in your terminal to check the version you have installed.
Java (openjdk@17: Java version 17), Gradle (the latest version), and PostgreSQL (the latest version) are installed on your machine.
In this step, you will generate your Google Cloud Platform HMAC access keys. These keys are needed to authenticate requests between your machine and Google Cloud Storage. They are similar to a username and password. Follow these steps to retrieve your access key, secret, and project ID:
Create a new project and link your billing account.
From the left navigation bar, select Cloud Storage > Settings.
Click the Interoperability tab and scroll down to the User account HMAC section.
If you don't already have a default project set, set it now.
Click create keys to generate access keys for your account.
You should see the access key and secret columns populate on the access keys table.
You will use these keys to configure the application.yml
file in a later step.
Open your terminal and run the following commands to clone the hedera-mirror-node
repository then cd
into the hedera-mirror-node
folder:
The application.yml
file is the main configuration file for the Hedera Mirror Node. We'll update that file with your GCP keys and the Hedera Network you want to mirror.
Open the application.yml
file in the root directory with a text editor of your choice.
Find the following section and replace the placeholders with your actual GCP access key, secret key, project ID, and the network you want to mirror:
accessKey
Your access key from your GCP account
cloudProvider
GCP
secretKey
Your secret key from your GCP account
gcpProjectId
Your GCP project ID
network
Enter the network you would to run your mirror node for
Save the changes and close the file.
Now let's start the Hedera Mirror Node using Docker. Docker allows you to easily run applications in a self-contained environment called a container.
From the hedera-mirror-node
directory, run the following command:
This step shows you how to access the data that your Hedera Mirror Node is collecting. The mirror node stores its data in a PostgreSQL database, and you're using Docker to connect to that database. To access the mirror node data, we'll have to enter the hedera-mirror-node-db-1
container.
Open a new terminal and run the following command to view the list of containers:
Enter the following command to access the Docker container:
Enter the following command to access the database:
Enter the following command to view the complete list of database tables:
To exit the psql
console, run the quit command:
Lastly, run the following command to stop and remove the created containers: