Bitcoin Forum
September 24, 2016, 10:36:40 PM *
News: Due to DDoS attacks, there may be periodic downtime.
 
   Home   Help Search Donate Login Register  
Pages: [1] 2 »  All
  Print  
Author Topic: libBitCoin, a good idea?  (Read 3067 times)
hsoft
Newbie
*
Offline Offline

Activity: 14


View Profile
December 04, 2010, 03:50:52 PM
 #1

I find the idea of BitCoin interesting, and I looked into its source code a little bit. I find it a bit monolithic and I thought it would be a good idea to extract the non-ui (and by that, I mean every UI, including RPC and command line) code and create a new library out of it.

This way, it would be easier to create alternative clients as well as bindings to other languages (Python!!!).

As anyone thought of it yet? Is there a particular reason why this would be doomed to failure?
1474756600
Hero Member
*
Offline Offline

Posts: 1474756600

View Profile Personal Message (Offline)

Ignore
1474756600
Reply with quote  #2

1474756600
Report to moderator
1474756600
Hero Member
*
Offline Offline

Posts: 1474756600

View Profile Personal Message (Offline)

Ignore
1474756600
Reply with quote  #2

1474756600
Report to moderator
1474756600
Hero Member
*
Offline Offline

Posts: 1474756600

View Profile Personal Message (Offline)

Ignore
1474756600
Reply with quote  #2

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

Posts: 1474756600

View Profile Personal Message (Offline)

Ignore
1474756600
Reply with quote  #2

1474756600
Report to moderator
1474756600
Hero Member
*
Offline Offline

Posts: 1474756600

View Profile Personal Message (Offline)

Ignore
1474756600
Reply with quote  #2

1474756600
Report to moderator
1474756600
Hero Member
*
Offline Offline

Posts: 1474756600

View Profile Personal Message (Offline)

Ignore
1474756600
Reply with quote  #2

1474756600
Report to moderator
RHorning
Full Member
***
Offline Offline

Activity: 210


View Profile
December 04, 2010, 03:57:13 PM
 #2

I find the idea of BitCoin interesting, and I looked into its source code a little bit. I find it a bit monolithic and I thought it would be a good idea to extract the non-ui (and by that, I mean every UI, including RPC and command line) code and create a new library out of it.

This way, it would be easier to create alternative clients as well as bindings to other languages (Python!!!).

As anyone thought of it yet? Is there a particular reason why this would be doomed to failure?

There is the Bitcoind software that can be used as a library with an API already implemented if you choose to perform actions on the Bitcoin network but don't want to re-implement the whole protocol.  For about 80% of the applications I can think of, that would be more than sufficient.

If you are trying to tweak performance, yes a library of functions that allow you to connect to the various parts of the Bitcoin network would be nice as well.  When are you going to write it?

1FLK3uUT3Vup5JtkGJVXKHAoS3AZWPcKdv
hsoft
Newbie
*
Offline Offline

Activity: 14


View Profile
December 04, 2010, 04:12:59 PM
 #3

Isn't bitcoind the exact same software, but with the "-server" flag?

What I mean to do with a libBitCoin is to make it easier to create bindings for it as well as alternate clients (instead of the wxWidgets one).

This could spur innovation within the BitCoin project (new stuff is easier to try in dynamic languages like Python). An example could be django bitcoin integration, or stuff like that. The last time I checked the RPC API, it seemed rather limited to me.

Moreover, implementing RPC stuff is much easier to do in Python than in C++. That's one of the specific things I was thinking about.
RHorning
Full Member
***
Offline Offline

Activity: 210


View Profile
December 04, 2010, 05:09:12 PM
 #4

Isn't bitcoind the exact same software, but with the "-server" flag?

Bitcoind is compiled from the same source code as the main Bitcoin with a user-interface, but it is two different packages created from two different makefiles.  As far as network connections are concerned, it is the same software where they both look and behave identically.

What you may want to look at is this page:

http://www.bitcoin.org/wiki/doku.php?id=api

Almost every function from examining the structure of the blocks & transactions to sending & receiving coins is there.

The primary advantages I can see to perhaps creating a new library is to permit some hooks that allow changes to block inclusion policies for miners, different fee schedules, or tweaking some of the network protocol to include new messages or "services".  Some of that may not even be supported by a library but rather simply re-implementing the protocol on a more basic level in the network itself.

It depends largely on what it is that you are trying to do, but I am suggesting that if you don't want to put the effort into writing the library yourself or to re-implement the whole protocol, that using the JSON RPC library is a good way to get much of what you may want to accomplish.  It is deliberately set up in such a way that you can access the information about Bitcoins without having to provide all of the features that a full re-implementation would force you into.

Mind you, I'm not even dissing the concept of perhaps a better connected library like libpng which allows you to render images of that graphic format.  What I am saying is that the library does exist after a fashion and if there was something specific to add to the already existing API might be a better route to take unless you are doing something on a very low level related to the network itself.  Certainly you could largely re-create a custom user interface for a specific application using the JSON API going through Bitcoind as it is currently implemented.

1FLK3uUT3Vup5JtkGJVXKHAoS3AZWPcKdv
brocktice
Sr. Member
****
Offline Offline

