In the section about storing data in the EVM, we learned about how to store our string in the EVM State. An equally important skill is how to read data from the EVM state.
In this section, we'll learn about how to retrieve our string from the EVM state.
Just like with setting the string in the EVM state, there are some conversions we'll have to perform to our string. In particular, we'll need to unhash the value stored in StateDB to get our original string. Thus, our helper function can be defined as follows:
With our helper function defined, we can implement the logic for getString. This will consists of retrieving the underlying key-value mapping and then passing it to GetString.