Bitcoin Forum
April 27, 2024, 06:46:02 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 2 [3] 4 »  All
  Print  
Author Topic: Formalised Bitcoin Protocol Standard  (Read 10508 times)
caveden
Legendary
*
Offline Offline

Activity: 1106
Merit: 1004



View Profile
January 06, 2013, 12:10:19 PM
 #41

So, how many more major developers need to show up here to explain that a spec would be 1) not very useful, and/or 2) actually dangerous, before you believe it?

Well, you must admit that they have a little bias: they can all read C++ fluently. Such a documentation would be useful precisely for those who can't. But Armory guy makes a good point:

Write all the "documentation" you want, and put as many comments into the code as you want.  But do not use the word "specification" because nothing except the code can qualify for it.

Maybe simply not calling it "specification" would be enough to avoid most problems raised here.
1714200362
Hero Member
*
Offline Offline

Posts: 1714200362

View Profile Personal Message (Offline)

Ignore
1714200362
Reply with quote  #2

1714200362
Report to moderator
No Gods or Kings. Only Bitcoin
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1075


Ian Knowles - CIYAM Lead Developer


View Profile WWW
January 06, 2013, 01:17:30 PM
Last edit: January 06, 2013, 01:34:39 PM by CIYAM Pty. Ltd.
 #42

Well, you must admit that they have a little bias: they can all read C++ fluently. Such a documentation would be useful precisely for those who can't.

I read C++ fluently (and have been doing hardcore C++ development since the mid 90's) and although I do agree that "what we have is a spec written in C++" I do not think we really want this to be the case in the future (even C++ itself has a "spec" - ISO/IEC 14882:2003 currently).

Transitioning from "C with Classes" to C++ took many years and it took many more for vendors to get "up to spec" (Microsoft being one of the main lagers until Herb Sutter joined them).

The same "slow" process will need to take place with Bitcoin as I don't think having "source code" as the "specification" (written in any programming language) is the correct (or desirable) way that things should be done (however I do appreciate that until the "source code" has any quirks that the don't make sense to put in the "specification" removed over time then the "specification" will also have to include them).

