Exemplo n.º 1
0
        public async Task AccountCreateTest()
        {
            var name = "userlogin";

            var op = new AccountCreateOperation
            {
                Fee            = new Asset(3000, Config.SteemAssetNumSteem),
                Creator        = User.Login,
                NewAccountName = User.Login,
                JsonMetadata   = "",
            };

            var privateKey = Secp256K1Manager.GenerateRandomKey();
            var privateWif = "P" + Base58.EncodePrivateWif(privateKey);

            var subWif       = Base58.GetSubWif(name, privateWif, "owner");
            var pk           = Base58.DecodePrivateWif(subWif);
            var subPublicKey = Secp256K1Manager.GetPublicKey(pk, true);

            op.Owner.KeyAuths.Add(new KeyValuePair <PublicKeyType, ushort>(new PublicKeyType(subPublicKey), 1));

            subWif       = Base58.GetSubWif(name, privateWif, "active");
            pk           = Base58.DecodePrivateWif(subWif);
            subPublicKey = Secp256K1Manager.GetPublicKey(pk, true);
            op.Active.KeyAuths.Add(new KeyValuePair <PublicKeyType, ushort>(new PublicKeyType(subPublicKey), 1));

            subWif       = Base58.GetSubWif(name, privateWif, "posting");
            pk           = Base58.DecodePrivateWif(subWif);
            subPublicKey = Secp256K1Manager.GetPublicKey(pk, true);
            op.Posting.KeyAuths.Add(new KeyValuePair <PublicKeyType, ushort>(new PublicKeyType(subPublicKey), 1));

            subWif       = Base58.GetSubWif(name, privateWif, "memo");
            pk           = Base58.DecodePrivateWif(subWif);
            subPublicKey = Secp256K1Manager.GetPublicKey(pk, true);
            op.MemoKey   = new PublicKeyType(subPublicKey);

            var response = Post(User.ActiveKeys, false, op);

            Assert.IsFalse(response.IsError, response.GetErrorMessage());
        }
Exemplo n.º 2
0
        public async Task AccountCreateTest()
        {
            string name = User.Login + DateTime.Now.Ticks;

            var op = new AccountCreateOperation
            {
                Fee            = new Asset(3000, Config.SteemAssetNumSteem),
                Creator        = User.Login,
                NewAccountName = User.Login,
                JsonMetadata   = ""
            };

            var privateKey = Secp256K1Manager.GenerateRandomKey();
            var privateWif = "P" + Base58.EncodePrivateWif(privateKey);

            var subWif       = Base58.GetSubWif(name, privateWif, "owner");
            var pk           = Base58.DecodePrivateWif(subWif);
            var subPublicKey = Secp256K1Manager.GetPublicKey(pk, true);

            op.Owner.KeyAuths.Add(new KeyValuePair <PublicKeyType, ushort>(new PublicKeyType(subPublicKey), 1));

            subWif       = Base58.GetSubWif(name, privateWif, "active");
            pk           = Base58.DecodePrivateWif(subWif);
            subPublicKey = Secp256K1Manager.GetPublicKey(pk, true);
            op.Active.KeyAuths.Add(new KeyValuePair <PublicKeyType, ushort>(new PublicKeyType(subPublicKey), 1));

            subWif       = Base58.GetSubWif(name, privateWif, "posting");
            pk           = Base58.DecodePrivateWif(subWif);
            subPublicKey = Secp256K1Manager.GetPublicKey(pk, true);
            op.Posting.KeyAuths.Add(new KeyValuePair <PublicKeyType, ushort>(new PublicKeyType(subPublicKey), 1));

            subWif       = Base58.GetSubWif(name, privateWif, "memo");
            pk           = Base58.DecodePrivateWif(subWif);
            subPublicKey = Secp256K1Manager.GetPublicKey(pk, true);
            op.MemoKey   = new PublicKeyType(subPublicKey);

            await Post(User.ActiveKeys, false, op).ConfigureAwait(false);
        }