コード例 #1
0
        public IHDNode Derive(uint index)
        {
            switch (this.NodeType)
            {
            case HDNodeType.Mnemonic:
            {
                string derivePath = string.Format("{0}/{1}", this._wallet.Path, index.ToString());
                return(new HDNode(new Wallet(Mnemonic.WordsJoin(this._wallet.Words), derivePath), this.NodeType));
            }

            case HDNodeType.Seed:
            {
                string derivePath = string.Format("{0}/{1}", this._wallet.Path, index.ToString());
                return(new HDNode(new Wallet(this._wallet.Seed.ToBytes(), derivePath), this.NodeType));
            }

            case HDNodeType.PrivateKey:
            {
                ExtKey childKey = this._masterKey.Derive(index);
                return(new HDNode(childKey));
            }

            default:
            {
                return(null);
            }
            }
        }
コード例 #2
0
ファイル: Mnemonic.cs プロジェクト: furuknap/VeChainTest
 public static bool Validate(string[] words)
 {
     try
     {
         NBitcoin.Mnemonic mnemonic = new NBitcoin.Mnemonic(Mnemonic.WordsJoin(words));
         return(true);
     }
     catch
     {
         return(false);
     }
 }
コード例 #3
0
 /// <summary>
 /// instantiation a HDNode with words
 /// </summary>
 /// <param name="words"></param>
 /// <param name="path"> vechain default path is m/44'/818'/0'/0/address_index</param>
 /// <returns></returns>
 public HDNode(string[] words, string path = VeChainConstant.VET_DERIVATION_PATH) : this(new Wallet(Mnemonic.WordsJoin(words), "", path), HDNodeType.Mnemonic)
 {
 }