Esempio n. 1
0
        public Home()
        {
            InitializeComponent();

            var f = Directory.GetFiles(".", "*.csv");

            if (f.Any())
            {
                tbPathToDump.Text = f[0];
            }

            IsTestnet    = bool.Parse(ConfigurationManager.AppSettings["IsTestnet"]);
            _login       = ConfigurationManager.AppSettings["Login"];
            _privateKeys = new List <byte[]>
            {
                Base58.DecodePrivateWif(ConfigurationManager.AppSettings["PrivateActiveWif"])
            };

            HttpClient = new RepeatHttpClient();
            Api        = new OperationManager(HttpClient)
            {
                ChainUrl  = ConfigurationManager.AppSettings["ChainUrl"], // path to EOS node
                WalletUrl = ConfigurationManager.AppSettings["WalletUrl"] // path to EOS Wallet (if needed)
            };

            Load        += Home_Load;
            FormClosing += Home_FormClosing;
        }
Esempio n. 2
0
        public async Task AccountCreateTest()
        {
            const string name = "userlogin";

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

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

            var subWif = Base58.GetSubWif(name, privateWif, "owner");

            Console.WriteLine(subWif);
            var pk           = Base58.DecodePrivateWif(subWif);
            var subPublicKey = Secp256K1Manager.GetPublicKey(pk, true);

            Console.WriteLine(Base58.EncodePublicWif(subPublicKey, Config.KeyPrefix));
            op.Owner.KeyAuths.Add(new KeyValuePair <PublicKeyType, ushort>(new PublicKeyType(subPublicKey), 1));

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

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

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

            await Post(User.ActiveKeys, false, op).ConfigureAwait(false);
        }
Esempio n. 3
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());
        }
Esempio n. 4
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);
        }