Bitcoin Forum
May 06, 2024, 04:05:56 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 2 3 4 [5] 6 7 8 9 10 11 12 13 »  All
  Print  
Author Topic: libbitcoin  (Read 92417 times)
kdomanski
Newbie
*
Offline Offline

Activity: 10
Merit: 0


View Profile
December 20, 2011, 06:28:33 PM
 #81

Be advised, libbitcoin 0.1.0 alpha 1 is now tagged in the repository.

Gentoo ebuild for this version is available in the "bitcoin" overlay.
Binary packages are not available at this time and will possibly arrive with soon-to-be-tagged alpha 2.


Also, subvertx 0.1.0 is tagged.
See this announcement for more info.
1714968356
Hero Member
*
Offline Offline

Posts: 1714968356

View Profile Personal Message (Offline)

Ignore
1714968356
Reply with quote  #2

1714968356
Report to moderator
1714968356
Hero Member
*
Offline Offline

Posts: 1714968356

View Profile Personal Message (Offline)

Ignore
1714968356
Reply with quote  #2

1714968356
Report to moderator
1714968356
Hero Member
*
Offline Offline

Posts: 1714968356

View Profile Personal Message (Offline)

Ignore
1714968356
Reply with quote  #2

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

Posts: 1714968356

View Profile Personal Message (Offline)

Ignore
1714968356
Reply with quote  #2

1714968356
Report to moderator
1714968356
Hero Member
*
Offline Offline

Posts: 1714968356

View Profile Personal Message (Offline)

Ignore
1714968356
Reply with quote  #2

1714968356
Report to moderator
1714968356
Hero Member
*
Offline Offline

Posts: 1714968356

View Profile Personal Message (Offline)

Ignore
1714968356
Reply with quote  #2

1714968356
Report to moderator
ahtremblay
Sr. Member
****
Offline Offline

Activity: 252
Merit: 250


Live Stars - Adult Streaming Platform


View Profile
December 25, 2011, 06:52:15 PM
 #82

The project is very good, however I believe the license of this project is, frankly, ridiculous. This library has a use that is similar to openssl, curl in that it can form the basis of a wide range of bitcoin applications. Limiting this library to be used  in open source projects only really kills a ton of project including mine. I really believe you should reconsider the license and release it as LGPL.

netrin
Sr. Member
****
Offline Offline

Activity: 322
Merit: 251


FirstBits: 168Bc


View Profile
December 25, 2011, 07:35:49 PM
 #83

While I too would like to see the code released as L-*, frankly your 'ridiculous' comment is extreme. Do you have any intension to compensate Genjix? Will you pledge to contribute improvements upstream? The GPL guarantees that you will... or you won't.

Greenlandic tupilak. Hand carved, traditional cursed bone figures. Sorry, polar bear, walrus and human remains not available for export.
genjix (OP)
Legendary
*
Offline Offline

Activity: 1232
Merit: 1072


View Profile
December 25, 2011, 08:09:13 PM
 #84

We'll see about the license afterwards. It's always easier to switch to weaker copyleft than vice versa. For now I want to build.

Post about new organize algorithm below.
genjix (OP)
Legendary
*
Offline Offline

Activity: 1232
Merit: 1072


View Profile
December 25, 2011, 08:09:58 PM
 #85

A document describing the functioning of the organize algorithm.

New blocks when they first come in are added to the orphans pool. The
pool does not order the blocks. To trace a chain of blocks from an endpoint
you have to keep looking up the previous block as you go backwards.



Assuming we have a valid genesis block, then this pool would produce
2 chains like this:



We loop through every block in the orphan's pool, setting each block to
processed each loop. This stops us re-processing a block when a new block is
added again to the pool, re-triggering the organize algorithm.

The blockchain is only ever stored as one main chain. In the blockchain
database is only stored the currently accepted history. Blocks added to the
blockchain are taken out of the orphan's pool, and returned back to the pool
when removed from the blockchain.

If we have the chain:

Code:
0 -> 1 -> 2a -> 3a

