I'm currently trying to build a game where if the user reaches a certain amount of points they get rewarded with btc at the end of the game. But the thing is I would like the QR code to show up on the screen and the user would just have to scan it and they would receive the btc. Is there an application that can do such a thing? I'm guessing it would show the private key of the qr code. But is there a better method of doing this?
You would have to do this in a couple of steps, the first of which doesn't involve Bitcoin at all.
- User scans QR code using an app you provide.
- Your provided app sends a request to your server. This request contains something that identifies the user (say, the user's Bitcoin address).
- Your server sends Bitcoin to the user's address.
Having said that, if you already have the user's Bitcoin address, then you should consider skipping the QR code entirely and proceed directly to step 3.
You are correct that the QR code would be of the wallet's private key. But for obvious reasons, you would need to generate a new address and private key for each user, otherwise, people would be sharing wallets together. You would need to load each wallet before displaying its private key in QR code format by sending funds to the wallet's address.
There are bitcoin wallet apps on both Android and iOS that can import a wallet by scanning a private key QR code. The players of your game would need to download one of these apps to do this though, so that might be a small hurdle. This may not be the best way to distribute bitcoin to your users for two main reasons:
1) You would be able to move funds out of the wallets of your users, even after they've imported the wallet themselves. I'm not saying you would do this, but you could.
2) Whether the private keys come packaged with the game files or the game contacts a server to retrieve the private keys, they may be susceptible to theft.
It might be smarter to let the users input their Bitcoin address, and have your server send the bitcoins, instead. This is safer and requires zero trust between you and the users. There is no possibility of theft perpetrated by you or other users of the game, as long as the funds are not in a hot wallet.