Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: bitcoinspot.nl on March 09, 2013, 10:29:56 AM



Title: Want to send bitcoins from the command-line in windows
Post by: bitcoinspot.nl on March 09, 2013, 10:29:56 AM
Hi everyone,

i am currently working on a bitcoin-faucet-like script that sends bitcoins to selected people.
I want to let the script send bitcoins from a batch-file at specified intervals.

I have searched for a client that can send bitcoins from the command-linne in windows, but sofar i havent succeeded.
Does anyone know a good windows-based bitcoin-client that can send bitcoins from the command-line ?

Thanks!
Roland.


Title: Re: Want to send bitcoins from the command-line in windows
Post by: CIYAM on March 09, 2013, 10:45:23 AM
The standard Satoshi client for Windows comes with bitcoind which acts as server and as an RPC client.

https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list


Title: Re: Want to send bitcoins from the command-line in windows
Post by: bitcoinspot.nl on March 09, 2013, 09:07:42 PM
ok but how do i send commands, sorry stupid question maybe, but i cant seem to do it trough the command line.

thanks in advance!


Title: Re: Want to send bitcoins from the command-line in windows
Post by: CIYAM on March 10, 2013, 12:50:22 AM
You need to have setup up at least rpcpassword in bitcoin.conf first then to start the daemon use "start bitcoind" and to test a command:

Code:
bitcoind -rpcpassword=password listtransactions

If you are wanting to use the RPC commands with bitcoind whilst bitcoin-qt is also running then add "server=1" into bitcoin.conf (then start bitcoin-qt first rather than bitcoind as a daemon).

I would also recommend adding "rpcallowip=127.0.0.1" so that external IP addresses cannot send RPC commands.


Title: Re: Want to send bitcoins from the command-line in windows
Post by: bitcoinspot.nl on March 10, 2013, 07:19:04 PM
ok thanks so much for the getting-started, once i got going it was quite easy!

I am now running a windows client that:
- gets mail out of a pop box
- gets the senders email and btc address
- send 0.001 btc to the sender
- sends the sender an email.

If anyone's interested how i did it, just let me know!

Thanks again!
Roland.


Title: Re: Want to send bitcoins from the command-line in windows
Post by: deepceleron on March 11, 2013, 12:45:36 AM
ok thanks so much for the getting-started, once i got going it was quite easy!

I am now running a windows client that:
- gets mail out of a pop box
- gets the senders email and btc address
- send 0.001 btc to the sender
- sends the sender an email.

If anyone's interested how i did it, just let me know!

Thanks again!
Roland.

I'm more interested in sending some emails to this email address!


Title: Re: Want to send bitcoins from the command-line in windows
Post by: bitcoinspot.nl on March 11, 2013, 07:15:26 AM
haha, i bet you are


Title: Re: Want to send bitcoins from the command-line in windows
Post by: Dabs on March 12, 2013, 08:16:33 AM
I'm interested. I want to make something that is semi-automated to do something similar but for a different service. I need to be able to get the balance, so there is getbalance, or listtransactions so I know if I got something back, or while I am waiting for coins sent to me to confirm. And of course, sending coins to an address.

I plan on using one of those Windows command line Basic compilers, since I have some experience with them, calling the bitcoin server (bitcoin-qt or bitcoind).

And of course, it has a lot of if-then-else statements to make sure I don't lose all my coins, or it sends too often or too fast.


Title: Re: Want to send bitcoins from the command-line in windows
Post by: bitcoinspot.nl on March 12, 2013, 08:46:56 AM
yeah i just made a batchfile that sends commands to bitcoind, works like a charm :)

if you need any help let me know.


Title: Re: Want to send bitcoins from the command-line in windows
Post by: Dabs on March 12, 2013, 03:53:11 PM
For the newbies out there, can you show us how? I was trying to get the command line to work, but I'm thinking I'm starting this wrong or my bitcoin.conf is missing something.

What I've been able to do is bitcoin-qt and typing in the debug console.


Title: Re: Want to send bitcoins from the command-line in windows
Post by: bitcoinspot.nl on March 12, 2013, 06:55:49 PM
Ok i put the whole batchfile here...
the batchfile gets data from a pop box and uses that to send coins and emails
i just keep it continously running om my windows machine.
see REM for the remarks.
At the end of the batchfile i call bitcoind.exe to send the bitcoins

This is what my bitcoin.conf looks like
Quote
server=1
rpcuser=xxxxxxx
rpcpassword=xxxxxxxxx
i keep my bitcoin-qt client running in the background


The batch file
Quote
@echo off
cls
set timeout=10

