A Solana smart contract project that demonstrates how to send, store, and update data on-chain using keys. Built with Rust and the Anchor framework.


πŸ“š GitHub Repository

This project explores how to interact with a Solana program by writing and updating user-defined data directly on-chain. It simulates a simple β€œfavorites” manager β€” where users can send strings or numbers to the chain, associate them with a unique key, and later update those entries.

A great starting point for:

  • Understanding persistent on-chain state
  • Managing user-specific data using derived accounts
  • Creating decentralized CRUD-style apps

🧰 Stack & Tools

  • πŸ¦€ Rust (Solana smart contract logic)
  • βš“ Anchor (framework for Solana programs)
  • πŸ§ͺ Local test validator
  • πŸ§ͺ Rust unit/integration tests

✨ Features

  1. Send Arbitrary Data to the Blockchain

    • Insert a value associated with a custom key.
  2. Update Stored Data by Key

    • Modify entries via a transaction that targets a specific key.
  3. Simple Chain Storage Pattern

    • Uses Solana accounts to persist user-defined values.
  4. Full Test Coverage

    • Rust-based tests validate program logic locally.

πŸš€ Getting Started

1. πŸ§ͺ Start Local Solana Validator

Spin up a local blockchain testnet:

solana-test-validator

2. πŸ›  Build and Deploy

Compile and deploy the Anchor program:

anchor build && anchor deploy

3. πŸ‘› Add Wallet

Set your Solana CLI wallet path:

export ANCHOR_WALLET=~/.config/solana/id.json

4. βœ… Run Tests

Ensure everything works as expected with:

cargo test

5. πŸ” View Transactions

Access the local explorer to track activity: http://localhost:8899


🧠 Use Cases & Ideas

  • ⭐ Store favorite quotes, URLs, or topics by key
  • 🧾 Use it as a base for decentralized note-taking or bookmarking
  • πŸ”‘ Extend it with access control and per-user namespaces

πŸ“„ License

This project is licensed under the MIT License β€” free for personal and commercial use.