Algorithms are not described by "source code" and neither are any of the major internet protocols or programming languages (that aren't privately owned) - I can't see why Bitcoin *needs* to be an exception in the long term (although I do agree that in until a spec that matches the way the "reference client" behaves perfectly is written it cannot take precedence).

I guess the main thing I disagree with is that "it is useless/pointless to even try" (and BTW C++ had a "draft spec" for many years before finally becoming approved and adopted as being "standard").

This is not something that can or should be "rushed into" but something that like Bitcoin itself would need to evolve over time.

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
flipperfish
Sr. Member
****
Offline Offline

Activity: 350
Merit: 251


Dolphie Selfie


View Profile
January 06, 2013, 01:34:43 PM
 #43

Maybe simply not calling it "specification" would be enough to avoid most problems raised here.

Yep, maybe the wording is the real problem here. But I still think, that it is better to have a documentation of the protocol with all its bugs and quirks, that have to be recreated for a successfull alternative implementation than forcing alternative client devs to read carefully through the satoshi code. The probability of missing some important quirk/bug in the latter case is IMO much higher. Maybe we have a case of "Curse of Knowledge" here, where some people are so familiar with the satoshi code, that they can't imagine other people finding it hard to understand?

Of course such a documentation has to be maintained, which easily could become a fulltime job, because it's rather worthless if it's outdated. On the other side, if someone would go for this and core devs would support this endeavour by pointing out errors and differences to the satoshi client, it could be of great value. And finally even the satoshi client would profit, because all this bugs and quirks could be evened out (or made part of the final specification).
MatthewLM (OP)
Legendary
*
Offline Offline

Activity: 1190
Merit: 1004


View Profile
January 06, 2013, 01:46:03 PM
 #44

It's understandable to say any document would need to have plenty of warnings about non-conformity with the network. And yes, you can't rush something like this.

And since there are people afraid about this, why does this wiki page still exist as it is? https://en.bitcoin.it/wiki/Protocol_specification

That's obviously no where near a complete specification of the protocol. That page should really just be called "Bitcoin messages" and then some of the irrelevant stuff should be moved elsewhere.
Gavin Andresen
Legendary
*
Offline Offline

Activity: 1652
Merit: 2216


Chief Scientist


View Profile WWW
January 06, 2013, 04:48:00 PM
 #45

And since there are people afraid about this, why does this wiki page still exist as it is?

Because people like you noticed that it isn't quite right, but didn't bother to change it?

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

Activity: 1190
Merit: 1004


View Profile
January 06, 2013, 04:52:14 PM
 #46

I stay away from wikis. They are awkward to use and whenever I change anything, it gets turned back almost instantly, so what is the point?
Gavin Andresen
Legendary
*
Offline Offline

Activity: 1652
Merit: 2216


Chief Scientist


View Profile WWW
January 06, 2013, 04:57:53 PM
 #47

I completely agree that more documentation is better, as long as you don't fall into the trap of "if the documentation says it it MUST be true."

Suggestions on how to make the wiki better welcome (there is a discussion elsewhere about banning certain people from the wiki because they have a history of starting edit wars, which I would support, and discussion on the Foundation forums about making the wiki infrastructure independend of Mt. Gox, which I also support). Or volunteers to move technical documentation from the wiki to someplace better also welcome.

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

Activity: 1190
Merit: 1004


View Profile
January 06, 2013, 05:11:47 PM
 #48

I completely agree that more documentation is better, as long as you don't fall into the trap of "if the documentation says it it MUST be true."

Suggestions on how to make the wiki better welcome (there is a discussion elsewhere about banning certain people from the wiki because they have a history of starting edit wars, which I would support, and discussion on the Foundation forums about making the wiki infrastructure independend of Mt. Gox, which I also support). Or volunteers to move technical documentation from the wiki to someplace better also welcome.


That is all fair enough. I do agree that such documentation should have clear warnings and describe the risks, and not pretend that the documentation overrules the active software. But I do think there being documentation is better than none. I also think more documentation of the source code is a good idea, perhaps using a doxygen syntax and separating prototypes/definitions from implementations because at the moment it's a bit all over the place.
Boussac
Legendary
*
Offline Offline

Activity: 1220
Merit: 1015


e-ducat.fr


View Profile WWW
January 06, 2013, 06:37:47 PM
 #49

I completely agree that more documentation is better, as long as you don't fall into the trap of "if the documentation says it it MUST be true."

Suggestions on how to make the wiki better welcome (there is a discussion elsewhere about banning certain people from the wiki because they have a history of starting edit wars, which I would support, and discussion on the Foundation forums about making the wiki infrastructure independend of Mt. Gox, which I also support). Or volunteers to move technical documentation from the wiki to someplace better also welcome.


+1
From a business perspective, I suppose the bitcoin story sounds a lot better if one can say something like:

There is at least one high level documentation of the protocol (wiki run by the Bitcoin Foundation or else) AND any bitcoin client implementation can be tested for compliance with a single reference implementation called the Satoshi client.
The Satoshi client is open source, regularly updated, peer reviewed and provides the basis for a self-certifying ecosystem.

Through the reference implementation, bitcoin can free online merchants and payment processors from the burden of costly certification requirements imposed by proprietary, legacy payment schemes.

Johnathan
Newbie
*
Offline Offline

Activity: 39
Merit: 0



View Profile
January 06, 2013, 07:07:29 PM
 #50

In my experience something the reference client does not capture well are the "gotchas" that have been solved over time that are relevant to all Bitcoin peer implementations.
When reading the reference code you might not realize that a piece of code evolved to its current state to solve a serious issue and that the naive implementation wouldn't be sufficient.

This.

There are (I would assume) many things learned along the way in any protocol development, but what lives on is the solution, not the reasons that made it that way.  For example, in reading the network protocol handling of the 'addr' message, there are what seem arbitrary choices for different time periods, selection of address to respond with, etc.  I'm certain there is a reason for each and every one of those, and if you've been with the project from the beginning, you'd know them.  However, newcomers have to reverse engineer the thinking of the developers to get at this.

This isn't a complaint, by the way, just an observation that as a project grows beyond a certain size and age, some things need to get written down that were previously "tribal knowledge amongst the devs".  An IETF-style protocol specification would be useful.  (And I'd be willing to help in some capacity.)
etotheipi
Legendary
*
Offline Offline