:_loop
REM call the external popclient program to get messages fro pop3 mailbox
c:\temp\popclient\popclient.exe -configfile c:\temp\popclient\democonfig.xml
REM process all the .txt files downloaded by popclient and call :_readfile for every file
for /f %%A in ('dir /B *.txt') do call :_readfile %%A
echo pause %timeout% sec ....
ping 100.100.100.100 -w 1000 -n %timeout% > nul
REM Back to the start
goto :_loop

::------------------------------------------------------------------------------------

:_readfile

set email=empty
set address=empty
set naam=empty

REM Get email data from the email file and put it in variables
REM in my setup i forward the mail and put em, ad and na in front of the name
REM address and email-adress and put that in the message
type %1 | find "em:" /I > %temp%\temp.txt
echo em:
type %temp%\temp.txt
echo ---
for /f "tokens=2 delims=:" %%a in (%temp%\temp.txt) do (@set email=%%a)
type %1 | find "ad:" /I > %temp%\temp.txt
echo ad:
type %temp%\temp.txt
echo ---
for /f "tokens=2 delims=:" %%a in (%temp%\temp.txt) do (@set address=%%a)
type %1 | find "na:" /I > %temp%\temp.txt
echo na:
type %temp%\temp.txt
echo ---
for /f "tokens=2 delims=:" %%a in (%temp%\temp.txt) do (@set username=%%a)

del %temp%\temp.txt

echo -----------------------------------------------------
echo %date% - %time%
echo file: %1
echo email: %email%
echo address: %address%
echo naam: %username%

pause


REM Put all the data in a logfile
echo ----------------------------------------------------- >> c:\temp\popclient\inbox\log.dat
echo %date% - %time%                                       >> c:\temp\popclient\inbox\log.dat
echo file: %1                                              >> c:\temp\popclient\inbox\log.dat
echo email: %email%                                        >> c:\temp\popclient\inbox\log.dat
echo address: %address%                                    >> c:\temp\popclient\inbox\log.dat
echo naam: %username%                                      >> c:\temp\popclient\inbox\log.dat
move %1 c:\temp\popclient\inbox\processed\

REM Call the bitcoin daemon and send the money to the adress retrieved fro the mail
"c:\Program Files (x86)\bitcoin\daemon\bitcoind.exe" -rpcpassword=xxxxxxxxxx sendtoaddress %address% 0.001 "0.001 naar %email%" "0.001 naar %email%" >> c:\temp\popclient\inbox\log.dat

echo beste %username% > %temp%\bericht.txt
type c:\temp\popclient\template.txt >> %temp%\bericht.txt

set subject="0.001 bitcoins - met de groeten van bitcoinspot.nl"

REM Send mail to email-adress retrieved from mail
c:\temp\popclient\blat %temp%\bericht.txt -to %email% -f z@x.com -subject %subject% -server x.x.nl > %temp%\temp.txt

type %temp%\temp.txt >> c:\temp\popclient\inbox\log.dat

del %temp%\bericht.txt

REM End of procedure, return to loop
goto :EOF

::------------------------------------------------------------------------------------


Title: Re: Want to send bitcoins from the command-line in windows
Post by: bitcoinspot.nl on March 12, 2013, 06:57:45 PM
@dabs: do you want to send me an email on webmaster@bitcoinspot.nl, i want to ask you something about the bitcoin megastore.

thanks!


Title: Re: Want to send bitcoins from the command-line in windows
Post by: Dabs on March 13, 2013, 04:16:39 AM
@bitcoinspot.nl: Someone bought my sig line for 0.1 BTC per month. I think the store sells tshirts, cafepress does a lot of tshirt printing (and other items) for anyone who has a design. I figured it was a good deal considering all I've been doing at other "faucets".


Title: Re: Want to send bitcoins from the command-line in windows
Post by: bitcoinspot.nl on March 13, 2013, 05:49:05 AM
@bitcoinspot.nl: Someone bought my sig line for 0.1 BTC per month. I think the store sells tshirts, cafepress does a lot of tshirt printing (and other items) for anyone who has a design. I figured it was a good deal considering all I've been doing at other "faucets".

someone bought you sig-line?
wow thats new to me.... always a way to make some money with bitcoins i guess :)


Title: Re: Want to send bitcoins from the command-line in windows
Post by: Dabs on March 14, 2013, 01:09:33 AM
Yeah. If you send me a whole 1.0 BTC, I will put your link in my sig line for an entire year. I post every day or every few days. So you will get at least 365 exposures or more. PM me for an address if you're interested. hehe.