mirror of
https://github.com/logos-storage/logos-storage-nim-cs-dist-tests.git
synced 2026-01-03 05:53:12 +00:00
20 lines
555 B
C#
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);
|
|
}
|
|
}
|
|
}
|