0

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
    Could you share a repository where you generate the keys with C#? – Phillip Hamnett - EOS42 Mar 4 at 12:32
  • same question here. – cmadh Mar 4 at 23:14
  • Could you share a repository where you generate the keys with C#? – xuehui zhang Aug 13 at 10:10
0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.