Efficient Large Mapping

I'm seeking advice on how to best set a large amount of data for mapping.

mapping(uint256 => uint256) public _tokenId;

I would like to populate _tokenId with 10,000 predefined entries, for example:

_tokenId[1] = 5;
_tokenId[1] = 2;
_tokenId[1] = 6;

...

I imagine 10,000 hardcoded entries will exceed the 24.576 kb Solidity Contract limit.

I know this will be possible by creating a function that has an array as a parameter but from my pervious experience, the array size allowed is somewhat restricted and would require chunking the data.

So with that in mind, I'm curious to know if anyone has any suggestions on how to set 10,000 mapped values in an efficient manner, thank you in advance for your time!

1 Like