Activity: 1428
Merit: 1093


Core Armory Developer


View Profile WWW
January 06, 2013, 07:21:01 PM
 #51

By the way, to answer the original question... about a year ago, user "bittrick" submitted something resembling documentation about the technical details of Bitcoin:

https://bitcointalk.org/index.php?topic=41718.0

He spent a lot of time in the code and attempted to capture some of the subtler behaviors of the client.  It's not a "specification" but it is an excellent starting point for understanding what's going on.

Back to argument about "specification"... I absolutely support documentation, and especially written nuggets of information that are difficult to deduce (such as that OpenSSL behavior that Mike Hearn mentioned).  I think it's critical to have these kinds of things to help people understand what they're looking at/for.  Especially if they plan to dig into the C++ code afterwards.  And certain parts of the system very well could be specified (perhaps much of the networking protocol).  But not all of it, especially the script-validation engine.

On the topic of OpenSSL... is it possible to reimplement the OpenSSL behavior, or at least extract it from where it is currently, and have it hardcoded into the Satoshi client?  Or rather, does the license allow you to redistribute the OpenSSL project/source with the project so that it can be static compiled?  I guess you only need a .a/.lib, but I'm not sure what the OpenSSL license is like.  That would certainly resolve any issues related to dynamic linking to system libraries that might be different versions on different computers.  It would make the project immune to system library upgrades, which is probably better for security anyway (an attacker could simply swap out the system OpenSSL with a different version having a known bug that he could exploit, and even a diligent user wouldn't notice because the signatures and checksums on the Bitcoin-Qt source distribution are correct).

Founder and CEO of Armory Technologies, Inc.
Armory Bitcoin Wallet: Bringing cold storage to the average user!
Only use Armory software signed by the Armory Offline Signing Key (0x98832223)

Please donate to the Armory project by clicking here!    (or donate directly via 1QBDLYTDFHHZAABYSKGKPWKLSXZWCCJQBX -- yes, it's a real address!)
jgarzik
Legendary
*
Offline Offline

Activity: 1596
Merit: 1091


View Profile
January 06, 2013, 08:00:55 PM
 #52

On the topic of OpenSSL... is it possible to reimplement the OpenSSL behavior, or at least extract it from where it is currently, and have it hardcoded into the Satoshi client?  Or rather, does the license allow you to redistribute the OpenSSL project/source with the project so that it can be static compiled?  I guess you only need a .a/.lib, but I'm not sure what the OpenSSL license is like.  That would certainly resolve any issues related to dynamic linking to system libraries that might be different versions on different computers.  It would make the project immune to system library upgrades, which is probably better for security anyway (an attacker could simply swap out the system OpenSSL with a different version having a known bug that he could exploit, and even a diligent user wouldn't notice because the signatures and checksums on the Bitcoin-Qt source distribution are correct).

I have thought about doing this on more than one occasion:  Creating a libcrypto_satoshi snapshot with the bignum, DER, ECDSA etc. bits we currently use.  This would work around an IMO incorrect exclusion of ECDSA from Fedora's openssl package, as well as "freeze" certain bits that are exported globally via the bitcoin blockchain.

