Bitcoin Forum
May 08, 2024, 03:49:25 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to confirm that bitcoins have been transferred? (Android Bitcoin Game)  (Read 742 times)
hal_jordan (OP)
Newbie
*
Offline Offline

Activity: 5
Merit: 0


View Profile
March 23, 2017, 03:52:41 PM
 #1

Hello, Bitcoin community. I am developing an android application using Unity Engine.
There are in-app purchases inside this application (items, gamepoints) that user would buy for the btc.
I have few questions about payment confirmations. Let's say I can generate link similar to "bitcoin://12A1MyaddResshRAZEqofac5jCQQjwEPBu?amount=1.00" to parse it by any android btc wallet. But how to get a confirmation that payment has been sent/received? How to make this confirmation safe and secure?
Maybe another approach?
1715183365
Hero Member
*
Offline Offline

Posts: 1715183365

View Profile Personal Message (Offline)

Ignore
1715183365
Reply with quote  #2

1715183365
Report to moderator
In order to get the maximum amount of activity points possible, you just need to post once per day on average. Skipping days is OK as long as you maintain the average.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715183365
Hero Member
*
Offline Offline

Posts: 1715183365

View Profile Personal Message (Offline)

Ignore
1715183365
Reply with quote  #2

1715183365
Report to moderator
achow101
Staff
Legendary
*
Offline Offline

Activity: 3388
Merit: 6631


Just writing some code


View Profile WWW
March 23, 2017, 03:54:54 PM
 #2

You should check whether the transaction has been confirmed, i.e. it has been included in a block.

Most wallets that you would use for this will tell you whether the transaction has been confirmed and how many confirmations it has.

cloverme
Legendary
*
Offline Offline

Activity: 1512
Merit: 1057


SpacePirate.io


View Profile WWW
March 23, 2017, 04:05:52 PM
 #3

In short, you're going to want to generate a bitcoin address for the purchase and record the value you expect. Then you want to watch for when the transaction has been confirmed on the blockchain. There are a couple of methods to do the later, either check the amount received by that address on a recurring basis or setup a node to run a script when that address has received a value. You can also use a 3rd party to do the transaction for you, there are payment API's offered by several companies. The trade-off to using them is of course, trust.

This thread has a lot of information that you might find helpful with your app:
https://bitcointalk.org/index.php?topic=990348.0
hal_jordan (OP)
Newbie
*
Offline Offline

Activity: 5
Merit: 0


View Profile
March 23, 2017, 04:12:33 PM
 #4

You should check whether the transaction has been confirmed, i.e. it has been included in a block.

Most wallets that you would use for this will tell you whether the transaction has been confirmed and how many confirmations it has.

So my application has to connect to android btc walelt?
For example https://play.google.com/store/apps/details?id=de.schildbach.wallet&hl=en
Still few questions:
1. Where my app can get Transaction ID to check its status? (I suppose only manual enter by user).
2. I am not sure that there is programming interface in this wallet to interact with another apps. My goal is to get payment confirmation programatically.
achow101
Staff
Legendary
*
Offline Offline

Activity: 3388
Merit: 6631


Just writing some code


View Profile WWW
March 23, 2017, 04:43:44 PM
 #5

So my application has to connect to android btc walelt?
For example https://play.google.com/store/apps/details?id=de.schildbach.wallet&hl=en
Not necessarily. Presumably you, as the app developer, are operating your own servers with players' account information so that you can unlock their purchases after they pay. Your server should be running its own wallet, and it can check its own wallet to see if a payment has confirmed.

Still few questions:
1. Where my app can get Transaction ID to check its status? (I suppose only manual enter by user).
You should be checking it on your own servers and informing the app that the payment has confirmed. Your own servers should be handing out a new address for every single purchase so that it is easier to track people's payments to you. All you need to do is watch for transactions for each address, and then notify the app when those transactions confirm.

2. I am not sure that there is programming interface in this wallet to interact with another apps. My goal is to get payment confirmation programatically.
Again, your servers check this, and then relay the information to the app. The app should not be looking for this information itself.

Tesorex
Full Member
***
Offline Offline

Activity: 204
Merit: 100



View Profile
March 23, 2017, 07:41:25 PM
 #6

Maybe you could use blockchain.info wallet and addresses and benefit from their notifications by e-mail or sms upon receiving and use api to see the first confirmation in a block.
btc_enigma
Hero Member
*****
Offline Offline

Activity: 688
Merit: 567


View Profile
March 24, 2017, 07:24:39 AM
 #7

An easier way would be listen to websocket notification on your address and you will now when the tx has arrived.
You can use Blockchain.info API / blockonomics API .

nekochan
Newbie
*
Offline Offline

Activity: 12
Merit: 0


View Profile
March 24, 2017, 04:33:30 PM
 #8

Well I'd recommend using some 3rd party API and wait for at least 3 confirmation so it's sure that the btc has arrived.You could also run a wallet and check it periodically whether new transactions have arrived and if they did then track them until 3 comfirmation then you can be sure that it's arrived.
pcoin
Sr. Member
****
Offline Offline

Activity: 364
Merit: 250


View Profile
March 25, 2017, 07:32:12 AM
 #9

This is a nice project and i will like to play the game when launched.
In order to get a better assistance you need to answer some questions
1, will you have only one btc address for the game?
2, Does every user have their own unique btc address?
3, Will those btc address(es) be static or dynamic ?
You can check the codes here https://blockchain.info/api/api_websocket
Let me know if this does not solve the problem.
AT101ET
Legendary
*
Offline Offline

Activity: 3080
Merit: 1348


View Profile
March 26, 2017, 06:03:20 AM
 #10

From a technical side, I would say that you'd have to incorporate some code that would fetch data to check if the wallet has been funded.
One way to do this would be to auto-generate new wallets for every transaction and have the script check for 1-3 confirmations before verifying the payment. Thatvway no two transactions would get mixed up in the system. The Bitcoin transaction themselves would act as a unique payment ID in that sense.

From a practical side however, I would say that given the lengthy transaction times, is it worthwhile for your app? As much as I'm pro BTC, I can't see many people waiting 30+ minutes for an in-app purchase to process. That's just something to consider (unless you opt to go for a very high fee per every transaction but that would make the in-app purchases even pricier).
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!