Ejemplo n.º 1
0
        public static KeyRing Recover(string mnemonic, string password, string walletFilePath, Network network)
        {
            var wallet = new KeyRing(password, walletFilePath, network, mnemonic);

            wallet.Save(password);
            return(wallet);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Creates a mnemonic, a seed, encrypts it and stores in the specified path.
        /// </summary>
        /// <param name="mnemonic">empty string</param>
        /// <param name="password"></param>
        /// <param name="walletFilePath"></param>
        /// <param name="network"></param>
        /// <returns>KeyRing</returns>
        public static KeyRing Create(out string mnemonic, string password, string walletFilePath, Network network)
        {
            var wallet = new KeyRing(walletFilePath, network);

            mnemonic = wallet.SetSeed(password).ToString();
            wallet.Save(password);
            return(wallet);
        }
Ejemplo n.º 3
0
        public static KeyRing Load(string password, string walletFilePath)
        {
            var walletFileRawContent = KeyRingStore.Read(walletFilePath);

            var encryptedBitcoinPrivateKeyString = walletFileRawContent.EncryptedSeed;
            var chainCodeString = walletFileRawContent.ChainCode;
            var network         = walletFileRawContent.Network;
            var chainCode       = Convert.FromBase64String(chainCodeString);

            var wallet = new KeyRing(walletFilePath, network);

            var privateKey = Key.Parse(encryptedBitcoinPrivateKeyString, password, wallet._network);
            var seedExtKey = new ExtKey(privateKey, chainCode);

            wallet.SetSeed(seedExtKey);
            return(wallet);
        }
Ejemplo n.º 4
0
 public LimitedKeyRing(KeyRing safe, int addressCount) : base(safe)
 {
     AddressCount = addressCount;
 }
Ejemplo n.º 5
0
 public KeyRing(KeyRing wallet)
 {
     _network        = wallet._network;
     _seedPrivateKey = wallet._seedPrivateKey;
     KeyRingFilePath = wallet.KeyRingFilePath;
 }