But as always, there are costs to maintaining a fork.  It inevitably gets less eyes, use and maintenance than the main fork.


Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own.
Visit bloq.com / metronome.io
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
gene
Sr. Member
****
Offline Offline

Activity: 252
Merit: 250


View Profile
January 06, 2013, 10:01:44 PM
 #53

  • You can write a spec, but you can't guarantee it actually matches the behaviour of the majority implementation.

Sorry but it sounds like "We can't tell what the program does really."

Yup. Without a spec and conforming code, you're not doing software engineering. You're just a code monkey wielding a roll of duct tape.

Quote
I think the specification would be desirable here, otherwise it's like fixing a running car really.
If later some case is found that the reference client disagrees with the specification:
* Bug in the specification? - Fix the specification.
* Bug in the reference client? - Fix the reference client, or if not possible to fix now and hardfork is needed, then write a note in the specification.
Maybe there are more important matters to look at now but this looks inevitable one day ...

Agreed. No good reason not to do this.

*processing payment* *error 404 : funds not found*
Do you want to complain on the forum just to fall for another scam a few days later?
| YES       |        YES |
paybitcoin
Member
**
Offline Offline

Activity: 85
Merit: 10


1h79nc


View Profile WWW
January 06, 2013, 10:30:59 PM
 #54

On the topic of OpenSSL... is it possible to reimplement the OpenSSL behavior, or at least extract it from where it is currently, and have it hardcoded into the Satoshi client?  Or rather, does the license allow you to redistribute the OpenSSL project/source with the project so that it can be static compiled?  I guess you only need a .a/.lib, but I'm not sure what the OpenSSL license is like.  That would certainly resolve any issues related to dynamic linking to system libraries that might be different versions on different computers.  It would make the project immune to system library upgrades, which is probably better for security anyway (an attacker could simply swap out the system OpenSSL with a different version having a known bug that he could exploit, and even a diligent user wouldn't notice because the signatures and checksums on the Bitcoin-Qt source distribution are correct).

I have thought about doing this on more than one occasion:  Creating a libcrypto_satoshi snapshot with the bignum, DER, ECDSA etc. bits we currently use.  This would work around an IMO incorrect exclusion of ECDSA from Fedora's openssl package, as well as "freeze" certain bits that are exported globally via the bitcoin blockchain.
This absolutely needs to be done with a high priority. OpenSSL changing at all at this point would require recertifying the new version of OpenSSL anyways against older satoshi code + implementations, correct? Or is there some version pegged already as 'Satoshi's version of OpenSSL'? Or have we just been lucky?

Quote
But as always, there are costs to maintaining a fork.  It inevitably gets less eyes, use and maintenance than the main fork.
I'm sure some people trusting their bank accounts to the strength of OpenSSL's ECDSA implementation would have great interest in any code changes upstream - you would probably hear 'how does this affect Bitcoin?' pretty quickly.

IMO, the cost of maintaining a fork is much lower than the potential cost of having an OpenSSL library delivered with a certain distro introduce a split because of a bugfix, code cleanup, or optimization.
MatthewLM (OP)
Legendary
*
Offline Offline

Activity: 1190
Merit: 1004


View Profile
January 06, 2013, 10:43:10 PM
 #55

At least on the Mac version, the OpenSSL library is packaged with bitcoin. If it wasn't, that would be alarming.
kjj
Legendary
*
Offline Offline

Activity: 1302
Merit: 1024



View Profile
January 06, 2013, 11:24:22 PM
 #56

I would absolutely recommend against forking openssl, for reasons that jgarzik gave, and more.  If a day ever comes when we must, then we must.  Until then, just because we can does not mean that we should.

17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8
I routinely ignore posters with paid advertising in their sigs.  You should too.
arturh
Jr. Member
*
Offline Offline

Activity: 59
Merit: 10



View Profile
January 07, 2013, 05:56:58 PM
 #57

