Skip to content

πŸš€ Solana Projects πŸš€ This repository contains TypeScript, Rust, and Anchor scripts for interacting with the Solana blockchain, developed as part of the Solana Developer Program.

License

Notifications You must be signed in to change notification settings

RobCyberLab/Solana_Developer_Program

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

β˜„οΈC3 Comets PanΘ›a Robertβ˜„οΈ

This repository contains TypeScript, Rust, and Anchor scripts for interacting with the Solana blockchain, developed as part of the Solana Developer Program.

Table of Contents πŸ“‘

  1. Laboratory 1: Transactions
  2. Laboratory 2: Tokens
  3. Laboratory 3: NFTs
  4. Laboratory 4: RUST
  5. Laboratory 5: Favorites
  6. Laboratory 6: Escrow
  7. Laboratory 7: NFT Vesting
  8. Laboratory 8: Lottery

Laboratory 1 πŸš€

Solana Transaction Scripts

This section covers fundamental operations on the Solana blockchain, such as generating keypairs, checking balances, and sending SOL between accounts.

Commands πŸ› οΈ

  • Generate Keypair πŸ—οΈ
    npx tsx generate-keypair.ts
  • Check Balance πŸ’°
    npx esrun check-balance.ts <public-key>
  • Send SOL πŸ’Έ
    npx tsx transfer-sol.ts <recipient-public-key>

Laboratory 2 🌟

Solana Token Management

This section explores creating token mints, minting tokens, and transferring SPL tokens on Solana.

Commands πŸ› οΈ

  • Create Token Mint 🏦
    npx esrun create-token-mint.ts
  • Mint Tokens πŸ…
    npx esrun mint-tokens.ts
  • Transfer Tokens πŸ”„
    npx esrun transfer-tokens.ts

Laboratory 3 🎨

NFT Creation on Solana

This section details uploading NFT images, metadata, and minting NFTs on Solana.

Commands πŸ› οΈ

  • Upload NFT Image πŸ–ΌοΈ
    npx esrun nft-image.ts
  • Upload NFT Metadata πŸ“œ
    npx esrun nft-metadata.ts
  • Create NFT 🎟️
    npx esrun nft-create.ts

Laboratory 4 πŸ¦€

Rustlings Exercises

This section contains hands-on exercises designed to introduce to Rust's syntax and core concepts. It will work through a series of small programs that require debugging and modification to understand key Rust principles.

Structure of the Lab πŸ—οΈ

Rustlings exercises are divided into categories:

Exercise Topic
Exercise 0 Intro
Exercise 1 Variables
Exercise 2 Functions
Exercise 3 If Statements
Exercise 4 Primitive Types
Exercise 5 Vectors
Exercise 6 Move Semantics
Exercise 7 Structs
Exercise 8 Enums
Exercise 9 Strings

Laboratory 5 βš“

Building Solana Programs with Anchor

This section focuses on building Solana smart contracts (programs) using Anchor, a framework that simplifies the development of on-chain applications. The program demonstrates how to create, update, and manage personalized data on Solana using Anchor and Program Derived Addresses (PDAs), enabling developers to build decentralized applications that interact with on-chain data while maintaining high security and personalization.

Commands πŸ› οΈ

  • Build the Program πŸš€

    anchor build
  • Run Unit Tests πŸ§ͺ

    anchor test  

Solana Favorites Program Using Anchor 🌟

This Solana-based program allows users to store and manage their favorite color, favorite number, and hobbies on the blockchain. Built with the Anchor framework, the program ensures that each user's preferences are securely stored in an account, making the data immutable and easily accessible.

Key Features πŸ”‘

  • Secure User Data: Only the account owner (the user) can modify their favorites, ensuring privacy and security.

  • Permanent Storage: User preferences are stored on-chain, making the data accessible and unaltered over time.

  • Program Derived Addresses (PDAs): The program uses PDAs to securely derive unique addresses for each user, ensuring that each user's data is associated with their public key. This ensures each user has their own personalized account, which is tied to their public key and cannot be modified by others.

  • Simple Interaction: Users can easily set and retrieve their favorite color, number, and hobbies using smart contract methods.

Laboratory 6 🏦

Building Solana Escrow Program with Anchor

This section focuses on creating a Solana escrow program using the Anchor framework. The program allows users to create offers for token exchanges, securely depositing tokens into an escrow account, and facilitate the exchange of assets between parties. By leveraging Anchor’s tools and Solana's smart contract capabilities, the program ensures secure and efficient transactions while preventing fraud.

Commands πŸ› οΈ

  • Build the Program πŸš€

    anchor build
  • Run Unit Tests πŸ§ͺ

    anchor test  

Escrow Program Using Anchor 🌟

