BlockchainCommons / Learning-Bitcoin-from-the-Command-Line

A complete course for learning Bitcoin programming and usage from the command
3.11k stars 753 forks source link

Section 9.3: nSequence clarification & Scripting tool #38

Closed chinitadelrey closed 6 years ago

chinitadelrey commented 6 years ago
  1. In section 9.3, you write that " with a nVersion value of 2, a nSequence value of 0x00000001 to 0xf0000000-1 allows relative timelock, RBF, and nTimeLock"

However, if the 32nd bit needs to be 0 for relative timelock, would that not imply that we cannot have 0xf as as the first hexadecimal character?

0x f000 0000 - 1 = 0x efff ffff. This translates to (1110) for the first hex character f, which would flag the 32nd bit.

0111 1111 .... 5 times (1111).... 1111 = 7fff ffff

Instead, the hexadecimal notation should be 0x00000001 to 0x7fffffff? If I am wrong, help me understand what am I missing out here?

  1. Haven't used this yet but might be helpful to take a look at this as you write the chapter on P2SH out - https://docs.ivy-lang.org/bitcoin/ Thanks for your help!
shannona commented 6 years ago

Thanks much. I had to look back through the BIP 68, and you're totally correct. We just had our bits and bytes confused.