Full lesson
winisol
Transparent and decentralized solana lottery
What it does
From the project README:
You can use any normal anchor commands. Either move to the `anchor` directory and run the `anchor` command or prefix the command with `pnpm`, eg: `pnpm anchor`.
- Original
- Shobhit2205/winisol
- SuperStack fork
- Blockchains/winisol @
1930ba0 - Stars
- 0
- Last push (original)
- 2025-12-13
- Languages
- TypeScript, Rust, CSS, JavaScript
- Detected stack
- AnchorNext.jsweb3.js
- Categories
- Infrastructure & Tooling
- Licence
- MIT
- Homepage
- http://winisol.com
Architecture
80 source files. By extension: .tsx ×58, .ts ×20, .js ×1, .rs ×1.
| Top-level directory | Source files |
|---|---|
src | 73 |
anchor | 5 |
(root) | 2 |
On-chain programs: anchor/programs/winisol
Dapp: deploying
This fork is queued for its own live dapp on Sol.College, with a Devnet/Mainnet switch. It appears here, at /dapps/winisol/, once it is deployed and checked on devnet. Until then, 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.
anchor/programs/winisol/src/lib.rs L781–804 @ 1930ba0 · MIT · original} #[derive(Accounts)]#[instruction(lottery_id: u32)]pub struct InitializeConifg<'info> { #[account(mut)] pub payer: Signer<'info>, #[account( init, payer = payer, space = 8 + TokenLottery::INIT_SPACE, seeds = [b"token_lottery".as_ref(), lottery_id.to_le_bytes().as_ref()], bump )] pub token_lottery: Box<Account<'info, TokenLottery>>, pub system_program: Program<'info, System>,} #[derive(Accounts)]#[instruction(lottery_id: u32)]pub struct InitializeLimitedLotteryConfig<'info> {- Line 788
pub payer: Signer<'info>,: Requires this account to have signed the transaction. - Line 791
init,: Creates and pays for a new account. Space and payer must be specified. - Line 794
seeds = [b"token_lottery".as_ref(), lottery_id.to_le_bytes().as_ref()],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match. - Line 795
bump: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
src/components/winisol/winisol-data-access.tsx L73–96 @ 1930ba0 · MIT · original new Date(data.endTime).getTime() / 1000, new BN(data.price * LAMPORTS_PER_SOL), ).instruction(); const computeUnitLimitIx = ComputeBudgetProgram.setComputeUnitLimit({ units: 40000, }); const recentPriorityFees = await connection.getRecentPrioritizationFees(); const minFee = Math.min(...recentPriorityFees.map(fee => fee.prioritizationFee)); const computeUnitPriceIx = ComputeBudgetProgram.setComputeUnitPrice({ microLamports: minFee + 1, }); const blockhashContext = await connection.getLatestBlockhashAndContext(); const tx = new Transaction({ feePayer: publicKey, blockhash: blockhashContext.value.blockhash, lastValidBlockHeight: blockhashContext.value.lastValidBlockHeight }).add(computeUnitLimitIx).add(computeUnitPriceIx).add(InitConfigIx); const signature = await sendTransaction(tx, connection, {skipPreflight: true});- Line 77
const computeUnitLimitIx = ComputeBudgetProgram.setComputeUnitLimit({: Sets the compute-unit limit or price (priority fee). - Line 88
const blockhashContext = await connection.getLatestBlockhashAndContext();: Fetches a recent blockhash. Transactions expire if it gets too old. - Line 96
const signature = await sendTransaction(tx, connection, {skipPreflight: true});: Submits the signed transaction to the cluster.
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.
| Directory | Command | Runs |
|---|---|---|
. | npm run dev | next dev |
. | npm run start | next start |
. | npm run build | next build |
. | npm run lint | next lint |
anchor | anchor build | compile programs and generate IDLs |
anchor | anchor test | local validator + test suite |
anchor | anchor run test | ../node_modules/.bin/jest --preset ts-jest |
What you could build from it
- Fork the SuperStack copy and extend it within the Infrastructure & Tooling gaps listed on the idea page.
- Learn the pattern first: Building and sending transactions from a client
- Learn the pattern first: Anchor account constraints