A decentralized donation infrastructure built on Solana using Anchor. SolanaAid enables anyone to register NGOs, create donation pools, receive donations, and track on-chain giving—all with transparent, verifiable program logic and client tooling.
-
NGOs register on-chain via a deterministic PDA.
-
Each NGO has metadata including name, authority, and approval state.
-
Pools are created with a unique u64 ID.
-
Each pool is a PDA derived as:
seeds = [b"pool", id.to_le_bytes()] -
Pool metadata includes NGO owner, name, donation stats, and bump.
-
Anyone can donate SOL to a pool.
-
Funds are sent directly to the NGO’s vault PDA or authority.
-
Global config PDA storing allowed pools, NGO approvals, and global settings.
-
Only program authority can approve/deny NGOs or modify system settings.
-
Uses the Anchor-generated IDL types (
target/types/solana_aid.ts). -
Helper scripts to derive PDAs, fetch pool data, approve NGOs, list donations, etc.
const [ngoPda] = PublicKey.findProgramAddressSync(
[Buffer.from("ngo"), ngoAuthority.toBuffer()],
program.programId
);
const [poolPda] = PublicKey.findProgramAddressSync(
[Buffer.from("pool"), new BN(id).toArrayLike(Buffer, "le", 8)],
program.programId
);
const [configPda] = PublicKey.findProgramAddressSync(
[Buffer.from("config")],
program.programId
);
anchor build
anchor test
anchor build anchor deploy --provider.cluster devnet
anchor idl add <PROGRAM_ID>
export ANCHOR_PROVIDER_URL=https://api.devnet.solana.com
export ANCHOR_WALLET=$HOME/.config/solana/id.jsonnpx ts-node scripts/[script]-
All admin-only instructions require the admin PDA as signer.
-
PDA derivation prevents collisions and spoofing.
-
NGOs cannot spend funds from unauthorized pools.
-
Donations are atomic and logged on-chain.
-
Handles global program configuration.
-
Derives the Config PDA
-
Provides helpers to:
-
Fetch the global config account
-
Decode config fields with generated IDL types
-
Display admin address, allowed pools, and system metadata
-
-
Utility functions for working with NGOs on-chain.
-
Derives the NGO PDA
-
Fetches NGO metadata accounts
-
Provides helpers for:
-
Creating NGO accounts (if handled client-side)
-
Fetching name, authority, approval status
-
Displaying NGO information in a human-readable format
-
-
Client script for modifying NGO metadata.
-
Handles updating an NGO’s fields such as:
-
Name
-
Description
-
Display data
-
-
Wraps Anchor RPC calls for the modifyNgo instruction
-
Ensures PDAs are derived consistently before invocation
-
Handles everything related to donation pools.
-
Derives Pool PDA from id: u64
-
Fetches/deserializes pool account data
-
Displays pool metadata:
-
Pool name
-
NGO owner
-
Total donations
-
-
Includes helper wrappers for:
-
Creating pools
-
Fetching all pools associated with a given NGO
-
-
Script for performing a donation.
-
Wraps the RPC call for the donate instruction
-
Accepts:
-
Pool ID
-
Donation amount (SOL or lamports)
-
-
Derives pool PDAs automatically
-
Prints transaction signature + post-donation pool stats
-
Allows NGOs to withdraw funds from their pools.
-
Wraps the RPC call for withdraw
-
Handles deriving:
-
Pool PDA
-
NGO PDA
-
-
Ensures only NGO authority can withdraw
-
Prints transaction receipt and updated pool balance