Bitcoin Forum
May 21, 2024, 11:40:54 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Get transactions from bitcoin core or bitcoind  (Read 1497 times)
torbente (OP)
Full Member
***
Offline Offline

Activity: 140
Merit: 100


View Profile
January 06, 2016, 04:28:07 PM
 #1

Hi everyone.

Im been reading the forums for some years. I actually have my own faucet and im working to develop another web site which will accept bitcoins.

To keep the  website, i also developed a desktop application in delphi, which makes all a lot easier. The program process the .csv files that bitcoin core generates and automatically update de server database. Until this point everything works perfect and secure. The program itself its fully automatic: every 15 minutes, it checks adresses.csv and transactions.csv and update to the server database what is required. But i need manually export the .csv files from the bitcoin core, so if someone send me money, it is not reflected in the server until i do this.
Is there anyway to make this automatic? What i want is someting like this.

c:/program files/bitcoin/bitcoind export addresses to c:/myfolder/myaddressesfile.csv
c:/program files/bitcoin/bitcoind export transactions to c:/myfolder/mytransactionsfile.csv

Is any workaround for this? I tried it for weeks and i dont find nothing usefull.

Thanks you in advance.
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3402
Merit: 6642


Just writing some code


View Profile WWW
January 06, 2016, 07:26:44 PM
 #2

You can use the command line and RPC commands getaddressesbyaccount and listtransactions to get the addresses and transactions respectively.

torbente (OP)
Full Member
***
Offline Offline

Activity: 140
Merit: 100


View Profile
January 06, 2016, 07:53:52 PM
 #3

You can use the command line and RPC commands getaddressesbyaccount and listtransactions to get the addresses and transactions respectively.

I know it can be done, but i dont have idea how  Huh Using testnet? I try connecting to the daemon with json-rpc but i was unable.
There are not a shortcut to generate the .csv files from the commandline?
I have the feeling that the solutions is very easy but im missing something.
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3402
Merit: 6642


Just writing some code


View Profile WWW
January 06, 2016, 08:38:23 PM
 #4

You can use the command line and RPC commands getaddressesbyaccount and listtransactions to get the addresses and transactions respectively.

I know it can be done, but i dont have idea how  Huh Using testnet? I try connecting to the daemon with json-rpc but i was unable.
There are not a shortcut to generate the .csv files from the commandline?
I have the feeling that the solutions is very easy but im missing something.
What was the error that it gave you? Do you have daemon=1, rpcuser, and rpcpassword set in the bitcoin.conf file? If you don't you will need that to allow Bitcoin Core to run the daemon stuff.

torbente (OP)
Full Member
***
Offline Offline

Activity: 140
Merit: 100


View Profile
January 06, 2016, 11:13:33 PM
 #5

You can use the command line and RPC commands getaddressesbyaccount and listtransactions to get the addresses and transactions respectively.

I know it can be done, but i dont have idea how  Huh Using testnet? I try connecting to the daemon with json-rpc but i was unable.
There are not a shortcut to generate the .csv files from the commandline?
I have the feeling that the solutions is very easy but im missing something.
What was the error that it gave you? Do you have daemon=1, rpcuser, and rpcpassword set in the bitcoin.conf file? If you don't you will need that to allow Bitcoin Core to run the daemon stuff.

Yes, I have the bitcoin.conf with those values. I did not received an specific error; i said i was unable since i do not know how i could connect my program to a rcp port in delphi. I searched the web for many days and i dont found nothing about it: yes, i deeply searched and nothing! I have good experience with TCP/IP connections (i designed a server-client program some years ago) but i never worked with RCP before.

What about the main question? Is possible to export the .csv files from the bitcoind?
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3402
Merit: 6642


Just writing some code


View Profile WWW
January 06, 2016, 11:28:28 PM
 #6

Yes, I have the bitcoin.conf with those values. I did not received an specific error; i said i was unable since i do not know how i could connect my program to a rcp port in delphi. I searched the web for many days and i dont found nothing about it: yes, i deeply searched and nothing! I have good experience with TCP/IP connections (i designed a server-client program some years ago) but i never worked with RCP before.
It just uses HTTP Post requests to port 8333 and uses JSON formatted results.

What about the main question? Is possible to export the .csv files from the bitcoind?
No, however you could also automate what you are doing manually with a macro. Just get some macro program and you can use that to automatically do everything you do by hand since it just records and executes mouse moves, clicks, and keyboard typing.

torbente (OP)
Full Member
***
Offline Offline

Activity: 140
Merit: 100


View Profile
January 07, 2016, 03:40:28 AM
 #7

Well, the macro workaround is not valid for me.

I just downloaded a library for delphi (indy) which have a httpclient. I set the values like this:

  lParamList.Add('method=getnewaddress');
  lParamList.Add('params=[0]');
  lParamList.Add('id=test');

  PostExample := lHTTP.Post('http://myuser:mypassword@localhost:8332/', lparamlist);

And i got this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML>
<HEAD>
<TITLE>Error</TITLE>
<META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=ISO-8859-1'>
</HEAD>
<BODY><H1>401 Unauthorized.</H1></BODY>
</HTML>

User and password are exactly like in the bitcoin.conf file. I feel im very close
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3402
Merit: 6642


Just writing some code


View Profile WWW
January 07, 2016, 03:49:35 AM
 #8

Well, the macro workaround is not valid for me.

I just downloaded a library for delphi (indy) which have a httpclient. I set the values like this:

  lParamList.Add('method=getnewaddress');
  lParamList.Add('params=[0]');
  lParamList.Add('id=test');

  PostExample := lHTTP.Post('http://myuser:mypassword@localhost:8332/', lparamlist);

And i got this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML>
<HEAD>
<TITLE>Error</TITLE>
<META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=ISO-8859-1'>
</HEAD>
<BODY><H1>401 Unauthorized.</H1></BODY>
</HTML>

User and password are exactly like in the bitcoin.conf file. I feel im very close

Do you have rpcallowip in bitcoin.conf to allow your ip address (including 127.0.0.1)?

torbente (OP)
Full Member
***
Offline Offline

Activity: 140
Merit: 100


View Profile
January 07, 2016, 04:32:02 AM
Last edit: January 07, 2016, 06:19:18 AM by torbente
 #9

My bitcoin.conf file

rpcuser=myuser
rpcpassword=mypassword
daemon=1
server=1
rpcallowip=127.0.0.1

Im actually connecting to the server: if i close bitcoind and try again the test program i get socket error, connection refused.
But if i write a wrong password i get the same response. Maybe my bitcoin.conf is not in the right folder?
To be sure, i copied it to the same folder than bitcoin core and daemon but it do not works yet.

EDIT im working in another aproach too: just run butcoin-cli methods from my program using commandline and read responses. This way looks very promising.
torbente (OP)
Full Member
***
Offline Offline

Activity: 140
Merit: 100


View Profile
January 08, 2016, 01:54:04 PM
 #10

Well, after a lot of job, i was able to get the info from bitcoind using the commandline, without need to connect to the server via HTTP. I just run a commandline from my program and get the results, all this automatically.

If anyone wants support of how you can do this in delphi, lazarus, FPC just let me know.

Thanks to you all.
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!