hashgraph / hedera-mirror-node

Hedera Mirror Node archives data from consensus nodes and serves it via an API
Apache License 2.0
122 stars 108 forks source link

Struggling to run rosetta #9015

Open jbaldwinroberts opened 1 month ago

jbaldwinroberts commented 1 month ago

Description

I cloned the repo, updated the application.yml file and then ran docker compose up.

My application.yml file contains:

hedera:
  mirror:
    importer:
      downloader:
        accessKey: ABC123
        cloudProvider: "s3"
        secretKey: ABC123
      network: testnet
      startDate: 2024-08-13T18:00:00Z
    monitor:
      network: testnet
    rosetta:
      network: testnet
    web3:
      evm:
        network: testnet
    rest:
      stateproof:
        streams:
          network: testnet

I think the importer is up to date as the logs show 2024-08-13T18:18:05.388Z INFO scheduling-6 c.h.m.i.d.r.RecordFileDownloader No new signature files to download after file: 2024-08-13T18_18_00.716505053Z.rcd.gz. Retrying in 0.5 s

but running ./hedera-mirror-node/hedera-mirror-rosetta/scripts/wait-for-mirror-node.sh results in a time out.

The rosetta logs show:

❯ docker compose logs -f rosetta
hedera-mirror-node-rosetta-1  | time="2024-08-13T18:02:58Z" level=info msg="External configuration file not found"
hedera-mirror-node-rosetta-1  | time="2024-08-13T18:02:58Z" level=info msg="Using configuration: &{Cache:map[entity:{MaxSize:524288}] Db:{Host:db Name:mirror_node Password: Pool:{MaxIdleConnections:20 MaxLifetime:30 MaxOpenConnections:100} Port:5432 StatementTimeout:20 Username:mirror_rosetta} Feature:{SubNetworkIdentifier:false} Http:{IdleTimeout:10s ReadTimeout:5s ReadHeaderTimeout:3s WriteTimeout:10s} Log:{Level:info} Network:demo NodeRefreshInterval:24h0m0s NodeVersion:0 Nodes:map[] Online:true Port:5700 Realm:0 Response:{MaxTransactionsInBlock:6000} Shard:0 ShutdownTimeout:10s}"
hedera-mirror-node-rosetta-1  | time="2024-08-13T18:02:58Z" level=info msg="hedera-mirror-rosetta version 0.112.0-SNAPSHOT, rosetta api version 1.4.12"
hedera-mirror-node-rosetta-1  | time="2024-08-13T18:02:59Z" level=error msg="failed to initialize database, got error [failed to connect to `host=db user=mirror_rosetta database=mirror_node`: dial error (dial tcp 172.24.0.8:5432: connect: connection refused)]"
hedera-mirror-node-rosetta-1  | time="2024-08-13T18:02:59Z" level=warning msg="failed to connect to `host=db user=mirror_rosetta database=mirror_node`: dial error (dial tcp 172.24.0.8:5432: connect: connection refused)"
hedera-mirror-node-rosetta-1  | time="2024-08-13T18:02:59Z" level=info msg="Use testnet instead of demo"
hedera-mirror-node-rosetta-1  | time="2024-08-13T18:03:00Z" level=info msg="Serving Rosetta API in ONLINE mode"
hedera-mirror-node-rosetta-1  | time="2024-08-13T18:03:00Z" level=info msg="Listening on port 5700"
hedera-mirror-node-rosetta-1  | time="2024-08-13T18:03:20Z" level=info msg="172.24.0.1 POST /network/list (200) in 4.353583ms"
hedera-mirror-node-rosetta-1  | time="2024-08-13T18:03:20Z" level=info msg="172.24.0.1 POST /network/status (500) in 63.907042ms"
hedera-mirror-node-rosetta-1  | time="2024-08-13T18:03:25Z" level=info msg="172.24.0.1 POST /network/status (500) in 4.488792ms"

what am i doing wrong?

Steps to reproduce

Clone the repo, update the application.yml file and then run docker compose up.

Additional context

No response

Hedera network

testnet

Version

main

Operating system

macOS

steven-sheehy commented 1 month ago

Not sure. It can't connect to the db from the rosetta container. Try to connect via psql using the same db/user/pass/host/port that rosetta is using. Verify the mirror_rosetta user exists in the db and has the appropriate roles and permissions.

The bigger question is why are you trying to use the rosetta module? It's intended for use only by Coinbase.

jbaldwinroberts commented 1 month ago

Thanks for the reply, i'll try those suggestions.

I work for a crypto custody provider and we we generally use either JSON-RPC or the rosetta/mesh api to integrate new chains. I've been having issues with getting JSON-RPC to work so this was my next port of call.

I'd prefer not to effectively roll our own integration through using a combination of hedera-sdk-go and the REST API.

I'm very open to suggestions/pointers if there is a better way, we need to be able to retrieve accounts/transactions/blocks.

jbaldwinroberts commented 1 month ago

I managed to get it to connect to the DB:

❯ docker compose logs -f rosetta
hedera-mirror-node-rosetta-1  | time="2024-08-13T18:43:38Z" level=info msg="External configuration file not found"
hedera-mirror-node-rosetta-1  | time="2024-08-13T18:43:38Z" level=info msg="Loaded external config file: /src/hedera-mirror-rosetta/application.yml"
hedera-mirror-node-rosetta-1  | time="2024-08-13T18:43:38Z" level=info msg="Using configuration: &{Cache:map[entity:{MaxSize:524288}] Db:{Host:db Name:mirror_node Password: Pool:{MaxIdleConnections:20 MaxLifetime:30 MaxOpenConnections:100} Port:5432 StatementTimeout:20 Username:mirror_rosetta} Feature:{SubNetworkIdentifier:false} Http:{IdleTimeout:10s ReadTimeout:5s ReadHeaderTimeout:3s WriteTimeout:10s} Log:{Level:info} Network:testnet NodeRefreshInterval:24h0m0s NodeVersion:0 Nodes:map[] Online:true Port:5700 Realm:0 Response:{MaxTransactionsInBlock:6000} Shard:0 ShutdownTimeout:10s}"
hedera-mirror-node-rosetta-1  | time="2024-08-13T18:43:38Z" level=info msg="hedera-mirror-rosetta version 0.112.0-SNAPSHOT, rosetta api version 1.4.12"
hedera-mirror-node-rosetta-1  | time="2024-08-13T18:43:39Z" level=info msg="Successfully connected to database"
hedera-mirror-node-rosetta-1  | time="2024-08-13T18:43:39Z" level=info msg="Serving Rosetta API in ONLINE mode"
hedera-mirror-node-rosetta-1  | time="2024-08-13T18:43:39Z" level=info msg="Listening on port 5700"

by setting HEDERA_MIRROR_ROSETTA_API_CONFIG: /src/hedera-mirror-rosetta/application.yml in the docker-compose file.

However, making a request results in `time="2024-08-13T18:44:58Z" level=info msg="172.26.0.1 POST /network/list (500) in 254.291µs"

xin-hedera commented 1 month ago

which network was your mirrornode set for? from when it's configured to ingest data? The issue might be, for rosetta to work, in general, the mirrornode needs to ingest blocks from genesis.