Comment on page
Run Your Own Mirror Node with Google Cloud Storage (GCS)
- Basic understanding of Hedera Mirror Nodes.
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:
- 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.ymlfile in a later step.
git clone https://github.com/hashgraph/hedera-mirror-node
application.ymlfile 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.ymlfile 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: ENTER ACCESS KEY HERE
secretKey: ENTER SECRET KEY HERE
gcpProjectId: ENTER GCP PROJECT ID HERE
network: PREVIEWNET/TESTNET/MAINNET #Pick one network
- 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-nodedirectory, run the following command:
docker compose up -d db && docker logs hedera-mirror-node-db-1 --follow
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
- Open a new terminal and run the following command to view the list of containers:
- Enter the following command to access the Docker container:
docker exec -it hedera-mirror-node-db-1 bash
- Enter the following command to access the database:
psql "dbname=mirror_node host=localhost user=mirror_node password=mirror_node_pass port=5432"
- Enter the following command to view the complete list of database tables:
- To exit the
psqlconsole, run the quit command:
- Lastly, run the following command to stop and remove the created containers:
docker compose down