Skip to main content
Factory stores each original or variation in a song account. The creator signs original registration and later price or metadata updates.

Register an original

Use rpc, factoryProgram, systemProgram, signer and AccountRole from Programs stack. Read the current next ID, derive its song address and encode the mint fields:
metadataUri is your final IPFS metadata URI. This example registers a remixable original with 20 licenses at 5 USDC and a stored rate of 0.01 USDC:
Send the instruction, then read songAddress. Confirm the ID and URI, creator equals signer.address, isRemix = false and parent ID is 0. Store the confirmed song ID separately from its transaction signature.

Instruction 1: mint song

The first byte is 1. Append these fields in order: Pass accounts in this order: Read nextSongId from Factory config immediately before building. Another mint may use it first. After a confirmed seed conflict, read the latest ID and rebuild. If confirmation is uncertain, look up the saved signature before retrying.

Update a song

Read the song to confirm its creator is your signer. Encode a price update with the Kit codecs already imported above:
Use pricingInstruction as instruction in the send sequence. Read the confirmed prices afterward. For a metadata update, keep the same accounts and encode the fields shown below, checking the URI byte length first. Both instructions use exactly two accounts: the creator signer (readonly) followed by the song PDA (writable). Metadata uses the same 200-byte limit. The signer must match the song account’s creator. Price changes preserve previously purchased rights.

Read songs and rights

Use the account reference for song reads and license checks. It gives each PDA’s seeds, owner, field offsets and layout checks. Logs identify SongMinted, RemixMinted and LicenseConsumed. Confirm state from the accounts; program logs are text, not EVM event topics.
These are part of the public source interface, but are not caller setup steps for an integration:Use Remix’s public purchase and variation instructions instead of calling 2 or 3 directly. The source defines their full account and data layouts.
Factory program source · Program IDs