/ ProjectPlugins / GethPlugin / EthAccountGenerator.cs
EthAccountGenerator.cs
 1  using Nethereum.Hex.HexConvertors.Extensions;
 2  using Nethereum.Web3.Accounts;
 3  using Utils;
 4  
 5  namespace GethPlugin
 6  {
 7      public static class EthAccountGenerator
 8      {
 9          public static EthAccount GenerateNew()
10          {
11              var ecKey = Nethereum.Signer.EthECKey.GenerateKey();
12              var privateKey = ecKey.GetPrivateKeyAsBytes().ToHex();
13              var account = new Account(privateKey);
14              var ethAddress = new EthAddress(account.Address);
15  
16              return new EthAccount(ethAddress, account.PrivateKey);
17          }
18      }
19  }