Activity: 292


Apparently I inspired this image.


View Profile WWW
December 04, 2010, 06:03:39 PM
 #5

It's very, very easy to hook up to the JSON-RPC interface of the daemon with python. Unfortunately it's lacking a few key features like a full, official listtransactions command, so it would make for a rather stunted GUI.

http://media.witcoin.com/p/1608/8----This-is-nuts

My #bitcoin-otc ratings: http://bitcoin-otc.com/viewratingdetail.php?nick=brocktice&sign=ANY&type=RECV

Like my post? Leave me a tip: 15Cgixqno9YzoKNEA2DRFyEAfMH5htssRg
RHorning
Full Member
***
Offline Offline

Activity: 210


View Profile
December 04, 2010, 10:26:40 PM
 #6

It's very, very easy to hook up to the JSON-RPC interface of the daemon with python. Unfortunately it's lacking a few key features like a full, official listtransactions command, so it would make for a rather stunted GUI.

Let's put that into the API.  It would be by far and away easier to add a single command that merely exposes something the software is already doing than it is to create a whole new library + API from scratch.  If you have a specific request, I'm sure those involved with active development of the main Bitcoin software would at least consider the idea and might put it into a future update, particularly if you can show it is a pretty trivial request.

What other features would be needed with the JSON API that are currently missing?  Even building a "wish list" of requested features would be useful, and I don't think it would be particularly long if it involved simply exposing things already sent around on the network like transmitting data of an existing block or transactions from that block.  It is being built right now on an "as needed" basis, so what is needed?

1FLK3uUT3Vup5JtkGJVXKHAoS3AZWPcKdv
jgarzik
Legendary
*
qt
Offline Offline

Activity: 1470


View Profile
December 04, 2010, 10:43:26 PM
 #7

It's very, very easy to hook up to the JSON-RPC interface of the daemon with python. Unfortunately it's lacking a few key features like a full, official listtransactions command, so it would make for a rather stunted GUI.

Let's put that into the API.

Full listtransactions has been rejected.  <shrug>  Plenty of people use it, so I'll continue publishing a working patch.

It's tempting to publish a "useful patches" patchkit, to give these useful features to a wider audience.

Jeff Garzik, bitcoin core dev team and BitPay engineer; opinions are my own, not my employer.
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
hsoft
Newbie
*
Offline Offline

Activity: 14


View Profile
December 05, 2010, 08:29:05 AM
 #8

One example I've been thinking about is that "pooled mining" thing. The proposed scheme of having a central authority push work to miners seems wrong to me. It should rather be miners that fetch work from the central authority. Doing so with the current code seems more complicated than it should.

Another one is to (I don't even know if it's possible) maybe develop a concept of "BitCoin authority", which would maintain that huge block database, and "lite clients" which would rely on central authorities. Would it be p2p anymore? no, you'd have to trust a central authority (a kind of bank), but because of the p2p protocol, you'd always have the choice to run a full client yourself if you want. But most people would run the "lite client" because the normal client is resource hungry.

Anyway, the whole thing is mainly for good software engineering practices, which increases maintainability and extensibility, which is a good idea in general. Also, the RPC API seems rather hackish to me.

It doesn't seem like that much work (ok, maybe I'm wrong there...), it's just a matter of re-organizing the existing code, which is already there.
hsoft
Newbie
*
Offline Offline

Activity: 14


View Profile
December 05, 2010, 04:35:56 PM
 #9

Well well, I gave it a try today (I want to learn C++, so I thought it would be a good opportunity). The (incomplete, of course) result is at:

http://bitbucket.org/hsoft/libbitcoin

I also cloned the bitcoin repository and changed it so that it uses libBitCoin:

http://bitbucket.org/hsoft/bitcoin-reorg

The more I play with that code, the more I think some restructuring would be healthy. I don't know much about C++, but is it normal that this much code end up in header files instead of cpp files?
hsoft
Newbie
*
Offline Offline

Activity: 14


View Profile
December 07, 2010, 03:17:51 PM
 #10

For the record: I failed.

This code is way too coupled (with the UI as well as everything else) to extract a libBitCoin from it without deep knowledge of it.

I might try again, but then I'd start by cleaning the code from within the project, and only after that, try to extract a library out of it.

Am I the only one worrying about the structure of that code?
davout
Legendary
*
Offline Offline

Activity: 1358


1davout


View Profile WWW
December 07, 2010, 03:27:08 PM
 #11

No, you're not the only one.

Bitcoin would greatly benefit from getting included in the official debian repos.
There is currently discussion going on, on the debian bugtracker, see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=578157

The bitcoin code is also tightly coupled with wxwidgets too, and that's not a really good thing for inclusion in debian..

You should fork gavins git repo and build up from there, you'll get the svn commits he regularly pulls into his fork along with a couple of very useful patches.

I would love to see a headless client making it to the debian repo and I'll support it by donating (I'm a failure at C++).

hsoft
Newbie
*
Offline Offline

Activity: 14


View Profile
December 10, 2010, 10:36:38 AM
 #12

