How can I create an eos account in c#. I have generated the eos public and private keys using c#. Now i want to create an eos account in c# using the generated public key. Can someone guide me how to create it?
1 Answer
You can use EosSharp or ScatterSharp (includes EosSharp). In both cases, if you want to create a new account the common way, the transaction would look like this:
string newAcc = "mynewaccount";
var result = await eos.CreateTransaction(new EosSharp.Core.Api.v1.Transaction()
{
actions = new List<EosSharp.Core.Api.v1.Action>()
{
new EosSharp.Core.Api.v1.Action()
{
account = "eosio.system",
authorization = new List<PermissionLevel>()
{
new PermissionLevel() {actor = account.name, permission = account.authority}
},
name = "newaccount",
data = new { creator = account.name, name = newAcc, owner = "EOSMYPUBLICKEYABC345AJJD...", active = "EOSMYPUBLICKEYABC345AJJD..." }
},
new EosSharp.Core.Api.v1.Action()
{
account = "eosio.system",
authorization = new List<PermissionLevel>()
{
new PermissionLevel() {actor = account.name, permission = account.authority}
},
name = "buyrambytes",
data = new { creator = account.name, name = newAcc, bytes = 1024}
},
new EosSharp.Core.Api.v1.Action()
{
account = "eosio.system",
authorization = new List<PermissionLevel>()
{
new PermissionLevel() {actor = account.name, permission = account.authority}
},
name = "delegatebw",
data = new { creator = account.name, name = newAcc, stake_net_quantity = 0.100, stake_cpu_quantity = 0.100, transfer = false}
}
}
});
You can find more information about the different system-conract-actions here eosio.system