# Checkpoints mechanism

## <mark style="color:red;">Problem</mark>

### PoS/BFT blockchains are vulnerable to so-called <mark style="color:red;">long-range attack</mark>

Its essence is that when you start synchronizing your node with the current state of the blockchain, you have to start checking blocks 0,1,2,... and so on. At the same time, you need to take these blocks from somewhere and here is the problem - **how to make sure which block is valid?**

If, say, block 1337th was generated and confirmed by the network more than 3 years ago, then with a high degree of probability those old validators are no longer active and may have even removed their shares from staking. A problem arises - you cannot clearly determine which block with index 1337 was correct - anyone can offer you any valid fork.

## What are hostchains ?

**Hostchains** are independent L0-L1 blockchains that rely on their own security, fault tolerance and decentralization.

> ### We use their <mark style="color:red;">TOTAL POWER</mark> as the maximum source of liquidity and decentralization

## Solution

{% hint style="info" %}
In order for you to be able to check the relevance of your copy of the blockchain, the current quorum (current validators who have frozen their stake and who can be trusted because they have something to risk) makes "checkpoints" to other blockchains once per epoch (or with other frequency)
{% endhint %}

A checkpoint is a fact that looks like this, for example:

```json
{ 
    epoch: 167,
    lastLeader: 27,
    lastBlockIndexByLeader: 56,
    lastBlockHashByLeader: 'aaaa...'
}
```

If such a message is saved on many blockchains, then even after many years it can be trusted, because in order to potentially change it, attackers would need to compromise most of the blockchains.

{% hint style="success" %} <mark style="color:red;">**TLDR**</mark> - having found such a message in 2/3 of the blockchains that we will use to maintain checkpoints, you can be confident about the validity of your own copy of the state and blockchain.
{% endhint %}

## How to find checkpoints ?

{% hint style="info" %}
The same is here ⇒ [#solution](https://docs.klyntar.org/build-core-and-join-network/explorers-and-how-to-use-them/usage-guide/network-info/hostchain-checkpoints#solution "mention")
{% endhint %}

In explorer visit the page about checkpoints'

<figure><img src="https://3015034387-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNKK8Y1uEALYsObbKnPLt%2Fuploads%2FuNgvZFwvKPtD966wfUHa%2Fimage.png?alt=media&#x26;token=9f7abc41-0272-42da-8ad0-5624ea6f1bff" alt=""><figcaption></figcaption></figure>

Here for each epoch, a list of checkpoints and links to the corresponding transactions in other blockchains is available.

Here **Bitcoin**, **Ethereum** and **Solana** are used as examples

In many cases, it is recommended to trust the validity of the epoch data where 2/3N checkpoints are available. This is a guarantee that the checkpoint is made forever

Long story short you can trust this

<figure><img src="https://3015034387-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNKK8Y1uEALYsObbKnPLt%2Fuploads%2FiUceKckX9zBoyuLIlyNT%2Fimage.png?alt=media&#x26;token=e7e89060-8389-4c16-bd19-9a5178b5ea21" alt=""><figcaption></figcaption></figure>

And this:

<figure><img src="https://3015034387-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNKK8Y1uEALYsObbKnPLt%2Fuploads%2F4CejqytqSRWbTWaQ3a6l%2Fimage.png?alt=media&#x26;token=8109d5f4-bc83-4943-9f11-96edc81f52c5" alt=""><figcaption></figcaption></figure>

But doubt this:

<figure><img src="https://3015034387-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNKK8Y1uEALYsObbKnPLt%2Fuploads%2F85RaKm6mluavqQfDzMl1%2Fimage.png?alt=media&#x26;token=09946f3d-e8fc-4b48-b231-b0c292983be2" alt=""><figcaption></figcaption></figure>
