Пример #1
0
        public static ExtendedKeyPathBip44 CreateBip44(uint coinIndex, uint accountIndex = 0)
        {
            var keyPath = new ExtendedKeyPathBip44 {
                Items = new List <uint>()
            };

            //// populate the items according to the BIP44 path
            //// [m/purpose'/coin_type'/account'/change/address_index]

            keyPath.Items.Add(ExtendedKey.ToHadrendIndex(44));
            keyPath.Items.Add(ExtendedKey.ToHadrendIndex(coinIndex));
            keyPath.Items.Add(ExtendedKey.ToHadrendIndex(accountIndex));

            return(keyPath);
        }
Пример #2
0
        public static ExtendedKeyPathBip44 ParseBip44(string path)
        {
            Guard.Require(path.StartsWith("m/"));

            var keyPath = new ExtendedKeyPathBip44
            {
                Path  = path,
                Items = path.Substring(2).Split('/').Select(ConvertPathItem).ToList()
            };

            Guard.Require(keyPath.Index(0) == ExtendedKey.ToHadrendIndex(44));
            Guard.Require(keyPath.IsHardendIndex(1));
            Guard.Require(keyPath.IsHardendIndex(2));

            return(keyPath);
        }