I'm trying to work out how an NFT collection might be sold on Cardano in the future, specifically by making use of smart contracts.
Let's say that I am creating a 10k pfp collection or something of the sort where each NFT has different attributes and therefore there is some sort of rarity distribution. As the creator of the project I can mint all 10k NFTs and transfer them over to a smart contract. For simplicity we'll say there is one NFT per transaction, so I have 10k UTXOs sitting at my smart contract with 1 NFT each.
When someone comes along to purchase an NFT, how can I make it so they are distributed a random NFT. Since they construct the transaction off the blockchain, they can just select the rarest available NFT.
I am able to come up with a mechanism where I might be able to sell placeholder "redeemable" NFTs that people can purchase and send back to the smart contract, but that would require me to then create a transaction on my end where I consume the buyer's placeholder NFT and one of the unpurchased NFT UTXOs to eventually send the buyer their asset. I don't like this solution because the final transaction, the one executed by the creator to send the NFT, can be executed by off-chain code that isn't transparent to the buyers, which would allow for it to rigged or otherwise incorrect in some way, and the buyer's would be unaware.
I apologize if this is the wrong venue for this question, but I'm eager to start writing Plutus code.