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)
  • Redis (used for caching)
  • Docker (>= v20.10.x) installed on your machine.
  • An Amazon Web Services account/Google Cloud Platform account.
Terminal window
sudo apt update
sudo apt install build-essential gcc g++ redis

Open your terminal and run the following commands

Terminal window
git clone https://github.com/hiero-ledger/hiero-mirror-node
cd hiero-mirror-node

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.

For more information about the configuration for the Cloud related credentials, please refer to this documentation for AWS and for GCS.

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
network: PREVIEWNET/TESTNET/MAINNET #Pick one network
Terminal window
docker compose up -d

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/hiero-ledger/hiero-json-rpc-relay.git
cd hiero-json-rpc-relay
git checkout tags/v0.68.0 # Or any other specific tag
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. Official 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_KEY_FORMAT=<The key format of OPERATOR_KEY_MAIN, for example Metamask wallet key format is `HEX_ECDSA`>
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
sudo nano /etc/systemd/system/hiero-json-rpc.service
Terminal window
[Unit]
Description=Hiero JSON-RPC Relayer
After=network.target
[Service]
Type=simple
# Change with the correct user
User=ubuntu
# Change with the correct working directory
WorkingDirectory=/home/ubuntu/hiero-json-rpc-relay
# Update NVM_DIR with the correct value
Environment=NODE_ENV=production NVM_DIR=/home/ubuntu/.nvm
ExecStart=/bin/bash -c 'source $NVM_DIR/nvm.sh && npm run start'
Restart=on-failure
[Install]
WantedBy=multi-user.target
Terminal window
sudo systemctl enable hiero-json-rpc
sudo systemctl start hiero-json-rpc

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: https://testnet.mirrornode.hedera.com/api/v1/ and Web3 url: https://testnet.mirrornode.hedera.com/api/v1/
[2024-10-03 16:49:33.512 +0000] INFO (relay/145017 on xxxxx): Relay running with chainId=0x128

You can also testout the endpoint with sending a curl:

Terminal window
curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":"2","method":"eth_blockNumber","params":[null]}' http://127.0.0.1:7546
> {"result":"0x7c568e","jsonrpc":"2.0","id":"2"}

Once your node is up and running, you need to add the Hedera chain to your ampd daemon’s config.tomlfile. This can be done by adding in the following configuration:

This can be done as follows for Hedera Testnet:

[[handlers]]
type="MultisigSigner"
chain_name="hedera"
cosmwasm_contract="axelar14a4ar5jh7ue4wg28jwsspf23r8k68j7g5d6d3fsttrhp42ajn4xq6zayy5"
[[handlers]]
type= "EvmMsgVerifier"
cosmwasm_contract= "axelar1q8q8qq59yv9wmhcreu5ykt4azsk83ttve4e7jyavt32k6jq862xsqexnfh"
chain_name= "hedera"
chain_rpc_url= "your_own_rpc"
chain_finalization= "RPCFinalizedBlock"
[[handlers]]
type= "EvmVerifierSetVerifier"
cosmwasm_contract= "axelar1q8q8qq59yv9wmhcreu5ykt4azsk83ttve4e7jyavt32k6jq862xsqexnfh"
chain_name= "hedera"
chain_rpc_url= "your_own_rpc"
chain_finalization= "RPCFinalizedBlock"
[[handlers]]
type="MultisigSigner"
chain_name="hedera"
cosmwasm_contract="axelar14a4ar5jh7ue4wg28jwsspf23r8k68j7g5d6d3fsttrhp42ajn4xq6zayy5"
[[handlers]]
type= "EvmMsgVerifier"
cosmwasm_contract= "axelar1ce9rcvw8htpwukc048z9kqmyk5zz52d5a7zqn9xlq2pg0mxul9mqxlx2cq"
chain_name= "hedera"
chain_rpc_url= "your_own_rpc"
chain_finalization= "RPCFinalizedBlock"
[[handlers]]
type= "EvmVerifierSetVerifier"
cosmwasm_contract= "axelar1ce9rcvw8htpwukc048z9kqmyk5zz52d5a7zqn9xlq2pg0mxul9mqxlx2cq"
chain_name= "hedera"
chain_rpc_url= "your_own_rpc"
chain_finalization= "RPCFinalizedBlock"

For your node to be recognized by the Axelar network, you need to register your chain with the ampd daemon. This can be done by running:

Terminal window
ampd register-chain-support amplifier hedera

Edit on GitHub