Sol.College

Full lesson

solsql-program

SQL on Solana.

What it does

From the project README:

A Solana program that enables SQL-like access to the Solana blockchain, supporting full CRUD operations.
Original
AkliluYirgalem/solsql-program
SuperStack fork
Blockchains/solsql-program @ c540d2f
Stars
2
Last push (original)
2026-01-02
Languages
Rust
Detected stack
Native Rust
Categories
Other
Licence
MIT

Architecture

6 source files. By extension: .rs ×6.

Top-level directorySource files
src6

Dapp: devnet deploy pending

⏳ Devnet deploy pending — goes live when the devnet wallet is topped up. This fork's own dapp is not deployed yet, so there is no program address or transaction to show. It is queued in dapp-queue.txt; once devnet SOL is available it is deployed, exercised with real devnet transactions, and this section switches to the live dapp at /dapps/solsql-program/. Until then, the lesson and step-by-step guide below are complete, and you can run it locally with the commands below.

Key code, explained

Excerpts chosen automatically where the code uses the most Solana concepts, pinned to the fork's commit.

AkliluYirgalem/solsql-program · src/processor.rs L37–59 @ c540d2f · MIT · original
                Pubkey::find_program_address(&[&table_seed], &program_id);            assert_eq!(                expected_table_pda, *passed_table_pda.key,                "Invalid Table Address."            );            if **passed_table_pda.lamports.borrow() > 0 {                return Ok(());            }             let table_data = borsh::to_vec(&table_metadata)?;            create_pda_account(                payer,                passed_table_pda,                &[&table_seed, &[bump]],                table_data.len(),            )?;             write_to_account(&table_data, passed_table_pda)?;            msg!("Table Created At: {}", passed_table_pda.key);        }        SOLSQLInstruction::InsertIntoTable(data_field) => {            let mut raw_table_data = passed_table_pda.try_borrow_mut_data()?;            let mut table_metadata = TableMetadata::try_from_slice(&raw_table_data)?;
  1. Line 37 Pubkey::find_program_address(&[&table_seed], &program_id);: Derives a PDA from seeds and the program ID and returns the address with its canonical bump.
  2. Line 50 &[&table_seed, &[bump]],: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
  3. Line 55 msg!("Table Created At: {}", passed_table_pda.key);: Logs to the program log, which is visible in explorers and the test output.
AkliluYirgalem/solsql-program · src/utils.rs L25–48 @ c540d2f · MIT · original
    pda_account: &AccountInfo<'a>,    seeds: &[&[u8]],    space: usize,) -> Result<(), ProgramError> {    let pda_lamports = **pda_account.lamports.borrow();    let pda_owner = *pda_account.owner;     if pda_lamports > 0 {        if pda_owner != PROGRAM_ID {            msg!("PDA already exists but is not owned by this program");            return Err(ProgramError::IllegalOwner);        }        msg!("PDA already exists, skipping creation");        return Ok(());    }    let lamports = rent_exempt_lamports(space)?;    invoke_signed(        &instruction::create_account(            payer.key,            pda_account.key,            lamports,            space as u64,            &PROGRAM_ID,        ),
  1. Line 34 msg!("PDA already exists but is not owned by this program");: Logs to the program log, which is visible in explorers and the test output.
  2. Line 41 invoke_signed(: Makes a CPI signed by a PDA. The signer seeds prove the program controls that address.

How to run, build and test

These commands come from the repo's own manifests (package.json scripts, Anchor.toml, Cargo, go.mod, Makefile). Check the README for prerequisites and environment variables.

DirectoryCommandRuns
.cargo buildRust workspace build
.cargo testRust tests

What you could build from it