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
.