Add bitcoin funds to java app utilizing BitcoinJ

0
81
Add bitcoin funds to java app utilizing BitcoinJ


Not likely for BitcoinJ, however a common strategy.

You generate new handle for each person you register. Retailer it in your DB with the userID for future reference.

Create a getAPI taking a String enter. use your API endpoint and open the Bitcoin.conf file.

walletnotify=curl <your API>

If you wish to have affirmation logic as nicely, it’s possible you’ll want another getAPI, and get the endpoint. then replace your bitcoin.conf file once more with following:

blocknotify=curl <your Block API> 

Now when person makes the deposit to the handle you generated, Bitcoin node will notify your app by calling the pockets notify API. You get the transaction hash. Use that txHash and make a Put up name to your daemon with RPc command:

getTransaction <txHash>

Now you will have total transaction object to seek out which person has made the deposit.

Free tip: Bitcoin node calls walletnotify two instances:

  1. When a transaction is added to the chain.
  2. When that transaction receives first affirmation.

If you do not need a couple of affirmation, then blockNotify is just not wanted.

If you would like a sensible instance, you possibly can examine my Github repo, the place I’ve carried out it. It is not based mostly on BitcoinJ however the logic stays the identical:

https://github.com/kunalbarchha/generic-wrapper-for-bitcoinforks

LEAVE A REPLY

Please enter your comment!
Please enter your name here