I'm not sure how you would make vanity addresses work for this. You don't want to store an address for each user, and if you did you wouldn't need vanity addresses. If you force the user to create a vanity address, I don't see what they would do with it that would help you. It seems kind of bizarre to force them to transfer the coins to their own vanity address and then transfer them to you, so you can see the vanity address as the source.
One possibility is to publish a simple algorithm to convert their user name to a Bitcoin address (that nobody could claim). Then have them use the sendmany
API call to send the payment to you and a satoshi to their user name's corresponding Bitcoin address. You would receive the funds and then know what user to credit them to by decoding the address that had received a satoshi. This would waste one satoshi for each transfer.
There are really only two issues with this. First, it's a bit of a pain for your users. They can't use the GUI to send the funds since it doesn't support sendmany
. Second, the users have to be careful not to send the actual funds to the Bitcoin address corresponding to their user name. If they did, those coins would be lost forever. They need to understand that they should only send a tiny fraction of a Bitcoin to that address so as to 'mark' the transaction.
All in all, I think all the possible solutions are ugly and you should rethink the decisions that led you to these unusual requirements.