# Check sync status of node

**URL:** <https://forum.cardano.org/t/check-sync-status-of-node/36500>\
**Category:** Operate a Stake Pool\
**Created:** [27 July 2020 18:03 UTC](https://forum.cardano.org/t/check-sync-status-of-node/36500 "2020-07-27T18:03:46Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![SirPickelhaupt](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/sirpickelhaupt/32/20180_2.png) [@SirPickelhaupt](https://forum.cardano.org/u/SirPickelhaupt)\
**Post date:** [27 July 2020 18:03 UTC](https://forum.cardano.org/t/check-sync-status-of-node/36500/1 "2020-07-27T18:03:46Z")

</div>

Hi,

Could anyone please explain me how to check the sync status of my node with the network?  
The following script used to work:

```auto
GENESIS=shelley-genesis.json
    start=$(jq -r '.systemStart' $GENESIS)
    start_sec=$(date -d $start +'%s')
    epoch_length=$(jq -r '.epochLength' $GENESIS)
    now=$(date +'%s')
    epoch=$(expr \( $now - $start_sec \) / $epoch_length)
    slot=$(expr \( $now - $start_sec \) % $epoch_length)
    unSlot=$(expr $epoch \* $epoch_length + $slot)
    currentUnSlot=$(cardano-cli shelley query tip ${NETWORK_ARGUMENT} | jq -r '.slotNo')
    echo "slot $currentUnSlot/$unSlot $(expr $currentUnSlot \* 100 / $unSlot)%"

```

but it does not seem to produce the correct result anymore.

---

<div class="post-metadata">

**Author:** ![SirPickelhaupt](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/sirpickelhaupt/32/20180_2.png) [@SirPickelhaupt](https://forum.cardano.org/u/SirPickelhaupt)\
**Post date:** [28 July 2020 08:20 UTC](https://forum.cardano.org/t/check-sync-status-of-node/36500/2 "2020-07-28T08:20:22Z")

</div>

No one can help with this?  
There must be some way to check if your node is completely up to date with the network, as its necessary for the node to be synced when getting the tip for defining the TTL for transactions, KES keys, etc. ?

---

<div class="post-metadata">

**Author:** ![glitch\_04](https://avatars.discourse-cdn.com/v4/letter/g/ad7895/32.png) [@glitch\_04](https://forum.cardano.org/u/glitch_04)\
**Post date:** [28 July 2020 08:30 UTC](https://forum.cardano.org/t/check-sync-status-of-node/36500/3 "2020-07-28T08:30:50Z")

</div>

cardano-cli shelley query tip --testnet-magic 42

will output the current tip info example

```auto
{
    "blockNo": 11188,
    "headerHash": "119f763db992b60bb53415e840ad08f1cd8f329add9d8c4f97e60ab709253350",
    "slotNo": 222400
}

```

sorry I don’t frequent the forums I have several other places I am watching like telegram reddit discord I would suggest joining the telegram channel we can usually help you more timely there

> **[Cardano Stake Pool Best Practice Workgroup](https://t.me/CardanoStakePoolWorkgroup)**
>
> Cardano Stake Pool Best Practice Workgroup

---

<div class="post-metadata">

**Author:** ![SirPickelhaupt](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/sirpickelhaupt/32/20180_2.png) [@SirPickelhaupt](https://forum.cardano.org/u/SirPickelhaupt)\
**Post date:** [28 July 2020 08:41 UTC](https://forum.cardano.org/t/check-sync-status-of-node/36500/4 "2020-07-28T08:41:58Z")

</div>

Thank you for your response glitch.  
But, I know that command, and it doesn’t give any info regarding the tip of the blockchain, only where my current node is at.

I need to know that my node is completely synced (my tip is the same as the tip of the blockchain) before using my tip to calculate the TTL, etc. right?

---

<div class="post-metadata">

**Author:** ![glitch\_04](https://avatars.discourse-cdn.com/v4/letter/g/ad7895/32.png) [@glitch\_04](https://forum.cardano.org/u/glitch_04)\
**Post date:** [28 July 2020 08:54 UTC](https://forum.cardano.org/t/check-sync-status-of-node/36500/5 "2020-07-28T08:54:21Z")

</div>

There are other sources to check against to get the current tip to compare such as pooltool or the grafana instances iohk has hosted or the explorer.  
The reason this script is likely broken is from the change over from Byron to Shelley with the use of both networks you need to check against the genesis info in the proper file which depends on the epoch you are in at the time.

> **[Cardano PoolTool](https://htn.pooltool.io/)**
>
> Cardano PoolTool - The most comprehensive staking statistics for Cardano on the web. Keep a favorites list, view competitive slots and analyze performance.

  
[https://monitoring.mainnet-candidate-4.dev.cardano.org/grafana/d/Oe0reiHef/cardano-application-metrics-v2?orgId=1&refresh=1m](https://monitoring.mainnet-candidate-4.dev.cardano.org/grafana/d/Oe0reiHef/cardano-application-metrics-v2?orgId=1&refresh=1m)  
[https://explorer.mainnet-candidate-4.dev.cardano.org/en](https://explorer.mainnet-candidate-4.dev.cardano.org/en)

---

<div class="post-metadata">

**Author:** ![SirPickelhaupt](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/sirpickelhaupt/32/20180_2.png) [@SirPickelhaupt](https://forum.cardano.org/u/SirPickelhaupt)\
**Post date:** [28 July 2020 08:59 UTC](https://forum.cardano.org/t/check-sync-status-of-node/36500/6 "2020-07-28T08:59:57Z")

</div>

Okay, thank you for that.  
It would be nice if it was possible to check directly from the node though.  
The following script used to work:

```auto
GENESIS=shelley-genesis.json
start=$(jq -r '.systemStart' $GENESIS)
start_sec=$(date -d $start +'%s')
epoch_length=$(jq -r '.epochLength' $GENESIS)
now=$(date +'%s')
epoch=$(expr \( $now - $start_sec \) / $epoch_length)
slot=$(expr \( $now - $start_sec \) % $epoch_length)
unSlot=$(expr $epoch \* $epoch_length + $slot)
currentUnSlot=$(cardano-cli shelley query tip ${NETWORK_ARGUMENT} | jq -r '.slotNo')
echo "slot $currentUnSlot/$unSlot $(expr $currentUnSlot \* 100 / $unSlot)%"

```

But now its stuck at 91% for the mainnet-candidate.

---

<div class="post-metadata">

**Author:** ![glitch\_04](https://avatars.discourse-cdn.com/v4/letter/g/ad7895/32.png) [@glitch\_04](https://forum.cardano.org/u/glitch_04)\
**Post date:** [28 July 2020 09:07 UTC](https://forum.cardano.org/t/check-sync-status-of-node/36500/7 "2020-07-28T09:07:53Z")

</div>

my assumption on this as I haven’t tried is that you would use the “shelley” side and calculate the approximate location based on the info inside that genesis file which has changed from the previous shelley chains for MC… if you need more support on this I would suggest going to the telegram channel

---

<div class="post-metadata">

**Author:** ![SirPickelhaupt](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/sirpickelhaupt/32/20180_2.png) [@SirPickelhaupt](https://forum.cardano.org/u/SirPickelhaupt)\
**Post date:** [28 July 2020 09:09 UTC](https://forum.cardano.org/t/check-sync-status-of-node/36500/8 "2020-07-28T09:09:10Z")

</div>

Okay, thank you.

---

<div class="post-metadata">

**Author:** ![Smaug](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/smaug/32/53604_2.png) [@Smaug](https://forum.cardano.org/u/Smaug)\
**Post date:** [28 July 2020 10:39 UTC](https://forum.cardano.org/t/check-sync-status-of-node/36500/9 "2020-07-28T10:39:53Z")

</div>

Hi,

It looks like the [script I posted](https://t.me/CardanoStakePoolWorkgroup/259075) a month ago in telegram workgroup channel.  
It was made for chains in Shelley mode only, as it ignores the Byron area.

Here is an updated version (in bash to be a slightly more legible) that should work with current mainnet candidate 4 and should hopefully work with mainnet once the `HARDFORK_EPOCH` and `NETWORK` constants are updated correctly:

```bash
#!/bin/bash

GENESIS=genesis.json
BYRON_GENESIS=byron-genesis.json
HARDFORK_EPOCH=1 # MC4 only, to be updated for mainnet
NETWORK="--testnet-magic 42" # replace by --mainnet for mainnet

epoch_length=$(jq -r .epochLength $GENESIS)
slot_length=$(jq -r .slotLength $GENESIS)
byron_slot_length=$(( $(jq -r .blockVersionData.slotDuration $BYRON_GENESIS) / 1000 ))
byron_epoch_length=$(( $(jq -r .protocolConsts.k $BYRON_GENESIS) * 10 ))

byron_start=$(jq -r .startTime $BYRON_GENESIS)
byron_end=$((byron_start + HARDFORK_EPOCH * byron_epoch_length * byron_slot_length))
byron_slots=$(($HARDFORK_EPOCH * byron_epoch_length))
now=$(date +'%s')

expected_slot=$((byron_slots + (now - byron_end) / slot_length))
current_slot=$(cardano-cli shelley query tip $NETWORK | jq -r '.slotNo')
percent=$(echo -e "scale=2\n$current_slot * 100 / $expected_slot" | bc)

echo "slot ${current_slot}/${expected_slot} ${percent}%"

```

For example currently:

```auto
$ sync
slot 236000/236002 99.99%

```

**Edit:** Updated using some improvements for mainnet from the great folks at [cardano-community/guild-operators](https://github.com/cardano-community/guild-operators). Note that it will correctly work only once the hard fork period is completed as I have not handled the transition period.

---

<div class="post-metadata">

**Author:** ![SirPickelhaupt](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/sirpickelhaupt/32/20180_2.png) [@SirPickelhaupt](https://forum.cardano.org/u/SirPickelhaupt)\
**Post date:** [28 July 2020 10:48 UTC](https://forum.cardano.org/t/check-sync-status-of-node/36500/10 "2020-07-28T10:48:27Z")

</div>

Thank you very much Smaug!

---

<div class="post-metadata">

**Author:** ![hanswurst](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/hanswurst/32/21722_2.png) [@hanswurst](https://forum.cardano.org/u/hanswurst)\
**Post date:** [2 August 2020 19:03 UTC](https://forum.cardano.org/t/check-sync-status-of-node/36500/11 "2020-08-02T19:03:08Z")

</div>

Also, I just wanted to leave you a “thank you”. This was helpful to me 🙂

---

<div class="post-metadata">

**Author:** ![TristonH55](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/tristonh55/32/26964_2.png) [@TristonH55](https://forum.cardano.org/u/TristonH55)\
**Post date:** [13 February 2021 20:50 UTC](https://forum.cardano.org/t/check-sync-status-of-node/36500/12 "2021-02-13T20:50:56Z")

</div>

yeah i am also finding the docs and help not to great. i am syncing for last 2 days and its so slow that i will take over a year at this rate to have my node fully synced ? there is no discort chat only tg and when you ask devs questions for help they are to up them selfs to help. Not Good.

should it be so slow at syncing, i am on block slot 21683218 and its taken days one block every few minutes is not good

---

<div class="post-metadata">

**Author:** ![loranditsum](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/loranditsum/32/31001_2.png) [@loranditsum](https://forum.cardano.org/u/loranditsum)\
**Post date:** [23 March 2021 17:56 UTC](https://forum.cardano.org/t/check-sync-status-of-node/36500/13 "2021-03-23T17:56:28Z")

</div>

```
        GENESIS=/testnet-shelley-genesis.json
        BYRON_GENESIS=/testnet-byron-genesis.json
        HARDFORK_EPOCH=1 # MC4 only, to be updated for mainnet
        NETWORK="--testnet-magic 1097911063" # replace by --mainnet for mainnet

        epoch_length=$(jq -r .epochLength $GENESIS)
        slot_length=$(jq -r .slotLength $GENESIS)
        byron_slot_length=$(( $(jq -r .blockVersionData.slotDuration $BYRON_GENESIS) / 1000 ))
        byron_epoch_length=$(( $(jq -r .protocolConsts.k $BYRON_GENESIS) * 10 ))

        byron_start=$(jq -r .startTime $BYRON_GENESIS)
        byron_end=$((byron_start + HARDFORK_EPOCH * byron_epoch_length * byron_slot_length))
        byron_slots=$(($HARDFORK_EPOCH * byron_epoch_length))
        now=$(date +'%s')

        expected_slot=$((byron_slots + (now - byron_end) / slot_length))
        current_slot=$(cardano-cli query tip $NETWORK | jq -r '.slot')
        percent=$(echo -e "scale=2\n$current_slot * 100 / $expected_slot" | bc)

        echo "slot ${current_slot}/${expected_slot} ${percent}%"

```

UPDATED SCRIPT FOR TESTNET IN VERSION 1.26

---

<div class="post-metadata">

**Author:** ![erikd](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/erikd/32/813_2.png) [@erikd](https://forum.cardano.org/u/erikd)\
**Post date:** [3 April 2021 06:44 UTC](https://forum.cardano.org/t/check-sync-status-of-node/36500/14 "2021-04-03T06:44:18Z")

</div>

Running this on mainet with the only change being to replace `$NETWORK` is unlikely to give the correct results. You will _also_ need to replace the testnet genesis config files with the relevant mainnet ones.

**Update:** This script has [been confirmed to be wrong when run on mainnet](https://github.com/input-output-hk/cardano-node/issues/2559).

**Update #2:** A better solution would be the implementation of the ticket [Add a synchronisation percentage figure to the query tip command output](https://github.com/input-output-hk/cardano-node/issues/2569) .

---

<div class="post-metadata">

**Author:** ![bokutin](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/bokutin/32/38748_2.png) [@bokutin](https://forum.cardano.org/u/bokutin)\
**Post date:** [6 July 2021 12:00 UTC](https://forum.cardano.org/t/check-sync-status-of-node/36500/15 "2021-07-06T12:00:52Z")

</div>

It was very helpful. Thank you.

I made it for mainnet.

The output at the current time is shown below.  
slot 34006443/34006449 99.99%

```auto
#!/bin/sh

GENESIS=mainnet-shelley-genesis.json
BYRON_GENESIS=mainnet-byron-genesis.json
HARDFORK_EPOCH=208
NETWORK="--mainnet"

epoch_length=$(jq -r .epochLength $GENESIS)
slot_length=$(jq -r .slotLength $GENESIS)
byron_slot_length=$(( $(jq -r .blockVersionData.slotDuration $BYRON_GENESIS) / 1000 ))
byron_epoch_length=$(( $(jq -r .protocolConsts.k $BYRON_GENESIS) * 10 ))

byron_start=$(jq -r .startTime $BYRON_GENESIS)
byron_end=$((byron_start + HARDFORK_EPOCH * byron_epoch_length * byron_slot_length))
byron_slots=$(($HARDFORK_EPOCH * byron_epoch_length))
now=$(date +'%s')

expected_slot=$((byron_slots + (now - byron_end) / slot_length))
current_slot=$(cardano-cli query tip $NETWORK | jq -r '.slot')
percent=$(echo -e "scale=2\n$current_slot * 100 / $expected_slot" | bc)

echo "slot ${current_slot}/${expected_slot} ${percent}%"

```

---

<div class="post-metadata">

**Author:** ![houseofcardano](https://avatars.discourse-cdn.com/v4/letter/h/779978/32.png) [@houseofcardano](https://forum.cardano.org/u/houseofcardano)\
**Post date:** [22 August 2021 07:20 UTC](https://forum.cardano.org/t/check-sync-status-of-node/36500/16 "2021-08-22T07:20:11Z")

</div>

Thank you very much. This was very helpful & works great. Much appreciated

---

<div class="post-metadata">

**Author:** ![Ruslan\_Sendecky](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/ruslan_sendecky/32/39545_2.png) [@Ruslan\_Sendecky](https://forum.cardano.org/u/Ruslan_Sendecky)\
**Post date:** [30 August 2021 03:48 UTC](https://forum.cardano.org/t/check-sync-status-of-node/36500/17 "2021-08-30T03:48:39Z")

</div>

Guys, just a small remark.  
You don’t really need to parse Byron stuff all the time, do you?  
Byron variables are constants.

Given,

BYRON\_END\_TIME=“1596059091”  
BYRON\_SLOTS=“4492800”

Everything else boils down to only a couple of lines.

---

<div class="post-metadata">

**Author:** ![SirPickelhaupt](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/sirpickelhaupt/32/20180_2.png) [@SirPickelhaupt](https://forum.cardano.org/u/SirPickelhaupt)\
**Post date:** [30 August 2021 18:59 UTC](https://forum.cardano.org/t/check-sync-status-of-node/36500/18 "2021-08-30T18:59:56Z")

</div>

If you are using testnet configurations for example, the variables are different. So that is why they are not defined as constants in the script. 🙂

---

<div class="post-metadata">

**Author:** ![Neeraj](https://avatars.discourse-cdn.com/v4/letter/n/e47c2d/32.png) [@Neeraj](https://forum.cardano.org/u/Neeraj)\
**Post date:** [11 October 2022 13:12 UTC](https://forum.cardano.org/t/check-sync-status-of-node/36500/19 "2022-10-11T13:12:18Z")

</div>

hi SirPickelhaupt,

Have you solved your problem. I’m also want to how much percentage synchronisation is completed. Could you please help me out. I have installed Cardano 1.35.3.

---

<div class="post-metadata">

**Author:** ![Terminada](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/terminada/32/80229_2.png) [@Terminada](https://forum.cardano.org/u/Terminada)\
**Post date:** [11 October 2022 13:23 UTC](https://forum.cardano.org/t/check-sync-status-of-node/36500/20 "2022-10-11T13:23:03Z")

</div>

> [@Neeraj](#):
>
> how much percentage synchronisation is completed

```auto
CARDANO_NODE_SOCKET_PATH='/run/cardano/mainnet-node.socket' cardano-cli query tip --mainnet

```

> {  
> “block”: 7153708,  
> “epoch”: 334,  
> “era”: “Alonzo”,  
> “hash”: “31fa984f2c4829563a6f072bd073960cd4ee2e92888ea24c0c52eb368e98746f”,  
> “slot”: 59031834,  
> “syncProgress”: “90.65”  
> }

[Next page](https://forum.cardano.org/t/check-sync-status-of-node/36500.md?page=2)
