I have a struct which I want to store on the blockchain:
pub struct Item {
pub id: String,
pub link: String,
pub user_address: Pubkey,
}
Now I want to generate an id for it in the Solana program. If I add the UUID package and try to call Uuid::new_v4()
, I get the following error.
error: target is not supported, for more information see: https://docs.rs/getrandom/#unsupported-targets
Question: How to generated a UUID in a Solana program? Or alternatively, how to generate a unique identifier of any sort?