Week 3 Anchor setup for the BlockBite token distribution program. This repository also contains the existing Next.js game frontend, but the Week 3 grading focus is the reproducible Anchor program setup.
| Requirement | Status |
|---|---|
| Anchor project initialized | Done |
| Program compiles from source | Implemented; verify with anchor build |
Required handlers: create_stream, withdraw, cancel |
Done |
| Account structs matching the Week 2 architecture | Done |
| README with setup/build/deploy/test steps | Done |
| At least 1 test | Implemented: tests/deploy-smoke.js |
| CI builds and tests on push/PR | Implemented: .github/workflows/ci.yml |
| Partner verification | Pending: run the steps below on a fresh clone |
Install these tools before running the project:
| Tool | Version |
|---|---|
| Node.js | 18+ |
| Rust | stable |
| Solana CLI | stable |
| Anchor CLI | 0.32.1 |
Useful install references:
- Anchor installation: https://www.anchor-lang.com/docs/installation
- Solana CLI installation: https://docs.anza.xyz/cli/install
Verify the tools:
node --version
rustc --version
solana --version
anchor --versiongit clone https://github.com/nayrbryanGaming/blockblast.git
cd blockblast
npm install
solana config set --url localhost
solana-keygen new --no-bip39-passphrase
anchor keys sync
anchor buildanchor keys sync creates or syncs the local program keypair and updates Anchor.toml plus declare_id!. The build step then verifies the synced program ID.
anchor buildanchor testThe current smoke test checks that Anchor generated the IDL and that the required Week 3 instructions exist:
create_streamwithdrawcancel
solana config set --url devnet
solana airdrop 2
anchor keys sync
anchor build
anchor deploy --provider.cluster devnetAfter deployment, copy the deployed program ID from the deploy output into:
Anchor.tomlunder[programs.devnet]programs/blockbite-vesting/src/lib.rsindeclare_id!(...).env.localasNEXT_PUBLIC_VESTING_PROGRAM_ID, if the frontend needs it
Then rebuild:
anchor buildGitHub Actions workflow:
.github/workflows/ci.yml
The CI pipeline runs on pushes to main/master and on pull requests. It installs Rust, Solana CLI, Anchor CLI, creates a temporary wallet, syncs the local program keypair, then executes:
anchor build
anchor testThe separate Vercel workflow only handles frontend deployment and is not used as the Week 3 Anchor CI.
blockblast/
|-- Anchor.toml
|-- Cargo.toml
|-- programs/
| `-- blockbite-vesting/
| |-- Cargo.toml
| `-- src/
| `-- lib.rs
|-- tests/
| `-- deploy-smoke.js
`-- .github/
`-- workflows/
|-- ci.yml
`-- vercel.yml
Required Week 3 handlers:
| Handler | Current behavior |
|---|---|
create_stream |
Empty handler that compiles with the stream account shape |
withdraw |
Empty handler that compiles |
cancel |
Empty handler that compiles |
Account structs currently defined:
| Account | Purpose |
|---|---|
StreamAccount |
Stores stream authority, beneficiary, mint, vault, timing, and withdrawal state |
BeneficiaryProfile |
Tracks beneficiary-level stream metadata |
TreasuryVault |
Tracks protocol vault metadata |
ProtocolConfig |
Stores admin/configuration state |
WithdrawalRecord |
Stores withdrawal audit data |
Business logic is intentionally minimal for Week 3. Transfers, validation, cancellation rules, vesting math, and SPL token constraints belong in Week 4.
Run the existing Next.js app:
npm run devThen open http://localhost:3000.
- Devnet deployment is not claimed until
anchor deploy --provider.cluster devnetsucceeds and the real program ID is committed. - Partner verification should be updated only after a teammate confirms they can clone, build, test, and deploy by following this README.