Full lesson
EldoriaBattlestorm
What it does
From the project README:
Welcome to **Eldoria Battlestorm**, a turn-based strategy game built on the Solana blockchain! In this game, players engage in strategic battles using their unique characters to claim victory. The game leverages Solana's fast and secure blockchain to ensure a seamless and fair gaming experience.
- Original
- EldoriaGuild/EldoriaBattlestorm
- SuperStack fork
- Blockchains/EldoriaBattlestorm @
f56a784 - Stars
- 0
- Last push (original)
- 2024-10-12
- Languages
- Rust, TypeScript, Python, Dockerfile, Shell
- Detected stack
- MetaplexNative Rustweb3.js
- Categories
- Other
- Licence
- MIT
Architecture
16 source files. By extension: .ts ×9, .rs ×6, .py ×1.
| Top-level directory | Source files |
|---|---|
solana_nft | 8 |
eldoria_battlestorm_main | 6 |
echoes_of_eldoria_api | 1 |
client | 1 |
Dapp: deploying
This fork is queued for its own live dapp on Sol.College, with a Devnet/Mainnet switch. It appears here, at /dapps/eldoriabattlestorm/, 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.
client/main.ts L109–132 @ f56a784 · MIT · original const ix = new TransactionInstruction({ programId:programId, keys:[ {isSigner:false,isWritable:true,pubkey:nft}, ], data:Buffer.from([1])}); const message = new TransactionMessage({ instructions: [ix], payerKey: payer.publicKey, recentBlockhash : (await connection.getLatestBlockhash()).blockhash }).compileToV0Message(); const tx = new VersionedTransaction(message); tx.sign([payer]); const sig = await connection.sendTransaction(tx); }const burn_nft_pda = async () => { const burn = PublicKey.findProgramAddressSync([Buffer.from("burn")],programId)- Line 121
recentBlockhash : (await connection.getLatestBlockhash()).blockhash: Fetches a recent blockhash. Transactions expire if it gets too old. - Line 127
const sig = await connection.sendTransaction(tx);: Submits the signed transaction to the cluster. - Line 132
const burn = PublicKey.findProgramAddressSync([Buffer.from("burn")],programId): Derives a PDA from seeds and the program ID and returns the address with its canonical bump.
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 |
|---|---|---|
eldoria_battlestorm_main | npm run start | ts-node client/main.ts |
solana_nft | npm run start | nodemon --exec ts-node src/server.ts |
solana_nft | npm run build | tsc |
solana_nft | npm run test | echo "Error: no test specified" && exit 1 |
What you could build from it
- Fork the SuperStack copy and extend it within the Other gaps listed on the idea page.
- Learn the pattern first: Program Derived Addresses (PDAs)
- Learn the pattern first: Cross-Program Invocations (CPIs)