Author

Topic: Can I do the following using JSON-RPC ? (Read 1333 times)

legendary
Activity: 2394
Merit: 1216
The revolution will be digital
August 12, 2014, 10:03:41 AM
#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.
full member
Activity: 140
Merit: 100
ACCOUNT BANNED. Email in sig!!
August 11, 2014, 12: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.
member
Activity: 66
Merit: 10
August 09, 2014, 02: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();




legendary
Activity: 2394
Merit: 1216
The revolution will be digital
August 09, 2014, 02: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://bitcointalksearch.org/topic/how-to-use-walletnotify-203438. 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 ?
member
Activity: 66
Merit: 10
August 08, 2014, 11:21:55 AM
#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://bitcointalksearch.org/topic/how-to-use-walletnotify-203438. 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.
member
Activity: 76
Merit: 10
August 08, 2014, 09:45:22 AM
#2
yes.

php-script + cron-job
legendary
Activity: 2394
Merit: 1216
The revolution will be digital
August 08, 2014, 09:12:26 AM
#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.

Jump to: