Bitcoin Forum
May 11, 2024, 06:01:20 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Can I do the following using JSON-RPC ?  (Read 1314 times)
BitCoinDream (OP)
Legendary
*
Offline Offline

Activity: 2324
Merit: 1204

The revolution will be digital


View Profile
August 08, 2014, 02:12:26 PM
 #1

Suppose I am running a Bitcoin node on a VPS. Can I do the following using JSON-RPC ?

1. Generate a new address.

2. Get notified when there is a balance on this address. (If possible, know the confirmations too)

3. Send the balance from this generated address to a certain address.


1715407280
Hero Member
*
Offline Offline

Posts: 1715407280

View Profile Personal Message (Offline)

Ignore
1715407280
Reply with quote  #2

1715407280
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
Nick.Fury
Member
**
Offline Offline

Activity: 76
Merit: 10


View Profile
August 08, 2014, 02:45:22 PM
 #2

yes.

php-script + cron-job
mcaizgk2
Member
**
Offline Offline

Activity: 66
Merit: 10


View Profile
August 08, 2014, 04:21:55 PM
 #3

Suppose I am running a Bitcoin node on a VPS. Can I do the following using JSON-RPC ?

1. Generate a new address.

2. Get notified when there is a balance on this address. (If possible, know the confirmations too)

3. Send the balance from this generated address to a certain address.



1. Use the getnewaddress RPC command to generate a new address.

2. Use the walletnotify facility to get instant notification on incoming payments for your address(es). More on that: https://bitcointalk.org/index.php?topic=203438.0. RPC command listreceivedbyaddress will also return the number of confirmations for the most recent transactions included.

3. Use the sendtoaddress command to send any balance to another address.
BitCoinDream (OP)
Legendary
*
Offline Offline

Activity: 2324
Merit: 1204

The revolution will be digital


View Profile
August 09, 2014, 07:03:17 PM
 #4

Suppose I am running a Bitcoin node on a VPS. Can I do the following using JSON-RPC ?

1. Generate a new address.

2. Get notified when there is a balance on this address. (If possible, know the confirmations too)

3. Send the balance from this generated address to a certain address.



1. Use the getnewaddress RPC command to generate a new address.

2. Use the walletnotify facility to get instant notification on incoming payments for your address(es). More on that: https://bitcointalk.org/index.php?topic=203438.0. RPC command listreceivedbyaddress will also return the number of confirmations for the most recent transactions included.

3. Use the sendtoaddress command to send any balance to another address.

Thank u for the step by step explanation. Suppose the node I'm running is 107.161.179.97:8333. How do  write the exact JSON-RPC query to get a new address from this node ?

mcaizgk2
Member
**
Offline Offline

Activity: 66
Merit: 10


View Profile
August 09, 2014, 07:31:49 PM
 #5

The bitcoin server need to be properly configured in order to accept RPC commands.

1. Locate your bitcoin.conf file (https://en.bitcoin.it/wiki/Running_Bitcoin#Bitcoin.conf_Configuration_File, if it's not there just go ahead and create it) and add these lines:

rpcuser = MyRpcUsername
rpcpassword = MyRpcPassword
server = 1


Since you will be hitting a server outside your LAN you also need to add the rpcallowip = YourClientsIpHere parameter to your bitcoin.conf.

2. Run bitcoind (or simply run the Qt client)

3. Use an RPC library of your choice to connect to the RPC server.

For example, using BitcoinLib the script you need to generate a new address is:

IBitcoinService BitcoinService = new BitcoinService();
String newAddress = BitcoinService.GetNewAddress();




kerimk2
Full Member
***
Offline Offline

Activity: 140
Merit: 100

ACCOUNT BANNED. Email in sig!!


View Profile
August 11, 2014, 05:13:33 AM
 #6

Yes
Make a cronjob which checks the balance of the address (you can do this with php), and if($walletbalance > 0) sendfrom($myaddress, $addresstosendto, $walletbalance). I could do it in a couple seconds, its really easy. Make the cron run every 15 seconds and you will be good to go.

If you need support for AutoPonzi contact: autoponzi@gmail.com
We aren't sure how long the ban is for. We aren't even sure why we are banned. But we'll try figure it out
BitCoinDream (OP)
Legendary
*
Offline Offline

Activity: 2324
Merit: 1204

The revolution will be digital


View Profile
August 12, 2014, 03:03:41 PM
 #7

Yes
Make a cronjob which checks the balance of the address (you can do this with php), and if($walletbalance > 0) sendfrom($myaddress, $addresstosendto, $walletbalance). I could do it in a couple seconds, its really easy. Make the cron run every 15 seconds and you will be good to go.

U r wrong. U should not run a cron at every 15 sec to check address balance. That is unnecessary wastage of server resources.

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!