Bitcoin Forum

Bitcoin => Project Development => Topic started by: dtothemt on July 14, 2013, 02:31:53 AM



Title: Game development <--> Currency APIs?
Post by: dtothemt on July 14, 2013, 02:31:53 AM
I'm pretty new to BTC and other coinage being created. I want to create some games that use micropayments or perhaps some betting games.

I would like to know how to setup a payment system that applications (eg games), can interact with. Is there any kind of documented API that application developers can use?

Like for example if I wanted to take payments from players in a game, and credit their account with in-game currency that they can use for in-game purchases?


Title: Re: Game development <--> Currency APIs?
Post by: franky1 on July 14, 2013, 02:54:33 AM
depends if you want to link it to a bitcoin-qt, or blockchain.info wallet to control the fund inputs.

the laymans wording of what is required is
create a new bitcoin address when a user signs up to your service. log this public key on the members database and put the private key somewhere safe away from the game server.

have an api that checks the balance of the public keys and then adds value to the memebers balance in the game database.

blockchain.info has some great API's which can be used with their wallet to inform the game server that a payment has been made, aswell as sending commands to then sweep the funds to a more secure and private address away from possible hacks.

it may be best you seek advice in the developers sub forum. but this should also get you started
http://blockchain.info/api/blockchain_wallet_api


Title: Re: Game development <--> Currency APIs?
Post by: halfawake on July 14, 2013, 03:04:12 AM
Sounds like a great idea, though I agree this should probably be in the development forum.

I have a question though: why bother with a separate in game currency?  Why not just use bitcoin as the currency of the game?


Title: Re: Game development <--> Currency APIs?
Post by: dtothemt on July 14, 2013, 04:46:53 PM
Well, it might work as leaving it as BTC. I'm just concerned about security though. If someone hacks the in-game currency, they might wreak havoc in-game, but if someone manages to get into the BTC wallets, that'd be far more devastating.

Also, sorry about the wrong forum. If a mod would like to move this, that's fine. I was under the impression that the dev forum was strictly for BTC itself, and not other/related projects.


Title: Re: Game development <--> Currency APIs?
Post by: franky1 on July 14, 2013, 05:01:00 PM
Well, it might work as leaving it as BTC. I'm just concerned about security though. If someone hacks the in-game currency, they might wreak havoc in-game, but if someone manages to get into the BTC wallets, that'd be far more devastating.

Also, sorry about the wrong forum. If a mod would like to move this, that's fine. I was under the impression that the dev forum was strictly for BTC itself, and not other/related projects.

the actual bitcoin stays safe in offline wallets once you sweep them from users individual addresses.. so they are safe..but what the last person meant was rather then having the game DATABASE call the balance.. gold or rabbit credits.. how about just name them bitcoins or satoshi's depending on how much division you want.


Title: Re: Game development <--> Currency APIs?
Post by: coinprize on July 15, 2013, 01:52:48 AM
Check out here: https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)


Title: Re: Game development <--> Currency APIs?
Post by: Kris on July 15, 2013, 08:23:34 PM
So I am thinking that the purchase will happen in-game ? therefore we need some sort of overlay with an iframe to allow for the invoice to be shown. One could use BIPS embedded Invoice each time a player wants to purchase "gold" https://bips.me/embedded simply generate this invoice with a custom variable containing the players "user id".

https://cdn.bips.me/includes/embedded_mobile.png

However this would require a system able to receive Instant Payment Notifications from BIPS as to update the in-game currency.

Another way would be to create a C# framework, I have chosen C# as this is one of my main languages. This C# framework could be created as an dll to be included with say BIPS as namespace, and included in games. This would give the possibility of simple running:

BIPS.CreateInvoice(100, 'USD', 'Gold', 'userid', function(err, res) {

  /**
    Example response (Bitcoin address, and amount)
   */

  ShowInvoice(res.address, res.amount);

});

private function ShowInvoice(string[] address, double amount)
{
    /**
    Display a nice payment window to the user using DirectX Hardware Overlay.
   */
}



Title: Re: Game development <--> Currency APIs?
Post by: Xenland on July 16, 2013, 01:58:13 AM
There is always the http://bitcoindevkit.com It works with PHP and Bitcoin JSON or any JSON RPC bitcoin server like Blockchain.info there is a C++ version coming out in the future but for now you can link into the PHP CLI with your game :)