Skip to main content
Reads use getAccountInfo or getMultipleAccounts with base64 encoding. Check the account’s owner, byte length and first-byte discriminator before decoding. An absent account is returned as null.

PDA seeds

Encode seed labels as UTF-8, song IDs and indexes as u64 little-endian, and addresses as their raw 32 bytes. The Remix authority address uses ['remix_authority'] under the Remix program ID. It is a PDA signer used by the purchase and variation instructions, not a wallet your project needs to create. Derive a song address with Kit’s u64 encoder; no string conversion or decimal text goes into the seed:
Use factoryProgram and rpc from Programs stack.

Song account

Owner: Factory. Length: 280 bytes. Discriminator: 2.

License record

Owner: Factory. Length: 48 bytes. Discriminator: 4. Song ID is at offset 8; the user’s 32-byte address is at offset 16. Derive the address for the original and buyer. A valid record confirms ongoing rights. Check that the decoded song ID and user match your request. Zero remaining allocation does not invalidate a purchased license.

Remix records

Owner: Remix. If the count account is absent, the original has no registered variations. Otherwise, fetch record indexes from 0 through count - 1. Validate each record’s original ID and index, then read its variation song account.

Configuration accounts

Each config has discriminator 1 and belongs to its named program. Addresses occupy 32 bytes. Counters use u64 little-endian. The Factory authorized-consumer record is 40 bytes with discriminator 3 and consumer address at offset 8. The common state source defines these layouts.

Read and validate accounts

For the songAddress derived above, fetch the bytes and check the public layout before reading fields:
Use the same owner, length and discriminator checks for the other layouts above. For a license, derive ['license', getU64Encoder().encode(songId), getAddressEncoder().encode(buyer)] under Factory. Check the 48-byte record’s ID at 8 and buyer at 16; a missing record means no rights. getAddressEncoder is exported by Kit.

Common instruction errors

Solana reports these as custom program errors. Decode the number in a failed transaction’s logs: See the error definitions for the full list. A failed transaction can still consume its network fee.