StakePoint

Solana DeFi Glossary

Definitions of key terms used in Solana DeFi, token locking, LP locking, and staking. Published by the StakePoint team.

Glossary/Account Discriminator

Account Discriminator

An 8-byte prefix added to Anchor program accounts to identify their type.

Definition

An account discriminator is an 8-byte hash prefix added to the beginning of every account created by an Anchor smart contract. The discriminator identifies which type of account it is — for example, a lock account versus a staking position account.

Discriminators are derived by hashing the account type name. When an Anchor program reads an account, it verifies the discriminator matches the expected type before processing it. This prevents type confusion attacks where malicious accounts could be passed as legitimate ones.

Account discriminators are an Anchor-specific security feature. They are automatically added and verified by the framework, providing an additional layer of type safety on top of Solana's core account model.

StakePoint & Account Discriminator

All StakePoint lock accounts and staking position accounts are Anchor accounts with discriminators. This ensures type safety — the StakePoint program will reject any incorrectly formatted account before processing it.

Frequently Asked Questions

What is an account discriminator in Anchor?

An account discriminator is an 8-byte prefix added to Anchor program accounts that identifies their type and prevents type confusion attacks.

Are StakePoint accounts protected by discriminators?

Yes. All StakePoint lock and staking accounts use Anchor discriminators for type safety.