Solana glossary / Discriminator

Discriminator

Definition

A short prefix stored at the start of an account or instruction that identifies its type. Anchor adds discriminators automatically to prevent one account type from being passed in place of another.

Why it matters

Without a type check, an attacker can pass an account of one type where another is expected, a bug known as type cosplay. Anchor handles this by default; native programs must implement it themselves.

What to check

Related terms

Guides

Get an indicative price range and timeline for auditing your Solana programs, then compare verified auditors.

Estimate your audit cost →

← All Solana terms