Author

Topic: The first rule of Bitcoin is... (Read 1567 times)

legendary
Activity: 1526
Merit: 1134
March 21, 2011, 04:54:20 AM
#7
Thanks Hal, this will be very useful.
newbie
Activity: 6
Merit: 0
March 19, 2011, 03: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.

newbie
Activity: 42
Merit: 0
March 17, 2011, 12: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.
legendary
Activity: 1652
Merit: 2301
Chief Scientist
March 16, 2011, 08:31:58 PM
#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");
member
Activity: 98
Merit: 20
March 16, 2011, 08:03:52 PM
#3
Nice work, thanks.

I've added some explanations for some of the more obscure rules, and removed a redundant step.
legendary
Activity: 1596
Merit: 1100
March 16, 2011, 07:39:09 PM
#2
Good stuff.  Glad this is written down somewhere outside the source code.
Hal
vip
Activity: 314
Merit: 4276
March 16, 2011, 06: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
Jump to: