Skip to content

​What Are Group and Group Member Extensions?

A group is a mint that represents a collection. A group member is a mint that belongs to that collection. Use these extensions when one mint should represent the collection and other mints should represent items that belong to it. The Token Extension Program can store token group data directly on a mint with four related extensions:
  • GroupPointer points a mint at the account that stores the group’s data.
  • TokenGroup stores the group data itself, including the update authority, current size, and maximum size.
  • GroupMemberPointer points a mint at the account that stores the member’s data.
  • TokenGroupMember stores the member’s group address and member number.
GroupPointer and GroupMemberPointer can reference any account owned by a program implementing the Token group interface. The Token Extension Program also implements that interface directly through the TokenGroup and TokenGroupMember mint extensions.

​Before you start

The examples on this page run against a local validator at http://localhost:8899 (WebSocket ws://localhost:8900) and fund their accounts with airdrops from it. Start one in a separate terminal with Surfpool (surfpool start) or solana-test-validator. Each code section below lists the packages or crates it needs. The TypeScript examples use top-level await, so run them as ES modules, for example with npx tsx index.ts in a project whose package.json sets "type": "module".

​How to Create Groups and Members Stored on the Mint Account

To create groups and members stored on the mint account:
  1. Create a group mint account and initialize GroupPointer.
  2. Initialize the group mint with InitializeMint.
  3. Initialize TokenGroup on that same mint.
  4. Create a member mint account and initialize GroupMemberPointer.
  5. Initialize the member mint with InitializeMint.
  6. Initialize TokenGroupMember on that same mint so it references the group mint.
1

Calculate group mint size and rent

Calculate the size and rent needed for the group mint.
Example
2

Create and Initialize Group Mint

Create the group mint account, initialize GroupPointer, initialize the mint, and initialize TokenGroup in one transaction.
Example
3

Calculate member mint size and rent

Calculate the size and rent needed for the member mint.
Example
4

Create and Initialize Member Mint

Create the member mint account, initialize GroupMemberPointer, initialize the mint, and initialize TokenGroupMember in one transaction.
Example
Pointers and Instruction OrderGroupPointer and GroupMemberPointer store the account address where the group or member data lives. TokenGroup and TokenGroupMember store the actual group or member data.GroupPointerInstruction::Initialize and GroupMemberPointerInstruction::Initialize must come before InitializeMint. TokenGroupInstruction::InitializeGroup and TokenGroupInstruction::InitializeMember must come after InitializeMint. For each mint, CreateAccount, the pointer initialize instruction, and InitializeMint must be included in the same transaction.

​Source Reference

GroupPointer and GroupMemberPointer are pointer instructions in the Token Extension Program. TokenGroup and TokenGroupMember follow the Token group interface, which the Token Extension Program implements.

​Group Pointer and Group Member Pointer

ItemDescriptionSource
GroupPointerMint extension that stores the authority and address for the account that stores a group’s data.Source
GroupMemberPointerMint extension that stores the authority and address for the account that stores a member’s data.Source
GroupPointerInstruction::InitializeInitializes the group pointer extension before InitializeMint.Source
GroupPointerInstruction::UpdateUpdates the group address stored by the mint’s GroupPointer extension.Source
GroupMemberPointerInstruction::InitializeInitializes the group member pointer extension before InitializeMint.Source
GroupMemberPointerInstruction::UpdateUpdates the member address stored by the mint’s GroupMemberPointer extension.Source
process_initialize (GroupPointer)Writes the initial GroupPointer authority and group address onto the mint.Source
process_update (GroupPointer)Validates the group pointer authority, then rewrites the mint’s stored group address.Source
process_initialize (GroupMemberPointer)Writes the initial GroupMemberPointer authority and member address onto the mint.Source
process_update (GroupMemberPointer)Validates the group member pointer authority, then rewrites the mint’s stored member address.Source

​Token Group and Token Group Member

ItemDescriptionSource
TokenGroupToken group interface state stored on the mint, including the update authority, current size, and maximum size.Source
TokenGroupMemberToken group member interface state stored on the mint, including the member mint, group address, and member number.Source
TokenGroupInstruction::InitializeGroupToken group interface instruction supported by the Token Extension Program to initialize a new group for an already initialized mint.Source
TokenGroupInstruction::UpdateGroupMaxSizeToken group interface instruction supported by the Token Extension Program to update the maximum number of members allowed in a group.Source
TokenGroupInstruction::UpdateGroupAuthorityToken group interface instruction supported by the Token Extension Program to rotate or clear the group’s update authority.Source
TokenGroupInstruction::InitializeMemberToken group interface instruction supported by the Token Extension Program to initialize a new member for an already initialized group.Source
process_initialize_groupValidates the mint, checks that GroupPointer is present, and allocates the TokenGroup state on the group mint.Source
process_update_group_max_sizeValidates the current update authority, then updates the group’s maximum size.Source
process_update_group_authorityValidates the current update authority, then rotates or clears the group’s update authority.Source
process_initialize_memberValidates the member mint and group authority, increments the group size, and allocates the TokenGroupMember state on the mint.Source

​Kit

These examples use the generated Token-2022 instructions directly.
Terminal
Instructions

​Web3.js v3

These examples use the class-based @solana/web3.js v3 API with @solana-program instruction builders.
Terminal
Instructions

​Rust

Add these dependencies to Cargo.toml (tested with Rust 1.89, 1.98, and 1.99):
Cargo.toml
Rust

​Web3.js (legacy)

These examples use legacy @solana/web3.js with @solana/spl-token, including its token group helpers.
@solana/web3.js 1.x is no longer actively maintainedIt receives critical fixes only. Use Kit for new code. To migrate existing code, follow the Kit upgrade guide, or the web3.js v3 migration guide to keep the class-based API.To run this code, install 1.x with npm install @solana/web3.js@1. A plain npm install @solana/web3.js installs v3, which this code doesn’t run on.
Terminal
Instructions