Well, I started working on my alternative approach which is to clean bitcoin's code first. I'm certainly learning a lot about C++ and its bad practices Smiley. The repo is at:

http://bitbucket.org/hsoft/bitcoin-clean

I wrote how I plan to proceed with the the cleaning in this file:

http://bitbucket.org/hsoft/bitcoin-clean/src/tip/cleaning_process.txt
davout
Legendary
*
Offline Offline

Activity: 1358


1davout


View Profile WWW
December 10, 2010, 10:40:22 AM
 #13

I just read your description of the cleaning process.

I think that instead of decoupling wxw from the code you should drop it altogether and just make it easy (JSON-RPC is easy Smiley ) to implement one as an extra layer.


hsoft
Newbie
*
Offline Offline

Activity: 14


View Profile
December 10, 2010, 10:41:58 AM
 #14

I just read your description of the cleaning process.

I think that instead of decoupling wxw from the code you should drop it altogether and just make it easy (JSON-RPC is easy Smiley ) to implement one as an extra layer.



Of course, that was the whole point of my "libBitCoin" initiative. But because I failed at that, what I want to do is decouple wx, one step at a time, and once this is done, extract libBitCoin out of bitcoin.
genjix
Legendary
*
expert
Offline Offline

Activity: 1232


View Profile
August 14, 2011, 02:56:25 AM
 #15

Just wanted to point out my project here (libbitcoin): https://bitcointalk.org/index.php?topic=30646.0

Making great progress and it's functional. There's a working application in examples/poller.cpp that simply downloads the bitcoin blocks + transactions + everything into postgresql so you can inspect it. Someone could easily throw a web gui around this and...

voila! blockexplorer clone Smiley

https://gitorious.org/libbitcoin/libbitcoin/blobs/master/examples/poller.cpp

Donate to DarkWallet
davout
Legendary
*
Offline Offline

Activity: 1358


1davout


View Profile WWW
August 14, 2011, 06:48:46 AM
 #16

Just wanted to point out my project here (libbitcoin): https://bitcointalk.org/index.php?topic=30646.0

Making great progress and it's functional. There's a working application in examples/poller.cpp that simply downloads the bitcoin blocks + transactions + everything into postgresql so you can inspect it. Someone could easily throw a web gui around this and...

voila! blockexplorer clone Smiley

https://gitorious.org/libbitcoin/libbitcoin/blobs/master/examples/poller.cpp
sweet!

Mike Hearn
Legendary
*
expert
Offline Offline

Activity: 1526


View Profile
August 14, 2011, 02:06:05 PM
 #17

I don't think it's a good idea to encourage distributions like Debian to package Bitcoin. There have been too many cases where people need to upgrade and Linux distributions are not exactly famous for keeping up to date with the latest releases. The last thing Bitcoin needs is big chunks of the network running ancient versions because that's what apt-get gives you. Let Linux users download the binaries from the web site instead.
zellfaze
Full Member
***
Offline Offline

Activity: 142


Security Enthusiast


View Profile WWW
August 14, 2011, 04:54:07 PM
 #18

With apt you can add your own repos.  Perhaps rather than trying to get into the official debian repo, we could just make our own repo for Bitcoin like Tor has done (http://mirror.noreply.org/pub/tor/).

Anyhow, I think that libbitcoin is a great idea, but not exactly a project for someone new to C++.

A+, CCENT, CCNA
Security Enthusiast
PHP Coder

Not that I expect anyone to, but should you like my post, please donate:
Donate: 1BRbfqii6Sm9tEUE8A16H7QeDmYFjyBZ7V
error
Hero Member
*****
Offline Offline

Activity: 574



View Profile
August 14, 2011, 06:43:37 PM
 #19

I don't think it's a good idea to encourage distributions like Debian to package Bitcoin. There have been too many cases where people need to upgrade and Linux distributions are not exactly famous for keeping up to date with the latest releases. The last thing Bitcoin needs is big chunks of the network running ancient versions because that's what apt-get gives you. Let Linux users download the binaries from the web site instead.

This depends on two things, the distribution packaging policies and the package maintainer. Mainly the package maintainer, though if you're using Debian, good luck finding a current version of anything without permanently staying on unstable.

15UFyv6kfWgq83Pp3yhXPr8rknv9m6581W
ShadowOfHarbringer
Legendary
*
Offline Offline

Activity: 1470


Bringing Legendary Har® to you since 1952


View Profile
August 14, 2011, 10:44:37 PM
 #20

I don't think it's a good idea to encourage distributions like Debian to package Bitcoin. There have been too many cases where people need to upgrade and Linux distributions are not exactly famous for keeping up to date with the latest releases. The last thing Bitcoin needs is big chunks of the network running ancient versions because that's what apt-get gives you. Let Linux users download the binaries from the web site instead.

if you're using Debian, good luck finding a current version of anything without permanently staying on unstable.

Yep, that is it.
We should place Bitcoin in repos of distros like Gentoo, Arch, Ubuntu, or Debian Sid (unstable, "fresh" debian), which have newer versions of packets updated more frequently.

But this policy won't work with enterprise-class distros like Stable debian, CentoOS/Redhat etc.

Pages: [1] 2 »  All
  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!