Search code examples
hashipfsdhtdistribute

In IPFS, will same content produce the same CID on 2 different peers?


In IPFS, imagine that I add a file that contains the text “Hello everyone” to the network. Then I get a certain Content Identifier (CID). If someone else also adds a file that contains the text “Hello everyone”, will he get the same CID as me? In other words, will identical files always produce the same CID, regardless of the peer?


Solution

  • Yes that is correct! The CID is based on the contents of the file, so if another person created the exact same content (and same formatting, e.g. UTF-8) then both CIDs would be the same.