I am going to store huge number of record for my on-chain program. Each record's size is small (likely 100Bytes), but need to store many(maybe millions) records on-chain. From what I have known presently, create a hash-map using PDA seem to be a solution for me.

But I wonder if there is item number limit? and will the gas fee go higher as the hash-map grow?

Any response will be appreciated, and if possible please provide me some link of examples source.

2 Answers 2


You can indeed create as many individual PDAs as you want. But about the hashmap, are you storing it on-chain as well? If so, then rent will increase. However, I don't think so the solution you are going ahead with is suitable for what you are trying to achieve. For example if you create millions of PDAs and want to store the hashmap in an account on-chain containing those PDA addresses, then it won't be possible as the hashmap's size would exceed maximum account size limit (10 Mb) and it'd also get really expensive with rent.

Account Reference: https://docs.solana.com/developing/programming-model/accounts

  • I don't think OP means a literal hashmap. They likely just mean using PDAs to create a hashmap-like relationship between accounts as is advertised by the anchor reference, in which case your first sentence is the correct answer.
    – Ademola
    Commented Dec 28, 2023 at 21:59
  • 1
    Oh, makes sense. Thanks for pointing out. Commented Dec 28, 2023 at 22:43
  • @Ademola is right. and the link is useful. I just want to archive the map alike to that of Ethereum's solidity. Commented Jan 2 at 15:20

There is not limitation for PDA account creation BUT each account in solana's blockchain has the limitation in size, currently it is 10MB.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.