简体   繁体   English

映射类型的实体大小

[英]Solidity size of mapping type

In Solidity, is there a maximum number of keys or key-value pairs that a mapping can store? 在Solidity中,映射可以存储的键或键/值对的最大数量是多少? If so, what is the maximum? 如果是这样,最大值是多少? Furthermore, does the maximum number differ depending on the variable types of the keys and the values of that mapping? 此外,最大数目是否会根据键的变量类型和该映射的值而有所不同?

For example, how many address-uint pairs can the following mapping store? 例如,以下映射可以存储几对地址-uint对?

mapping (address => uint) internal _balanceOf;

Each account has a data area called storage, which is persistent between function calls and transactions. 每个帐户都有一个称为存储的数据区域,该区域在函数调用和事务之间保持不变。 Storage is a key-value store that maps 256-bit words to 256-bit words. 存储是将256位字映射到256位字的键值存储。 (see) (看到)

mapping key in solidity is encoded on 32 bytes, so there is 2**(32*8) possible keys. 实体映射键是在32个字节上编码的,因此有2**(32*8)可能的键。 which is a huge number; 这是一个巨大的数字;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM