private async Task <ECKeyPair> GetAccountKeyPairAsync() { var nodeAccount = _accountOptions.NodeAccount; var nodePassword = _accountOptions.NodeAccountPassword ?? string.Empty; if (string.IsNullOrWhiteSpace(nodeAccount)) { var accountList = await _keyStore.GetAccountsAsync(); if (accountList.Count == 0) { var keyPair = await _keyStore.CreateAccountKeyPairAsync(nodePassword); nodeAccount = Address.FromPublicKey(keyPair.PublicKey).ToBase58(); } else { nodeAccount = accountList.First(); } } var accountKeyPair = _keyStore.GetAccountKeyPair(nodeAccount); if (accountKeyPair == null) { await _keyStore.UnlockAccountAsync(nodeAccount, nodePassword); accountKeyPair = _keyStore.GetAccountKeyPair(nodeAccount); } return(accountKeyPair); }