This Solana-based program allows users to create escrow offers for token swaps, securely holding the deposited tokens until both parties fulfill the terms of the offer. Built with the Anchor framework, the program ensures that assets are managed and exchanged in a trustless manner.

Key Features πŸ”‘

  • Secure Token Deposit: Users deposit tokens into an escrow account, where they are held until the exchange conditions are met.

  • Trustless Transactions: The program ensures that both parties involved in the offer must fulfill the terms before the tokens are released, reducing the risk of fraud.

  • Personalized Offers: Users can create offers with specific token amounts and conditions, making each offer unique and customizable.

  • Program Derived Addresses (PDAs): Each offer is linked to a unique address, derived from the user's public key, ensuring that offers are securely tied to the creator and cannot be modified by others.

  • Efficient Token Exchange: The program facilitates the secure transfer of tokens between users, ensuring that the exchange process is seamless and efficient.

  • Cross Program Invocation (CPI): The program uses CPI to call the transfer_checked function from the TokenProgram, enabling secure token transfers between accounts. This allows the escrow program to interact with other on-chain programs to manage token transfers, enhancing flexibility and security.

Laboratory 7 ⏳

NFT Vesting

This section focuses on building an NFT staking program on the Solana blockchain using the Anchor framework. The program enables users to stake NFTs from a verified collection to earn rewards. It securely manages metadata validation, token freezing, and account state using PDAs and CPIs, ensuring a safe and transparent staking experience.

Commands πŸ› οΈ

  • Build the Program πŸš€

    anchor build
  • Run Unit Tests πŸ§ͺ

    anchor test  

NFT Staking Program Using Anchor 🌟

This Solana-based program enables users to stake their NFTs and earn rewards in a secure, on-chain manner. Built using the Anchor framework, the application leverages metadata validation and token freezing to ensure authenticity, ownership, and immutability during the staking period.

Key Features πŸ”‘

  • NFT-Based Staking: Users can stake NFTs from a verified collection to earn points and future rewards. This incentivizes NFT holding and engagement within a collection.

  • Metadata Validation & Collection Check: Only NFTs from a specific collection are allowed for staking, verified through the on-chain metadata and master edition accounts, ensuring authenticity and consistency.

  • Token Freezing via CPI: Once staked, the NFT is frozen using a Cross Program Invocation (CPI) to the Token Metadata Program, preventing transfers and guaranteeing that the NFT remains staked for the duration.

  • Staking Configuration Control: Admins can initialize configurable parameters such as rewards per stake, max NFTs per user, and freeze periods using a global config account.

  • User Tracking & Rewards: Each user has an individual config account tracking staking points and total NFTs staked, allowing personalized reward systems and gamification potential.

  • Secure Account Derivation with PDAs: All staking, user, and config accounts are securely derived using Program Derived Addresses (PDAs), ensuring unique and tamper-proof account linkage.

  • Extensible Claim & Unstake Logic: While currently minimal, the program includes hooks for future development of claiming rewards and unstaking, enabling future expansion into token payouts or dynamic point conversion.

Laboratory 8 🎰

Lottery

This section focuses on building a decentralized lottery application on the Solana blockchain using Anchor, a framework that simplifies Solana program development. The lottery program demonstrates how to initialize and configure a lottery, allow users to buy tickets, pick a winner, and claim rewards. The program utilizes smart contracts to manage token transactions, ensure secure interactions, and implement a random winner selection process.

Commands πŸ› οΈ

  • Build the Program πŸš€

    anchor build
  • Run Unit Tests πŸ§ͺ

    anchor test  

Solana Lottery Program Using Anchor 🌟

This program allows users to participate in a blockchain-based lottery by buying tickets with a token of their choice. The smart contract manages the lottery’s configuration, including the start and end times, ticket price, and reward amount. After purchasing a ticket, users can later claim their prizes, and the program ensures that the lottery operates securely and transparently.

Key Features πŸ”‘

  • Secure Ticket Purchases: The program ensures that ticket purchases can only be made within the set time frame, ensuring fairness and preventing out-of-time transactions.

  • Random Winner Selection: The program aims to implement a randomness mechanism (currently commented out) for choosing a winner, ensuring a fair and transparent selection process.

  • Token Integration: The lottery program uses Solana SPL tokens for purchasing tickets and storing funds in a vault. Tokens are securely transferred between users and the lottery account.

  • Personalized Configurations: The lottery's configuration, such as start time, end time, and ticket price, can be set by the admin, offering flexibility for different lottery types.

  • Prize Claiming: Once the winner is selected, they can claim their prize through a secure process, ensuring a seamless user experience.

About

πŸš€ Solana Projects πŸš€ This repository contains TypeScript, Rust, and Anchor scripts for interacting with the Solana blockchain, developed as part of the Solana Developer Program.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published