BIP32: specify the maximum depth of 255 #2322

pull fametrano wants to merge 2 commits into bitcoin:master from fametrano:bip32-max-depth changing 1 files +12 −0
  1. fametrano commented at 7:41 AM on October 2, 2026: contributor

    BIP32 serializes the depth as one byte but does not say what happens when deriving past depth 255. Bitcoin Core refuses, while several libraries let the depth overflow (bitcoin/bitcoin#32201). In that issue @sipa said a hard limit is better for interoperability and that he would add a note to the BIP: https://github.com/bitcoin/bitcoin/issues/32201#issuecomment-3847331033

    I added that note: deriving a child of a depth-255 key must fail. I also added test vector 6, with the keys at depth 255 on the chain m/0/0/.../0 (255 levels). I checked them with Bitcoin Core 31.1 and btclib-wallet, and both refuse to derive any child of them.

    I left out the derivation path parsing rules raised in bitcoin/bitcoin#35306. I am happy to add them here if reviewers prefer.

    Made with my usual tools: a computer, the Internet and an LLM. The mistakes, as usual, are all mine.

  2. BIP32: specify the maximum depth of 255
    The depth is serialized as one byte. Deriving a child of a depth-255
    key must fail, as Bitcoin Core already does.
    ca1cb3351d
  3. BIP32: add test vectors for the maximum depth
    Test vector 6 gives the keys at depth 255 on the chain m/0/.../0.
    Deriving any child of them must fail.
    fe2bd469d0
Contributors

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bips. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-10-14 03:10 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me