What is IPFS and how is it used with blockchain?

Answer

IPFS (InterPlanetary File System) is a decentralized, peer-to-peer protocol for storing and sharing content-addressed data. Unlike HTTP (location-addressed: URLs point to a server), IPFS uses content addressing: files are identified by their content hash (CID — Content Identifier). Requesting a CID retrieves the file from any node that has it. Use with blockchain: (1) NFT metadata — storing NFT metadata (images, attributes) on IPFS provides decentralization (compared to centralized servers). The NFT's tokenURI stores the IPFS CID: ipfs://QmHash...; (2) DApp frontends — hosting DApp UIs on IPFS for censorship resistance; (3) Document storage — smart contracts store only the IPFS hash of documents (proof of existence); (4) Filecoin — incentivized storage layer on top of IPFS ensuring data is actually stored. Limitations: IPFS doesn't guarantee data persistence — if no node pins the data, it may be garbage collected. Pinning services (Pinata, nft.storage, Infura IPFS) ensure data stays available by pinning it on multiple nodes.