original_docstring: derive the master extended private key from the seed
docstring: derive the master extended private key from the seed
docstring_tokens: derive the master extended private key from the seed
code: def xmprv_from_seed(seed: Octets, version: Octets) -> bytes:
      """derive the master extended private key from the seed"""
  
      if isinstance(version, str):  # hex string
          version = bytes.fromhex(version)
      if version not in PRV:
          m = f"invalid private version ({version})"
          raise ValueError(m)
  
      # serialization data
      xmprv = version                               # version
      xmprv += b'\x00'                              # depth
      xmprv += b'\x00\x00\x00\x00'                  # parent pubkey fingerprint
      xmprv += b'\x00\x00\x00\x00'                  # child index
  
      # actual extended key (key + chain code) derivation
      if isinstance(seed, str):  # hex string
          seed = bytes.fromhex(seed)
      hd = HMAC(b"Bitcoin seed", seed, sha512).digest()
      mprv = int_from_octets(hd[:32])
      xmprv += hd[32:]                              # chain code
      xmprv += b'\x00' + mprv.to_bytes(32, 'big')   # private key
  
      return base58.encode_check(xmprv)
code_tokens: def xmprv_from_seed ( seed : Octets , version : Octets ) -> bytes : if isinstance ( version , str ) : version = bytes . fromhex ( version ) if version not in PRV : m = f"invalid private version ({version})" raise ValueError ( m ) xmprv = version xmprv += b'\x00' xmprv += b'\x00\x00\x00\x00' xmprv += b'\x00\x00\x00\x00' if isinstance ( seed , str ) : seed = bytes . fromhex ( seed ) hd = HMAC ( b"Bitcoin seed" , seed , sha512 ) . digest ( ) mprv = int_from_octets ( hd [ : 32 ] ) xmprv += hd [ 32 : ] xmprv += b'\x00' + mprv . to_bytes ( 32 , 'big' ) return base58 . encode_check ( xmprv )
short_docstring: derive the master extended private key from the seed
short_docstring_tokens: derive the master extended private key from the seed
comment: """derive the master extended private key from the seed"""$SEP$# hex string$SEP$# serialization data$SEP$# version$SEP$# depth$SEP$# parent pubkey fingerprint$SEP$# child index$SEP$# actual extended key (key + chain code) derivation$SEP$# hex string$SEP$# chain code$SEP$# private key