Search⌘ K

Exercise: Validation

Explore how to implement validation in Solidity smart contracts to ensure unique registered names and Ethereum addresses. Learn to create and use structs within mappings and update contract methods for proper verification and data handling.

In this exercise, we'll practice using validation in Solidity. We'll update our smart contract to ensure not only that all the registered names are unique, but also that all the registered Ethereum addresses are unique. In other words, users won’t be able to register the same address under different names.

We'll implement this change in two steps. Firstly, we'll add a new struct type that we'll use in the nameForAddress mapping as ...