Bitcoin Forum
May 05, 2024, 07:58:36 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Bitcoin API receiving payments  (Read 683 times)
MegaCookie (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
January 14, 2014, 06:26:16 PM
Last edit: January 16, 2014, 03:22:55 PM by MegaCookie
 #1

Hello,

I want to make a similar function like Blockchain's receive payments API but with my own Bitcoin server (https://blockchain.info/api/api_receive). It should generate a new Bitcoin address for the user and if they send the BTC to that address it will notify the user of the amount of confirmations. When the transaction has 6 confirmations then notify the user and move the received Bitcoins to the main account. They can also use the same Bitcoin address again.

I was thinking of this:
1. Generate a Main Bitcoin address for the application and label it.
2. Generate a Bitcoin address for the user: getnewaddress(account=UniqueUserID)
3. In a 5min cronjob check all the transactions for the User's Bitcoin accounts and if an account receives BTC than store the amount&transactionID and the account etc.: listtransactions()
4. In the same cronjob check for confirmations and notify it to the user: gettransaction(TransactionID)
5. If there are 6 confirmations then notify the user and move the received Bitcoins to the main account: move(UniqueUserID, MainBTCAccount, ReceivedBitcoins, minconf=6, comment='Transaction from:'.UniqueUserID)

So will this work?
And do I need a cronjob in step 5? or is one time calling the move command enough?

Thanks in advance!
1714939116
Hero Member
*
Offline Offline

Posts: 1714939116

View Profile Personal Message (Offline)

Ignore
1714939116
Reply with quote  #2

1714939116
Report to moderator
1714939116
Hero Member
*
Offline Offline

Posts: 1714939116

View Profile Personal Message (Offline)

Ignore
1714939116
Reply with quote  #2

1714939116
Report to moderator
"In a nutshell, the network works like a distributed timestamp server, stamping the first transaction to spend a coin. It takes advantage of the nature of information being easy to spread but hard to stifle." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
piggybank
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
January 14, 2014, 09:02:22 PM
 #2

Probably.... but are you sure you really want to be generating a new address to send bitcoins to and store the private key on a server connected to the internet? What happens if the server gets hacked and you lose your wallet?
MegaCookie (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
January 14, 2014, 09:36:24 PM
 #3

Yea that's a good problem but what should you suggest if I need to send Bitcoins as well?
piggybank
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
January 14, 2014, 09:45:53 PM
 #4

Store the majority of the bitcoins offline. Only keep a small amount online. Only transfer to the online wallet when the balance gets low.

Otherwise your really going to be lining yourself up to be the next bad bitcoin news when you get hacked and lose the lot.
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!