Interactive tutorials on decentralized web protocols
Blog | Lesson 2 of 7

Update posts with tags and watch their CIDs change

Everything that is stored in IPFS has an associated CID. That CID is constructed by hashing the data itself. If the same hash and encoding is used, then the same data will result in the same CID. However, as soon as you edit data and store it again, it will have a new CID. The old data won’t be overridden; it’s still stored there with its old CID.

Our blog doesn't have any tags yet. Let’s modify the posts again to add some tags, watching how the CID for each post changes as we change its contents.

First, submit the code in its current state. You’ll see the CIDs of the blog posts. When you submit again after you’ve modified the code, you’ll see that the CIDs have changed.

Try it!

To each post, add a new field called tags whose value is an array of tags. Use the tags outdoor and hobby for the blog post about trees. Give the blog post about computers a single tag called hobby.

View SolutionReplace with SolutionClear Default Code
Update the code to complete the challenge. Click Submit to check your answer.