Solidity — Mappings and Addresses

Devrun
2 min readApr 2, 2022

--

Photo by Alvaro Reyes on Unsplash

In this chapter, we’re going to learn about Mappings and Addresses in Solidity.

Addresses

The Ethereum blockchain is made up of accounts, which you can think of like bank accounts. An account has a balance of Ether (the currency used on the Ethereum blockchain), and you can send and receive Ether payments to other accounts, just like your bank account can wire transfer money to other bank accounts.

Each account has an address, which you can think of like a bank account number. It's a unique identifier that points to that account, and it looks like this:

0x0cE446255506E9.......6df9Cc969183

Mappings

We looked at structs and arrays. Mappings are another way of storing organized data in Solidity.

Defining a mapping looks like this:

A mapping is essentially a key-value store for storing and looking up data. In the first example, the key is an address and the value is a uint, and in the second example the key is a uint and the value a string.

Thank you for your attention :)

See you next time 🚀

Source: https://cryptozombies.io/

--

--

Devrun

Skilled professional with 7 years of experience developing reliable, optimized, high-performance mobile and web apps that reduce costs, save time and nerves.