Bitcoin Forum
December 03, 2016, 06:42:18 AM *
News: To be able to use the next phase of the beta forum software, please ensure that your email address is correct/functional.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: The first rule of Bitcoin is...  (Read 1300 times)
Hal
VIP
Sr. Member
*
expert
Offline Offline

Activity: 314



View Profile
March 16, 2011, 11:17:33 PM
 #1

Follow the rules!

I've put up a wiki page listing the rules used by the client to process transactions and blocks. It's a bit linear and could benefit from some refactoring, but I didn't want to go too far in terms of pseudocode, because IMO it obscures the logic.

https://en.bitcoin.it/wiki/Protocol_rules

Hal Finney
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1480747338
Hero Member
*
Offline Offline

Posts: 1480747338

View Profile Personal Message (Offline)

Ignore
1480747338
Reply with quote  #2

1480747338
Report to moderator
jgarzik
Legendary
*
qt
Offline Offline

Activity: 1470


View Profile
March 17, 2011, 12:39:09 AM
 #2

Good stuff.  Glad this is written down somewhere outside the source code.

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

Activity: 98


View Profile
March 17, 2011, 01:03:52 AM
 #3

Nice work, thanks.

I've added some explanations for some of the more obscure rules, and removed a redundant step.

Like my answer? Did I help? Tips gratefully accepted here: 1H6wM8Xj8GNrhqWBrnDugd8Vf3nAfZgMnq
Gavin Andresen
Legendary
*
qt
Offline Offline

Activity: 1652


Chief Scientist


View Profile WWW
March 17, 2011, 01:31:58 AM
 #4

Very nice!

The 'sig opcount <= 2' rule for tx relaying is slated to change with the 'sendmany' patch I pulled on Monday.

The new rule will be 'sig opcount <= size/34

Code:
    // Checking ECDSA signatures is a CPU bottleneck, so to avoid denial-of-service                                                       
    // attacks disallow transactions with more than one SigOp per 34 bytes.                                                               
    // 34 bytes because a TxOut is:                                                                                                       
    //   20-byte address + 8 byte bitcoin amount + 5 bytes of ops + 1 byte script length                                                 
    if (GetSigOpCount() > nSize / 34 || nSize < 100)
return error("AcceptToMemoryPool() : nonstandard transaction");

How often do you get the chance to work on a potentially world-changing project?
JollyGreen
Jr. Member
*
Offline Offline

Activity: 42


View Profile
March 17, 2011, 05:07:05 AM
 #5

Follow the rules!

I've put up a wiki page listing the rules used by the client to process transactions and blocks. It's a bit linear and could benefit from some refactoring, but I didn't want to go too far in terms of pseudocode, because IMO it obscures the logic.

https://en.bitcoin.it/wiki/Protocol_rules


This is a great idea, I think we should do this for a lot of the bitcoin code, it took a while to wrap my head around a lot of the algorithms in the bitcoin source.

Want to donate?
1H6WepEWuJkicvfki8PSrEaT8SUnUHAJKs
mitchy
Newbie
*
Offline Offline

Activity: 6


View Profile WWW
March 19, 2011, 08:09:26 PM
 #6

I was very curious and searched for a day to try and learn exactly step by step what the formula was for Generating a Block. A plaintext spec would have helped . I've nearly reached my quota of reading math i barely comprehend Smiley

Thx for the post and yes I agree to clarifying a lot of the bitcoin code. I searched a few times for an RFC but only found the first whitepaper and misc source.


Backup your wallet !!
Mike Hearn
Legendary
*
expert
Offline Offline

Activity: 1526


View Profile
March 21, 2011, 09:54:20 AM
 #7

Thanks Hal, this will be very useful.
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!