Is the bitswap ledger a reliable source of knowing how much data a user has sent/received over a period of time? Specifically, is this data persistent and can this data be tampered with directly?
Define “reliable”? Anyone can fake their own ledger however, the ledger your peer keeps should be valid (unless you choose to tamper with it).
By reliable, I mean exactly what you refer to but in the context of an application that provides an interface on top of the user’s IPFS node to help them manage it. But from what you are saying, I cannot depend on the ledger to immutably tell my app if the said user has indeed transferred out 10GB of data and received 2GB of data i.e. he/she can use the terminal or any other means to edit the ledger’s contents. Correct?
Could you comment on the persistence of data in the ledger? I read somewhere that in certain scenarios(not including user removing IPFS), this data could get wiped out and a fresh ledger would be generated.
Also, any clue on how my app could immutably get the required info. regarding data in/out? Any pattern that I could use decentralised or otherwise?
Baring locked down hardware, this is impossible to prevent. It’s the user’s computer, they can change anything they want (given enough skill).
You can have the downloader submit a signed “receipt” to the uploader. However, no matter what you do, you’re going to have a hard to impossible time dealing with the problem of sybil identities. Someone can simply spawn two nodes on the same machine (or in separate virtual machines) and shuffle data back and forth (or simply have both nodes “pretend” to shuffle data back and forth).
Thank you very much @stebalien!