- Mapping is a data structure in solidity which is used to store key-value pair.
- Its similar to objects in js/ts, dictionaries in python or hashmaps in java.
- Initialization:
mapping(address => string) public name;
- here the data type of key is address, which is eth address (e.g 0x3ac8a9add60256151f8537d5f4866971b229380d) and the data type of value is a normal string
- e.g. name {
0x3ac8a9add60256151f8537d5f4866971b229380d: “walletOne”
}
- Inserting to a map
name[msg.sender] = _name;
- Retrive data from map
name[_address];