Bitcoin Forum
December 06, 2016, 09:59:37 PM *
News: Latest stable version of Bitcoin Core: 0.13.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: How to get the data out of bitcoind into a web app?  (Read 992 times)
lucky
Jr. Member
*
Offline Offline

Activity: 43


View Profile
January 03, 2011, 01:47:36 AM
 #1

Reading over the bitcoind API, the only way I can see how to sync new transactions in the wallet with the state of my bitcoin-oriented web app is to read the entire wallet transaction history, then compare each transaction with a database I maintain in the app to see whether it has already been processed or not.

This seems ugly, difficult to code and also prone to scaling issues (going through each and every transaction is fine when it's 50, but what about 1000, 250,000 Huh)

Maybe I'm just really clueless and failing to see an elegant solution.
1481061577
Hero Member
*
Offline Offline

Posts: 1481061577

View Profile Personal Message (Offline)

Ignore
1481061577
Reply with quote  #2

1481061577
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1481061577
Hero Member
*
Offline Offline

Posts: 1481061577

View Profile Personal Message (Offline)

Ignore
1481061577
Reply with quote  #2

1481061577
Report to moderator
1481061577
Hero Member
*
Offline Offline

Posts: 1481061577

View Profile Personal Message (Offline)

Ignore
1481061577
Reply with quote  #2

1481061577
Report to moderator
1481061577
Hero Member
*
Offline Offline

Posts: 1481061577

View Profile Personal Message (Offline)

Ignore
1481061577
Reply with quote  #2

1481061577
Report to moderator
Gavin Andresen
Legendary
*
qt
Offline Offline

Activity: 1652


Chief Scientist


View Profile WWW
January 03, 2011, 04:22:55 PM
 #2

Mirroring all of the information that bitcoin keeps about transactions inside your bitcoin-oriented web app is probably not the right way to go.

It violates the zero/one/infinity principle, and you're likely to have subtle bugs if (when?) the two copies get out of sync.

See:  http://www.bitcoin.org/wiki/doku.php?id=accounts   for "best practices".  If you're willing to share what kind of thing your web app is doing, I'd be happy to brainstorm other approches, too...

How often do you get the chance to work on a potentially world-changing project?
davout
Legendary
*
Offline Offline

Activity: 1358


1davout


View Profile WWW
January 03, 2011, 05:33:27 PM
 #3

Mirroring all of the information that bitcoin keeps about transactions inside your bitcoin-oriented web app is probably not the right way to go.
Well, then the bitcoin client might have to mirror all the functionality that's available when doing SQL queries against a full fledged RDBMS.

It violates the zero/one/infinity principle, and you're likely to have subtle bugs if (when?) the two copies get out of sync.
I don't really see how, if you're talking about scalability issues that would get solved by nice bitcoin callbacks.

See:  http://www.bitcoin.org/wiki/doku.php?id=accounts   for "best practices".  If you're willing to share what kind of thing your web app is doing, I'd be happy to brainstorm other approches, too...
Okay, so here's how bitcoin central handles it.
It polls the client at regular intervals and does exactly what lucky said, it INSERTs unknown transactions, and updates the confirmations of the known ones (and no, the tx_id is not defined as unique Smiley )

It polls the client for each account, not for a global listtransactions (which doesn't really seem to work anyway AFAIK).

Yes, this approach is sub-optimal, but IMO it's the only one that allows enough flexibility in the ways you want to deal with the data.

I'm completely conscious of the limitations and possible security flaws of this approach, and that's why the bitcoin central code *also* takes advantage of the accounts functionality, providing a second security layer.

That, IMHO is the best possible approach for a web app.


Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!