Then the remaining blocks in the orphan pool are 2b, 3b, 4b. Block 4b comes
into the pool and will trigger a re-organize. When we run the organize
algorithm, we find out that the chain 2b, 3b, 4b has greater difficulty.

  • Trace backwards through the pool until we cannot cycle backwards anymore. We call this the orphan-root.
  • Organize will first find the fork point within the blockchain to be at block 1 using the orphan-root's previous block hash.
  • The difficulty in the remaining blocks of the main chain and the chain in the orphan pool are calculated. If the main chain algorithm's difficulty is bigger than the orphan's, then the algorithm stops and the main chain is untouched.
  • The new blocks in the orphan pool will replace the ones in the main chain. The end blocks from the main chain are popped off and returned back to the orphan pool. The blocks from the orphan pool are added to the main chain as the new chain.
  • Reorganization has finished.

Code:
0 -> 1 -> 2b -> 3b -> 4b
genjix (OP)
Legendary
*
Offline Offline

Activity: 1232
Merit: 1072


View Profile
December 25, 2011, 08:29:00 PM
 #86

Max of 80 characters. 4 space indents.

Variables, functions, class-names, enums, typedefs are lowercase. Macros are uppercase. Private class member variables are suffixed with an _

Each line should be indented by either 1 or 2 levels on the next line, and 1 line for each successive indent.

If you're going more than 3 levels deep with each new line of code, then generally you are doing something wrong and code should be siphoned off into functions. Always prefer: flat over nested, dumb over clever, slow+clear over fast+obtuse.

Functions should never be defined in headers. Always in the implementation unless it's required to be in every translation unit (i.e template or constexpr functions).

Format for header file:
Code:
#ifndef LIBBITCOIN_FOO_H
#define LIBBITCOIN_FOO_H

// derived from project includes (i.e blaa.hpp)

// system includes:
// STD headers first
// boost headers second
// other headers last

// project bitcoin includes like <bitcoin/messages.hpp>

// local bitcoin includes "helper_foo.hpp"

// forward declarations
// class Db;

namespace libbitcoin {

// using ...

// typedefs

class foo
 : public blaa
{
public:
  // typedefs

  // functions logically grouped into blocks

  // variables

private:
  // same as for public block
};

} // libbitcoin

#endif


Format for cpp file:
Code:
#include <bitcoin/foo.hpp>

// same format as header files

namespace libbitcon {

foo::foo()
 : blaa(xyz)
{
}

} // libbitcoin


