Ensuring an indexer is up to date with the targeted network

Since some information are not stored in blockchain state, it is mandatory to use an indexer. For example if you want to get an identity by its username, Duniter will not answer that because it only remembers the 128 bits of the username hash, not the maximum 336 bits (8 × 42) of the username.

But that means that some features of the clients (like for example getting an identity by username in gcli) are only available if and indexer exists and match the targeted network. Therefore, when using these functions, we should check that:

  • the indexer can be reached
  • the duniter node can be reached
  • the indexer is based on the same network as the duniter node (same genesis hash for example)
  • the indexer is relatively up to date with the network (not too far from last finalized block)

We can implement this in two manners:

  • the less trusty way where the clients performs the check himself
  • the more convenient but also more trusty way where the clients asks the indexer if it is up to date on a given network

I’m adding this post in the #clients category since for now, this is not implemented in the indexer and has to be implemented in the client.

2 Likes

This is why I will implement the indexer connection paired with a node connection in Tikka.

The node and the indexer paired in Tikka can be on different domains, but choosing a node in Tikka will always choose the indexer paired in the config.

So with Tikka you will connect to a pair of server (node + indexer), already configured in the default server list, or configured by the user. This kind of implementation simplify the code and its maintenance.

It is also an opinionated way of supporting the setup of full servers (with a node + an indexer) in the network, on the same domain. If the server is well maintained, the indexer should always be in good sync with the node of the same domain.

2 Likes

In last gcli version, there is a new command for this purpose (see examples):

# check if indexer is on the same chain as duniter
gcli check-indexer-against-blockchain
1 Like