Hedera

Instructions to set up your Hedera mirror node and RPC-relay.

  • Setup your Axelar verifier
  • Minimum hardware requirements: CPUs: 4 cores RAM: 16 GB Storage (SSD): 500 GB
  • Ubuntu 20.04 LTS or later
  • NPM (installing via nvm is recommended)
  • Docker (>= v20.10.x) installed on your machine.
  • An Amazon Web Services account/Google Cloud Platform account.
Terminal window
sudo apt install build-essential gcc g++

Open your terminal and run the following commands

Terminal window
git clone https://github.com/hashgraph/hedera-mirror-node
cd hedera-mirror-node

Before starting your verifier, ensure you have the historical database dump in place. Without it, your verifier will not have the full historical state, causing it to vote “no” on proposals. Follow Hedera’s official Database Bootstrap Guide to properly import the Mirror Node historical data before running the verifier. Verifiers must have this data bootrapped to vote correctly.

Important Note for Deployment: It is recommended to first test your mirror node configuration on testnet:

  1. Set the startDate to match your contract deployment date
  2. Allow the node to sync from that date
  3. Verify that all data is being captured correctly
  4. Make any necessary configuration adjustments
  5. Once everything is working as expected on testnet, apply the same configuration to mainnet

This approach allows you to validate your setup and fine-tune any parameters before moving to production.

The application.yml file is the main configuration file for the Hedera Mirror Node. We’ll update that file with GCP/AWS Secret and Access keys and the type of Hedera Network we want to mirror.

hedera:
mirror:
importer:
downloader:
accessKey: Enter access key from your GCP/AWS account
cloudProvider: "GCP/s3" #Choose GCP for google or s3 for AWS
secretKey: Enter secret key from your GCP/AWS account
gcpProjectId: ENTER GCP PROJECT ID HERE / N/A for AWS
startDate: 1970-01-01T00:00:00Z
network: testnet
parser:
# Exclude specific transaction types
exclude:
# Exclude all consensus messages to reduce storage
- transaction: [CONSENSUSSUBMITMESSAGE]
# Exclude treasury account
- entity: [0.0.98]
record:
entity:
persist:
# Disable topic message storage
topics: false
# Disable topic message lookups
topicMessageLookups: false
Terminal window
docker compose up

Logs should appear like this

Terminal window
importer-1 | 2024-09-05T14:10:43.832Z INFO pool-8-thread-2 c.h.m.i.p.b.BatchInserter Copied 1 rows to transaction table in 388.7 μs
importer-1 | 2024-09-05T14:10:43.833Z INFO pool-8-thread-2 c.h.m.i.p.r.e.s.SqlEntityListener Completed batch inserts in 11.59 ms
importer-1 | 2024-09-05T14:10:43.833Z INFO pool-8-thread-2 c.h.m.i.p.r.RecordFileParser Successfully processed 1 items from 2019-10-11T16_39_21.323930Z.rcd in 11.69 ms
importer-1 | 2024-09-05T14:10:43.948Z INFO pool-8-thread-2 c.h.m.i.p.b.BatchInserter Copied 7 rows to crypto_transfer table in 664.4 μs
importer-1 | 2024-09-05T14:10:43.957Z INFO pool-8-thread-2 c.h.m.i.p.b.BatchInserter Copied 3 rows to entity_temp table in 8.886 ms
importer-1 | 2024-09-05T14:10:43.958Z INFO pool-8-thread-2 c.h.m.i.p.b.BatchInserter Copied 1 rows to record_file table in 483.7 μs
importer-1 | 2024-09-05T14:10:43.958Z INFO pool-8-thread-2 c.h.m.i.p.b.TransactionHashBatchInserter Copied 1 rows from 1 shards to transaction_hash table in 653.0 μs
importer-1 | 2024-09-05T14:10:43.959Z INFO pool-8-thread-2 c.h.m.i.p.b.BatchInserter Copied 1 rows to transaction table in 486.9 μs
importer-1 | 2024-09-05T14:10:43.959Z INFO pool-8-thread-2 c.h.m.i.p.r.e.s.SqlEntityListener Completed batch inserts in 11.39 ms
importer-1 | 2024-09-05T14:10:43.959Z INFO pool-8-thread-2 c.h.m.i.p.r.RecordFileParser Successfully processed 1 items from 2019-10-11T16_39_31.290027001Z.rcd in 11.50 ms
importer-1 | 2024-09-05T14:10:44.539Z INFO scheduling-4 c.h.m.i.d.r.RecordFileDownloader No new signature files to download after file: 2019-10-11T16_39_31.290027001Z.rcd. Retrying in 0.5 s
Terminal window
curl http://localhost:5551/api/v1/transactions?limit=1

You’ll need to setup a JSON-RPC relay to let ampd intract with your Hedera node. Follow the setup instructions:

Open your terminal and run the following commands

Terminal window
git clone https://github.com/hashgraph/hedera-json-rpc-relay.git
cd hedera-json-rpc-relay
Terminal window
npm install
npm run build
Terminal window
CHAIN_ID= The network chain id. Local and previewnet envs should use 0x12a (298). Previewnet, Testnet and Mainnet should use 0x129 (297), 0x128 (296) and 0x127 (295) respectively
MIRROR_NODE_URL= The Mirror Node API endpoint so wherever you deployed your mirror node (i.e http://localhost:5551). Public endpoints are Previewnet (https://previewnet.mirrornode.hedera.com), Testnet (https://testnet.mirrornode.hedera.com), Mainnet (https://mainnet-public.mirrornode.hedera.com).
HEDERA_NETWORK= Which network to connect to. Can be MAINNET, PREVIEWNET, TESTNET or OTHER
OPERATOR_ID_MAIN=<AccountID e.g. 0.1.2, can be obtained from portal.hedera.com, wallet or exchange of choice>
OPERATOR_KEY_MAIN=<DER Encoded Private Key, can be obtained from portal.hedera.com, wallet or exchange of choice>
Terminal window
nano /etc/systemd/system/hedera-json-rpc.service
Terminal window
[Unit]
Description=Hedera JSON-RPC Relayer
After=network.target
[Service]
Type=simple
User=$USER
WorkingDirectory=/path/to/hedera-json-rpc-relayer
Environment=NODE_ENV=production NVM_DIR=/root/.nvm
ExecStart=/bin/bash -c 'source $NVM_DIR/nvm.sh && npm run start'
Restart=on-failure
[Install]
WantedBy=multi-user.target

Logs should appear like this

Terminal window
[2024-10-03 16:49:33.460 +0000] INFO (relay/145017 on xxxxx): Configurations successfully loaded
[2024-10-03 16:49:33.461 +0000] TRACE (hbar-rate-limit/145017 on xxxxx): remainingBudget=11000000000 tℏ, resetTimestamp=1727974253461
[2024-10-03 16:49:33.508 +0000] INFO (relay/145017 on xxxxx): SDK client successfully configured to "testnet" for account 0.0.12345 with request timeout value: 10000
[2024-10-03 16:49:33.511 +0000] INFO (mirror-node/145017 on xxxxx): Mirror Node client successfully configured to REST url: http://localhost:5551/api/v1/ and Web3 url: http://localhost:5551/api/v1/
[2024-10-03 16:49:33.512 +0000] INFO (relay/145017 on xxxxx): Relay running with chainId=0x128

Edit on GitHub