/// <summary> /// Initializes a new instance of <see cref="BIP0085"/>. /// </summary> /// <exception cref="ArgumentException"/> /// <exception cref="ArgumentNullException"/> /// <exception cref="ArgumentOutOfRangeException"/> /// <exception cref="FormatException"/> /// <param name="masterExtendedKey">Master extended key (xprv string)</param> /// <param name="netType"> /// [Default value = <see cref="NetworkType.MainNet"/>] /// The expected network that this extended key belongs to. /// </param> public BIP0085(string masterExtendedKey, NetworkType netType = NetworkType.MainNet) { bip32 = new BIP0032(masterExtendedKey, netType); ReadOnlySpan <byte> empty = new byte[4]; if (!empty.SequenceEqual(bip32.ChildNumber) || !empty.SequenceEqual(bip32.ParentFingerPrint)) { throw new ArgumentException("BIP-85 is only defined for master extended keys.", nameof(masterExtendedKey)); } hmac = new HmacSha512(); }