Get provider records using `ipfs dht get key > file` and reput as `ipfs dht put key file`

IPNS key records can be obtained using: ipfs dht get /ipns/${ipns_key} > ${file_name}
and republished as: ipfs dht put /ipns/${ipns_key} ${file_name}. Using this method an online node can republish the IPNS record for an offline node, right?

What is the counterpart for the provider records? More specifically, to get the provider records for a CID, as provided by a peer ID, ipfs dht get /ipfs/${CID} or ipfs dht get /p2p/${peerID}/ipfs/${CID} gives Error: invalid key. So what is the right argument for ipfs dht get here?

Note: I know you can get the providers list simply using ipfs dht findprovs ${CID}. But I need the provider record associated with a CID and a peer ID. This is so that an online node can get the provider record of a certain file provided by an offline node and reput that in the DHT to keep the record alive. This is to be used for certain rendezvous purposes, hence no need to download the file that is being provided. Hope my question is not unclear.

There is no such thing as a provider record, yet, unfortunately. And, for that reason, no way to put provider records on behalf of other peers.

This has been a planned feature for a while (Signed Provider records for the DHT · Issue #559 · libp2p/go-libp2p-kad-dht · GitHub).

1 Like