Post
Share your knowledge.
How to use Walrus for storing and verifying data on Solana?
I'm trying to build a Solana smart contract, and I need to hash some data on-chain. I want to store this hashed data using Walrus and verify it later. My main concern is whether to store this data on-chain or off-chain using Walrus. Additionally, I'm curious if storing the data off-chain allows for editing, and I am looking for the most efficient and secure method to enable this validation through the smart contract.
- Walrus
- Typescript SDK
Answers
2Currently, you can't upload data to Walrus directly from a Solana smart contract or a Sui smart contract. You'll need to handle the data collection and storage to Walrus off-chain. Once you store the data with Walrus and have the blob IDs, you can reference and store them on-chain using Solana if needed. Walrus blobs are meant to be managed through off-chain protocols, with their certification managed on the blockchain like Sui. For storing off-chain with Walrus, the data is first encoded into slivers and distributed across storage nodes. The storage of blobs in Walrus can be extended for long-term guarantees, but modifying the data itself would require new uploads and certifications.
On-chain storage references the metadata and pointers to the actual blob data stored off-chain on Walrus. This means the content of blobs is stored off-chain, providing flexibility and reducing costs. Ensuring the security and validation of the data with a Solana smart contract would require checking against the certified Walrus events stored via Sui or similar on-chain events. It's crucial to ensure the hashes match during retrieval to confirm data integrity.
Do you know the answer?
Please log in and share it.
Walrus is a decentralized storage and data availability protocol designed specifically for large binary files, or "blobs"