Reputation: 69
How many pairs of key/value can I store in a mapping using Solidity?
mapping(bytes32 => bytes32) pair
If this isn't efficient to store one pair key/value every second or so, can you suggest a better way? I thought of using Swarm/IPFS but I need to lean the design the maximum...
Upvotes: 1
Views: 931
Reputation:
The solidity docs say “Mappings can be seen as hash tables which are virtually initialized such that every possible key exists and is mapped to a value whose byte-representation is all zeros” - there is no theoretical limit to the size of a mapping in solidity.
If you need to make a call to your contract every second to put something in your mapping, your bottleneck will not be in how the mapping type itself works (for which one second is plenty to put a new key-value pair in the mapping), but more so in Ethereum itself, as the network currently only supports around 15 transactions per second, so to have your contract call be included in those 15 every second will be very difficult, even with an exorbitant gas price.
Upvotes: 1