What we need is a reference implementation. A program which is obviously correct. The current implementation is a bit of a mess (DoS checking code inside of "class CTransaction"? Give me a break). Don't get me wrong, even the better written C++ implementation would arise suspicion (see the Underhanded C competition to see what I mean). What we need is a higher level of abstraction, at least for the code dealing with validating blocks and transactions. No need to put the IRC code there.

I think that a reference implementation written in Haskell would be a big plus. This could be used in the official client (even if the GUI/IRC/etc code is written in C++) and would make it easier to trust the program. I started toying around in translating some of the C++ code (https://github.com/arturh/hbitcoin) but there's a lot of work left, this could definitely use some help.

I think this would:
  - make the inner workings of what really matters crystal clear (as long as they were willing to learn some haskell)
  - attract math-heads to giva a look at the code

xxjs
Sr. Member
****
Offline Offline

Activity: 280
Merit: 250


View Profile
January 07, 2013, 08:51:15 PM
 #58

When I started in computing in the seventies, it was mosltly trying and failing, after that we got a development standard of 2 shelf meters, after that a binder, after that a thin brochure, and now we are back to trying and failing, which works best, after all.
2112
Legendary
*
Offline Offline

Activity: 2128
Merit: 1065



View Profile
January 07, 2013, 09:31:40 PM
 #59

I think that a reference implementation written in Haskell would be a big plus.
Ah, the obligatory visit from a silver-bullet salesman. This year's it is arturh selling Haskell. Last year it was Vandroiy selling aspect-oriented programming.

https://bitcointalk.org/index.php?topic=30200.msg614861#msg614861

It is fun to re-read the posts from late 2011 entitled "Request for Standarization". The more things change the more they stay the same, or in its original French "plus ça change, plus c'est la même chose".

Check out how etotheipi changed from 2011 when he was "out-of-core" to 2013 when he is almost "in-core".

Check out how my lame attempts at satire or Commedia dell'arte didn't change.

If we can't get an official Bitcoin standard can we at least find an official Bitcoin core development jester?

Please comment, critique, criticize or ridicule BIP 2112: https://bitcointalk.org/index.php?topic=54382.0
Long-term mining prognosis: https://bitcointalk.org/index.php?topic=91101.0
eldentyrell
Donator
Legendary
*
Offline Offline

Activity: 980
Merit: 1004


felonious vagrancy, personified


View Profile WWW
January 08, 2013, 08:46:35 AM
Last edit: January 08, 2013, 09:26:24 AM by eldentyrell
Merited by ABCbits (3)
 #60

Mike, I agree with all of your technical points, and I agree that the Satoshi client code is and always will be "the spec".  However I'm not sure I'm comfortable with the sociological conclusions you're drawing, especially the whole implementation-diversity-is-unavoidably-bad angle.

I'll set that aside for a moment and just comment on this:

Note that SPV nodes are much less risky.

SPV is less risky precisely because it trusts the difficultywise-longest chain regardless of transaction validity.  Transaction validity is the only complicated/subtle part; judging difficultywise-length requires only SHA-256, which is about two dozen lines of easy-to-test code.

This advantage can be replicated in full-chain-validating clients by having them watch for any invalid chain which is difficultywise-longest by more than the confirmation threshold.  If such a situation arises, activate safe mode: halt all activities except possibly mining.  I assume that the kerfuffle over "losing money" isn't about mining revenue.  Safe mode can be automatically deactivated if a valid chain once again becomes difficultywise-longest.

I suppose clients that do this are still "second class" in the sense that if you find a chain-splitting bug you can get them to pause until a human intervenes.  But it's definitely a distinct security class compared to either SPV or bitcoin-qt.

The printing press heralded the end of the Dark Ages and made the Enlightenment possible, but it took another three centuries before any country managed to put freedom of the press beyond the reach of legislators.  So it may take a while before cryptocurrencies are free of the AML-NSA-KYC surveillance plague.
Pages: « 1 2 [3] 4 »  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!