Every { occupies a newline except for namespaces.

Spaces between all operators: x = 5 * 8 + 4 * 2 ... If the order is confusing then use brackets: x = (5 * Cool + (4 * 2). Each : ; (in for loops) or , has a space after them.

All flow control should always happen on new lines.
Code:
// Bad
if (blaa) do_foo();

// Good
if (blaa)
    do_foo();

// Bad
something(); another_thing(); yadayada();

// Good
something();
another_thing();
yadayada();

It's nice if function names read like a sentence when used: write_to_stream(data_packet); or say_hello_to(my_friend);

Accepted short-hands

These are for variables and not for type names which should never use abbreviations.

tx = transaction

blk = block

ec = error_code

it = iterator
netrin
Sr. Member
****
Offline Offline

Activity: 322
Merit: 251


FirstBits: 168Bc


View Profile
December 26, 2011, 05:23:45 PM
 #87

Is there any length after which a blockchain is 'permanent' in your code? Is it technically possible for a reorg after ten or one hundred blocks since the orphan-root?

Greenlandic tupilak. Hand carved, traditional cursed bone figures. Sorry, polar bear, walrus and human remains not available for export.
genjix (OP)
Legendary
*
Offline Offline

Activity: 1232
Merit: 1072


View Profile
December 26, 2011, 10:46:41 PM
 #88

Is there any length after which a blockchain is 'permanent' in your code? Is it technically possible for a reorg after ten or one hundred blocks since the orphan-root?

Yes, theoretically.

No, practically, because of the checkpoints in the block validation code.
netrin
Sr. Member
****
Offline Offline

Activity: 322
Merit: 251


FirstBits: 168Bc


View Profile
December 27, 2011, 03:28:36 AM
 #89

That was yes AND no, both to the second question, right?

Greenlandic tupilak. Hand carved, traditional cursed bone figures. Sorry, polar bear, walrus and human remains not available for export.
genjix (OP)
Legendary
*
Offline Offline

Activity: 1232
Merit: 1072


View Profile
December 27, 2011, 03:51:42 AM
 #90

That was yes AND no, both to the second question, right?

No :p There are checkpoints in bitcoin as an added security measure. If they didn't exist then there would be no limits to reverse the chain. However it isn't a concern. The longest re-organisation ever was 6 blocks deep.
netrin
Sr. Member
****
Offline Offline

Activity: 322
Merit: 251


FirstBits: 168Bc


View Profile
December 27, 2011, 04:17:53 AM
 #91

Are those checkpoints in the public block chain or in your implementation? perhaps you could briefly describe those check points?

These?
https://github.com/bitcoin/bitcoin/pull/534

https://en.bitcoin.it/wiki/Vocabulary
Quote
Checkpoint Lockin
    Every once in a while, a recent block hash is hardcoded into Bitcoin. This prevents pretty much any possible attack from affecting transactions made up to this point. No matter what happens (except perhaps if SHA-256 is broken), these transactions will survive. Satoshi announced the feature here(broken link) and it was discussed to death here (broken link).


Greenlandic tupilak. Hand carved, traditional cursed bone figures. Sorry, polar bear, walrus and human remains not available for export.
genjix (OP)
Legendary
*
Offline Offline

Activity: 1232
Merit: 1072


View Profile
December 27, 2011, 07:05:04 AM
 #92

Yes. It isn't a requirement to be compliant with the protocol, but it is a little extra added security which is nice.
kjj
Legendary
*
Offline Offline

Activity: 1302
Merit: 1024



View Profile
December 28, 2011, 05:49:22 AM
 #93

The project is very good, however I believe the license of this project is, frankly, ridiculous. This library has a use that is similar to openssl, curl in that it can form the basis of a wide range of bitcoin applications. Limiting this library to be used  in open source projects only really kills a ton of project including mine. I really believe you should reconsider the license and release it as LGPL.

Spoken like a true Open Source-er!

Free Software and Open Source are different things, with different goals.  My apologies if you understand the difference, but your post strongly suggests that you do not.

And no, the license doesn't kill your project (or any other, really).  You just can't use this software for it unless you comply with the terms of the license.  You still have the option to do all of the work yourself, or pay someone to do it for you.  You even have the option of negotiating the purchase of a special license from Genjix if you want.

And no, I have no idea what Genjix's stance is on Free Software vs. Open Source.  I'm personally a big fan of Free Software, so I hope he is too, thus I hope that he retains the AGPL license.  But as the creator of the software, the decision on license terms is entirely up to him, so if he feels that this is a commodity library, destined to be one among many, then GPL, LGPL, or something else will be entirely appropriate.

17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8
I routinely ignore posters with paid advertising in their sigs.  You should too.
genjix (OP)
Legendary
*
Offline Offline

Activity: 1232
Merit: 1072


View Profile
December 28, 2011, 06:50:00 AM
 #94

The question here is not GPL or no GPL, the question is either:

AGPL or lesser AGPL.

I've been working with the Aaron Williamson of the SFLC and Richard Stallman of the FSF to fix a bug in the AGPL for bitcoin.

Then I will weigh up the various arguments for adding or not adding a lesser clause. It is whichever will promote development of the library the most. *GPL licenses mean you can either contribute sourcecode or $$$ to benefit the library (by buying proprietary licenses).

Right now as it stands, this library still needs to be completed so these arguments are a time waster Smiley

The bug I'm referring to is that the AGPL requires not only that you give the sourcecode on demand, but that you're proactive in providing the sourcecode visibly. This is problematic because if you make a small modification while developing or building on a compilation based system (like gentoo) then the act of connecting to the p2p network means you have to provide source. There is no means to do this in the bitcoin sourcecode and the idea itself is problematic; every build must store the sourcecode in a bundle which is served using custom bitcoin protocol extensions.

From my understanding, modifying the AGPL for them is complicated and so far the last proposal was:

Quote
> If the covered work has no means of communicating an offer to                                                                                                          
> provide Corresponding Source to the users interacting with it                                                                                                          
> remotely over a computer network, then you may comply with this                                                                                                        
> requirement by making the Corresponding Source for your version                                                                                                        
> available for anyone to copy, free of charge and under the terms of                                                                                                    
> this License, through a publicly available network server or other                                                                                                    
> readily accessible means.

This means that you are able to provide the source code through some other means (such as sending it via email if requested) and it solves the issue.

------

In an ideal world, copyrights, patents, trademarks and censorship wouldn't exist. Proprietary software would not be able to support itself against rampant piracy. And I would put my sourcecode out in the open for anyone to use as they like.

However, we don't live in that ideal world. And I will use what little power I have in the form of the GPL to fight this asymmetric warfare. The balance is totally tilted away from our favour, so why wouldn't you use the only protection afforded to you as a developer.

Licenses like the GPL hack the law, twisting it to our will. It is the best example of subversion.

When people talk about GPL or MIT licenses being free, they're talking about different kinds of freedom as they're essentially rivalrous freedoms. Being free does not always mean no rules necessarily:
Quote
According to Assange, "It’s not correct to put me in any one philosophical or economic camp, because I’ve learned from many. But one is American libertarianism, market libertarianism. So as far as markets are concerned I’m a libertarian, but I have enough expertise in politics and history to understand that a free market ends up as monopoly unless you force them to be free."

And this coming from a person with anarchist tendencies.
genjix (OP)
Legendary
*
Offline Offline

Activity: 1232
Merit: 1072


View Profile
December 28, 2011, 11:20:34 AM
 #95

I tell you what though, short of writing my own berkeley db wrapper there is no decent way to abstract this libary. Their 'C++ API' is essentially the same as their C one except you don't call DB->put(mydb, ...) but instead do mydb->put(...). Nice. Not sure why they bothered.
netrin
Sr. Member
****
Offline Offline

Activity: 322
Merit: 251


FirstBits: 168Bc


View Profile
December 29, 2011, 05:18:08 AM
 #96

Perhaps we can fork a thread on licensing.

Lesser or not, I think the Affero licenses fit nicely within the bitcoin ecosystem. It would be excellent if the bitcoin community limited (or combined) the licenses used by its various projects. The Satoshi client uses MIT (3-clause BSD), but later projects seem to be focusing on the GPL family.

Is the community better served by sharing code or supporting proprietary businesses?

Greenlandic tupilak. Hand carved, traditional cursed bone figures. Sorry, polar bear, walrus and human remains not available for export.
genjix (OP)
Legendary
*
Offline Offline

Activity: 1232
Merit: 1072


View Profile
December 29, 2011, 07:01:56 AM
 #97

heh didn't notice before, but block 546 spends a tx within the same block:
http://blockexplorer.com/tx/6b0f8a73a56c04b519f1883e8aafda643ba61a30bd1439969df21bea5f4e27e2
check input 0
btc_artist
Full Member
***
Offline Offline

Activity: 154
Merit: 101

Bitcoin!


View Profile WWW
December 29, 2011, 04:46:26 PM
 #98

Is the community better served by sharing code or supporting proprietary businesses?
As much as I like *free* software, I think we need to support proprietary businesses if Bitcoin is to go mainstream.  And I don't see that conflicting with my ideals or the Bitcoin ideals.  I think an LGPL license would be ideal for libbitcoin.  Proprietary programs can use/link it, but if they make any improvements to libbitcoin itself, they must be made available to pull back into libbitcoin.  I think it's a perfect compromise between a GPL license and an MIT/BSD style license.

BTC: 1CDCLDBHbAzHyYUkk1wYHPYmrtDZNhk8zf
LTC: LMS7SqZJnqzxo76iDSEua33WCyYZdjaQoE
ahtremblay
Sr. Member
****
Offline Offline

Activity: 252
Merit: 250


Live Stars - Adult Streaming Platform


View Profile
December 31, 2011, 08:23:49 AM
 #99

I will not contribute any code to this project unless the license is changed to LGPL.

Mark Oates
Full Member
***
Offline Offline

Activity: 168
Merit: 100



View Profile
December 31, 2011, 11:28:19 PM
 #100

Quote
As much as I like *free* software, I think we need to support proprietary businesses if Bitcoin is to go mainstream.
I agree with this 100%

I'm also thrilled that libbitcoin is here.  In my opinion, its a milestone.

Has anyone tried compiling on MSVC?
Pages: « 1 2 3 4 [5] 6 7 8 9 10 11 12 13 »  All
  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!