How can you tell if a solana node is synced?

1.6k views Asked by At

I'm running a solana node using the solana-validator command (see Solana docs).

And I'd like to know if my validator is ready to connect to the http/rpc/ws port. What's the quickest way to do check to see if it's synced?

Currently, I'm using wscat to check to see if I can connect to the websocket, but am unable to. I'm not sure if that's because the node isn't setup right, or it's not synced, etc.

I know if I run solana gossip I should be able to see my IP in the list that populates... but is that the best way?

2

There are 2 answers

0
Patrick Collins On BEST ANSWER

Run a curl command against your node for block height:

curl http://<IP>:<PORT> -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1, "method":"getBlockHeight"}'

And you'll get an output like:

{"jsonrpc":"2.0","result":105334870,"id":1}

Compare this to some other node, like a block explorer, and see if you're up to speed.

2
Jon C On

Take a look at solana catchup, which does exactly what you're asking for: https://docs.solana.com/cli/usage#solana-catchup