Prepare the transaction
Use the RPC, signer and program IDs from Programs stack. Read the original’s song account and verify its creator and metadata URI against the song you selected. It must be a remixable original. Check the buyer’s license record before requesting payment. Build the instruction with the data and ordered accounts below, then use the simulation and signing sequence. These operations require a deployment with license and variation permissions enabled.Instruction 4: buy license
Data is exactly 9 bytes: first byte4, followed by the original song ID as u64 little-endian:
originalSongId to the verified original’s u64 ID. The buyer needs SOL for fees and rent, plus enough of the configured token for a priced license.
One purchase reduces allocation by one and records rights for that buyer. An existing buyer is not charged again. A zero-price license skips token transfers. A failed purchase leaves payment and rights unchanged.
Purchase accounts, in order
Purchase accounts, in order
All three token accounts must use the configured mint. Derive the program accounts with the PDA reference. Read the mint and treasury from Royalties config, and the creator from the original song. For classic SPL associated token accounts, use Kit-compatible
findAssociatedTokenPda and getCreateAssociatedTokenIdempotentInstruction from @solana-program/token; create missing accounts before the purchase instruction.Instruction 1: register variation
Encode the data using Kit’s codecs.
metadataUri is the finished variation’s IPFS URI:
licenseAmount and licensePrice. A variation is always non-remixable. The signer must already hold rights for the original, even when the original’s allocation is exhausted. Registering a variation does not charge the license price again.
Variation accounts, in order
Variation accounts, in order
Read Factory’s
nextSongId and the original’s current remix count before deriving the new addresses. The first remix-record index is 0.Read variations
Remix config holds the total variation count. Each original has its own count account and indexed records containing the new song ID and remixer. The account reference gives seeds and offsets. Logs includeLicensePurchased and SongRemixed. Read the confirmed license record or song account to verify the result.
Configuration instructions
Configuration instructions
Byte
0 initializes Remix config once. Byte 2 updates Factory and Royalties program references; byte 3 transfers the administrator. The latter two require the current administrator. Your integration reads this configuration and uses its existing references.