Esempio n. 1
0
        public static KeyPair GetKeysFromNep2(string nep2, string passphrase, ScryptParameters scryptParameters)
        {
            byte[]  privateKey = Nep2.DecryptKey(nep2, passphrase, scryptParameters);
            KeyPair key        = new KeyPair(privateKey);

            Array.Clear(privateKey, 0, privateKey.Length);
            return(key);
        }
Esempio n. 2
0
 public Wallet(string name, ScryptParameters scryptParameters = null, object extra = null)
 {
     Name     = name ?? "default";
     Version  = "1.0";
     Scrypt   = scryptParameters ?? new ScryptParameters();
     Accounts = new List <Account>();
     Extra    = extra ?? null;
 }
        public static Account Create(string label, bool isDefault, bool isLock, string passphrase,
                                     ScryptParameters scryptParameters)
        {
            var     keys           = CreateKey();
            UInt160 scriptHash     = CreateSignatureRedeemScript(keys.PublicKey).ToScriptHash();
            string  address        = Wallet.ToAddress(scriptHash);
            string  nepKey         = Crypto.Nep2.EncryptKey(passphrase, keys, scryptParameters);
            Account createdAccount = new Account(address, label, isDefault, isLock, nepKey)
            {
                Contract = new Contract(scriptHash.ToString(), new[] //testing
                {
                    new Parameter("operation", ParameterType.String),
                    new Parameter("args", ParameterType.Array)
                })
            };

            return(createdAccount);
        }