How to achieve Solidity's mapping in Solana?

361 Views Asked by At

How to achieve the functionality of Solidity's mapping in Solana? What I need is a map with an arbitrary number of entries (it'll be evergrowing).

So how to calculate the rent exemption and how to actually do this? Is it even possible?

I just need 1 account, so 1 global hashmap in a program.

I would be storing keys as integers and values as strings.

1

There are 1 best solutions below

0
On

in solana it's more common to use PDAs for this purpose, encode the key inside the seed and use the account data for storing the value.