1

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?

3
  • 1
    Could you share a repository where you generate the keys with C#? Commented Mar 4, 2019 at 12:32
  • same question here.
    – cmadh
    Commented Mar 4, 2019 at 23:14
  • Could you share a repository where you generate the keys with C#? Commented Aug 13, 2019 at 10:10

1 Answer 1

1

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 and acknowledge you have read our privacy policy.

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