I’d like to query an IPFS network for the uptime of its nodes individually. That is, over a duration d I would like to know roughly how much time an arbitrary node has been participating in the network. Instead of time, I believe it’s also safe to frame this problem in terms of work and query for the number of blocks added within a time period.
Is there a way to do this?
You can’t query a node for it’s uptime, no. I’m not sure what you mean in terms of “work” as adding blocks isn’t really helping anyone rather serving blocks is, but that data isn’t public either. Why do you need this information? I think individual operators could expose some of these metrics, but I personally wouldn’t want to as I feel they could be a security concern.
Just in case it isn’t clear IPFS does not have a blockchain.
I am running and experimenting with a (for now) private IPFS network. In an intermediate application of the network, I would like to make frequent drops of a resource from a trusted centralized verifier (of sorts) based on the participation of nodes in the network.
I am aware that Filecoin is built for this kind of incentivization. And, AFAIK, if I want something like this to be decentralized, I would need to layer in some kind of consensus mechanism or IP. But, since the verifier is trusted in the intermediate, I was wondering whether I could just accomplish a mock of this goal by directly querying the network.
Ah okay well that makes a lot more sense. You could possibly expose the HTTP RPC APIs, maybe mask them through an auth header via a reverse proxy. That way you could grab block data at least, not sure if it tracks uptime, but you could likely make a small software to read the box’s
uptime and report back via an RPC API as well.
ipfs stats repo may be of use, HTTP API reference: HTTP RPC API | IPFS Docs
In general, you can crawl the network regularly to learn things. I.e. Is a peer always there? How many new peers there are? What versions are they using?
This is done for the ipfs public network with GitHub - dennis-tra/nebula-crawler: 🌌 A libp2p DHT crawler, monitor, and measurement tool that exposes timely information about DHT networks.
Weekly results are here: https://stats.ipfs.network/nebula-22-07-11/