2025-01-16 11:31:50 +01:00

20 lines
555 B
C#

using Nethereum.Hex.HexConvertors.Extensions;
using Nethereum.Web3.Accounts;
using Utils;
namespace GethPlugin
{
public static class EthAccountGenerator
{
public static EthAccount GenerateNew()
{
var ecKey = Nethereum.Signer.EthECKey.GenerateKey();
var privateKey = ecKey.GetPrivateKeyAsBytes().ToHex();
var account = new Account(privateKey);
var ethAddress = new EthAddress(account.Address);
return new EthAccount(ethAddress, account.PrivateKey);
}
}
}