The Kademlia spec states that
To store a <key,value> pair, a participant locates the k closest nodes to the key and sends them STORE RPCs. Additionally, each node re-publishes the <key,value> pairs that it has every hour.
Do our DHT implementations republish their <key,value> pairs every hour?
I don’t think go-libp2p-kad-dht does this automatically. IPFS does reprovide every N hours (can’t remember how many). Sorry for the vagueness.
I believe IPFS republishes IPNS records periodically. Are you saying it also reprovides all records periodically? I feel like this should really part of our Kademlia implementations, so as to comply with the spec (perhaps with an option to turn it off). But I wonder if there’s a good reason why it was left out?
This topic piques my interest.
go-ipfs doesn’t use
dht.PutValue(key, value) to store content. Content is held locally, advertised via provider records (à la Coral), and exchanged via Bitswap, not via the DHT protocol. It is a pull model.
Since the availability of this data is not managed by the DHT, it cannot autonomously decide to reprovide.
OTOH, Kademlia’s STORE (=
dht.PutValue(key, value)) is pertinent to a push model.
Usages I know of:
- libp2p itself uses it to store public keys for peers.
- IPNS uses it to publish name records.
go-libp2p deviates from Kademlia insofar we don’t expire content received via this pathway: it’s permanent. So republishing every hour is unnecessary.
This seems like a weakness worth addressing.
Opened an issue, thanks for reporting!