BitcoinLib.Services.CoinService.GetMyPublicAndPrivateKeyPairs C# (CSharp) Method

GetMyPublicAndPrivateKeyPairs() public method

public GetMyPublicAndPrivateKeyPairs ( ) : string>.Dictionary
return string>.Dictionary
        public Dictionary<string, string> GetMyPublicAndPrivateKeyPairs()
        {
            const short secondsToUnlockTheWallet = 30;
            var keyPairs = new Dictionary<string, string>();
            WalletPassphrase(Parameters.WalletPassword, secondsToUnlockTheWallet);
            var myAddresses = (this as ICoinService).ListReceivedByAddress(0, true);

            foreach (var listReceivedByAddressResponse in myAddresses)
            {
                var validateAddressResponse = ValidateAddress(listReceivedByAddressResponse.Address);

                if (validateAddressResponse.IsMine && validateAddressResponse.IsValid && !validateAddressResponse.IsScript)
                {
                    var privateKey = DumpPrivKey(listReceivedByAddressResponse.Address);
                    keyPairs.Add(validateAddressResponse.PubKey, privateKey);
                }
            }

            WalletLock();
            return keyPairs;
        }