Esempio n. 1
0
        // public static KeyPair GetUser1KeyPair() =>
        // GetKeyPair("");


        public static KeyPair GetKeyPair(string privateKey)
        {
            var adminPrivateKey =
                PrivateKey.Parse(privateKey);

            return(new KeyPair(adminPrivateKey));
        }
        /// <summary>
        /// Send Asset Method
        /// </summary>
        /// <param name="client"></param>
        /// <returns>tx.Id</returns>
        public async Task <Tuple <string, string> > Send(Address myaddress, Address opponetaddress, decimal amount)
        {
            var client     = SetClient();
            var generalApi = new GeneralApi(client);
            var from       = myaddress;
            var to         = opponetaddress;

            System.Diagnostics.Debug.WriteLine(myaddress);
            System.Diagnostics.Debug.WriteLine(opponetaddress);
            System.Diagnostics.Debug.WriteLine(amount);
            var privatekey = new[] { PrivateKey.Parse("263b6a4606168f64aca7c5ac1640ecb52a36142b0d96b07cb520de2eb4d237e5") };

            System.Diagnostics.Debug.WriteLine(PrivateKey.Parse("263b6a4606168f64aca7c5ac1640ecb52a36142b0d96b07cb520de2eb4d237e5"));
            // enter the send amount
            var moveCoin = new AssetMove(TableName, amount, from, to);

            System.Diagnostics.Debug.WriteLine(moveCoin);
            var move = new ITransactionEntry[] { moveCoin };

            System.Diagnostics.Debug.WriteLine(move);
            Transaction tx = TransactionCreator.SimpleSignedTransaction(moveCoin, privatekey);

            await this.SendTransaction(tx);

            var result = await Utils.WaitTx(generalApi, tx.Id);

            return(new Tuple <string, string>(tx.Id.ToString(), result));
        }
Esempio n. 3
0
        /// <summary>
        ///  プライベートキー文字列のParse
        /// </summary>
        /// <param name="privateKey"></param>
        /// <returns></returns>
        public KeyPair GetKeyPair(string privateKey)
        {
            PrivateKey adminPrivateKey;

            try
            {
                adminPrivateKey = PrivateKey.Parse(privateKey);
            }
            catch (Exception)
            {
                //失敗のHTTPリクエストを投げるようにする
                return(null);
            }
            return(new KeyPair(adminPrivateKey));
        }
Esempio n. 4
0
        private string Inputprivatekeyjudgement(string privatekey)
        {
            try
            {
                var value = PrivateKey.Parse(privatekey);
            }
            catch (Exception)
            {
                Form5 frmform5 = new Form5();
                frmform5.ShowDialog();
                privatekey = null;
            }

            return(privatekey);
        }
Esempio n. 5
0
            /**
             * Create the Asset table for Alice.
             */
            async Task <string> CreateTable()
            {
                var aliceAddress = _aliceWallet.GetAddress();

                // Create a new asset table with alice's address set as a owner.
                // A Table admin key is required to send this transaction.
                var assetTable = new CreateTable(new AssetTableDescriptor(
                                                     TOKEN_NAME, false, false, new[] { aliceAddress }));
                var memo = new MemoEntry(new[] { "Point system for Alice's shops" });

                var tx = TransactionCreator.SimpleSignedTransaction(
                    new ITransactionEntry[] { assetTable, memo },
                    new[] { PrivateKey.Parse(TABLE_ADMIN_PRIVATE_KEY) });

                await _transactionService.SendTransaction(tx);

                return(tx.Id.ToString());
            }