Exemplo n.º 1
0
        public static Wallet NewWallet(string password, EnvironmentInfo environment)
        {
            var key = CryptoUtility.GenerateKey(password, environment.Hrp);

            Wallet wallet = new Wallet();

            wallet.IsOpen        = true;
            wallet.PrivateKey    = key.PrivateKey;
            wallet.Environment   = environment;
            wallet.Address       = key.Address;
            wallet.MnemonicWords = key.Mnemonic;
            wallet.EcKey         = GetECKey(wallet.PrivateKey);
            wallet.AddressBytes  = wallet.EcKey.PubKey.Hash.ToBytes();
            wallet.PubKeyForSign = GetPubKeyForSign(wallet.EcKey.PubKey.ToBytes());

            return(wallet);
        }