예제 #1
0
파일: Demo.cs 프로젝트: uvmetal/neo-lux
        static void Main(string[] args)
        {
            // NOTE - You can also create an API instance for a specific private net
            var api = NeoDB.ForTestNet();

            // NOTE - Private keys should not be hardcoded in the code, this is just for demonstration purposes!
            var privateKey = "a9e2b5436cab6ff74be2d5c91b8a67053494ab5b454ac2851f872fb0fd30ba5e";

            Console.WriteLine("*Loading NEO address...");
            var keys = new KeyPair(privateKey.HexToBytes());

            Console.WriteLine("Got :" + keys.address);

            // it is possible to optionally obtain also token balances with this method
            Console.WriteLine("*Syncing balances...");
            var balances = api.GetBalancesOf(keys.address, false);

            foreach (var entry in balances)
            {
                Console.WriteLine(entry.Value + " " + entry.Key);
            }

            // TestInvokeScript let's us call a smart contract method and get back a result
            // NEP5 https://github.com/neo-project/proposals/issues/3

            api = NeoDB.ForMainNet();
            var redPulse = api.GetToken("RPX");

            // you could also create a NEP5 from a contract script hash
            //var redPulse_contractHash = "ecc6b20d3ccac1ee9ef109af5a7cdb85706b1df9";
            //var redPulse = new NEP5(api, redPulse_contractHash);

            Console.WriteLine("*Querying Symbol from RedPulse contract...");
            //var response = api.TestInvokeScript(redPulse_contractHash, "symbol", new object[] { "" });
            //var symbol = System.Text.Encoding.ASCII.GetString((byte[])response.result);
            var symbol = redPulse.Symbol;

            Console.WriteLine(symbol); // should print "RPX"

            // here we get the RedPulse token balance from an address
            Console.WriteLine("*Querying BalanceOf from RedPulse contract...");
            //var balance = api.GetTokenBalance("AVQ6jAQ3Prd32BXU5r2Vb3QL1gYzTpFhaf", "RPX");
            var balance = redPulse.BalanceOf("AVQ6jAQ3Prd32BXU5r2Vb3QL1gYzTpFhaf");

            Console.WriteLine(balance);

            Console.WriteLine("Press any key to quit...");
            Console.ReadKey();
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (privateKeyInput.Text.Length == 52)
            {
                keyPair = KeyPair.FromWIF(privateKeyInput.Text);
            }
            else
            if (privateKeyInput.Text.Length == 64)
            {
                var keyBytes = privateKeyInput.Text.HexToBytes();
                keyPair = new KeyPair(keyBytes);
            }
            else
            {
                MessageBox.Show("Invalid key input, must be 104 or 64 hexdecimal characters.");
                return;
            }

            var net = netComboBox.SelectedItem.ToString();

            switch (net)
            {
            case "Test": api = NeoDB.ForTestNet(); break;

            case "Main": api = NeoDB.ForMainNet(); break;

            default:
            {
                MessageBox.Show("Invalid net.");
                return;
            }
            }


            tabs.TabPages.Remove(loginPage);
            tabs.TabPages.Add(loadingPage);

            timer1.Enabled = true;

            var task = new Task(() => OpenWallet());

            task.Start();
        }
예제 #3
0
        static void Main(string[] args)
        {
            if (args.Length < 5)
            {
                Console.WriteLine("neo-sender <Net> <PrivateKey> <DestAddress> <Symbol> <Amount>");
                Console.WriteLine("Net          Can be Main, Test or custom URL");
                Console.WriteLine("PrivateKey   Can be a full hex private key or a WIF private key");
                Console.WriteLine("DestAddress  Must be a valid Neo address");
                Console.WriteLine("Symbol       Must be Neo, Gas or any support token (eg: RPX, DBC)");
                return;
            }

            var keyStr        = args[1];
            var outputAddress = args[2];

            var symbol = args[3].ToUpper();   //"GAS"

            string amountStr = args[4];

            amountStr = amountStr.Replace(",", ".");
            var amount = Decimal.Parse(amountStr, CultureInfo.InvariantCulture);

            if (amount <= 0 || amount > 10000000)
            {
                Console.WriteLine("Invalid amount: " + amount);
                return;
            }

            var fromKey = keyStr.Length == 52 ? KeyPair.FromWIF(keyStr) : new KeyPair(keyStr.HexToBytes());

            Console.WriteLine($"Sending {amount} {symbol} from {fromKey.address} to {outputAddress}");

            var    net = args[0].ToLowerInvariant();
            NeoAPI api;

            switch (net)
            {
            case "main":
                api = NeoDB.ForMainNet();
                // api = NeoDB.NewCustomRPC("http://api.wallet.cityofzion.io", "http://seed2.cityofzion.io:8080");
                break;

            case "test":
                api = NeoDB.ForTestNet();
                break;

            default:
                Console.Error.WriteLine("invalid net");
                return;
            }

            Transaction tx = null;

            try
            {
                if (api.IsToken(symbol))
                {
                    var token = api.GetToken(symbol);
                    tx = token.Transfer(fromKey, outputAddress, amount);
                }
                else
                if (api.IsAsset(symbol))
                {
                    tx = api.SendAsset(fromKey, outputAddress, symbol, amount);
                }
                else
                {
                    Console.WriteLine("Unknown symbol.");
                    Environment.Exit(-1);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Error executing transaction. " + e.Message);
                Environment.Exit(-1);
            }

            if (tx != null)
            {
                Console.WriteLine("Transaction hash: " + tx.Hash);
            }
            else
            {
                Console.WriteLine("Transaction not accepted by mempool");
            }
        }
예제 #4
0
 public void Init()
 {
     api   = NeoDB.ForMainNet();
     token = api.GetToken("RPX");
 }
예제 #5
0
        static void Main()
        {
            var api = NeoDB.ForMainNet();

            string privateKey;
            string scriptHash;

            do
            {
                Console.Write("Enter WIF private key: ");
                privateKey = Console.ReadLine();

                if (privateKey.Length == 52)
                {
                    break;
                }
            } while (true);

            do
            {
                Console.Write("Enter contract script hash: ");
                scriptHash = Console.ReadLine();

                if (scriptHash.StartsWith("0x"))
                {
                    scriptHash = scriptHash.Substring(2);
                }

                if (scriptHash.Length == 40)
                {
                    break;
                }
            } while (true);

            var keys = KeyPair.FromWIF(privateKey);

            string fileName;

#if !MANUAL
            do
            {
                Console.Write("Enter whitelist file name: ");
                fileName = Console.ReadLine();

                if (File.Exists(fileName))
                {
                    break;
                }
            } while (true);

            var lines = File.ReadAllLines(fileName);
#endif

#if FILTER
            var filtered = new HashSet <string>();
#endif

            int skip   = 0;
            int add    = 0;
            int errors = 0;
#if MANUAL
            while (true)
#else
            foreach (var temp in lines)
#endif
            {
#if MANUAL
                Console.Write("Enter address: ");
                var line = Console.ReadLine();
#else
                var line = temp.Trim();
#endif

                if (line.Length != 34 || !line.StartsWith("A"))
                {
                    skip++;
                    //Console.WriteLine("Invalid address");
                    continue;
                }

                try
                {
                    var hash = line.GetScriptHashFromAddress();

                    Console.WriteLine(line + "," + hash.ByteToHex());

                    for (int i = 1; i <= 100; i++)
                    {
                        var p     = api.TestInvokeScript(scriptHash, new object[] { "checkWhitelist", new object[] { hash } });
                        var state = System.Text.Encoding.UTF8.GetString((byte[])p.result);
                        Console.WriteLine(state == "on"?"Done": "Retrying...");

                        if (state == "on")
                        {
                            break;
                        }

#if FILTER
                        filtered.Add(line);
                        break;
#else
                        api.CallContract(keys, scriptHash, "enableWhitelist", new object[] { hash });
                        Console.WriteLine("Waiting for next block... 15seconds");
                        Thread.Sleep(15000);
#endif
                    }
                } catch
                {
                    errors++;
                }

                add++;
            }

#if FILTER
            File.WriteAllLines("filtered.csv", filtered.ToArray());
            Console.WriteLine($"{filtered.Count} addresses still to need to be added the whitelist.");
#else
            Console.WriteLine($"Skipped {skip} invalid addresses.");
            Console.WriteLine($"Failed {errors} addresses due to network errors.");
            Console.WriteLine($"Finished adding {add} addresses to the whitelist.");
#endif

            Console.ReadLine();
        }
예제 #6
0
        static void Main(string[] args)
        {
            // NOTE - You can also create an API instance for a specific private net
            var api = NeoDB.ForTestNet();

            // NOTE - Private keys should not be hardcoded in the code, this is just for demonstration purposes!
            var privateKey = "a9e2b5436cab6ff74be2d5c91b8a67053494ab5b454ac2851f872fb0fd30ba5e";

            Console.WriteLine("*Loading NEO address...");
            var keys = new KeyPair(privateKey.HexToBytes());

            Console.WriteLine("Got :" + keys.address);

            // it is possible to optionally obtain also token balances with this method
            Console.WriteLine("*Syncing balances...");
            var balances = api.GetBalancesOf(keys.address, false);

            foreach (var entry in balances)
            {
                Console.WriteLine(entry.Value + " " + entry.Key);
            }

            //const string NeoDraw_ContractHash = "694ebe0840d1952b09f5435152eebbbc1f8e4b8e";
            //var response = api.TestInvokeScript(NeoDraw_ContractHash, new object[] { "getx", "user", new object[] { "100" } });
            //TEST CASE 1: object[] results = { -1 }; return results; /* WORKS */
            //{ "jsonrpc":"2.0","id":1,
            //  "result":{ "script":"0331303051c104757365720467657478678e4b8e1fbcbbee525143f5092b95d14008be4e69",
            //      "state":"HALT, BREAK","gas_consumed":"0.47",
            //      "stack":[
            //          { "type":"ByteArray", { "value":"756e6b6e6f776e206f7065726174696f6e2027"},
            //          { "type":"Array","value":[
            //              { "type":"Integer","value":"-1"}]}]}}

            //const string NeoDraw_ContractHash = "694ebe0840d1952b09f5435152eebbbc1f8e4b8e";
            //var response = api.TestInvokeScript(NeoDraw_ContractHash, new object[] { "get", "user", new object[] { "100" } });
            //TEST CASE 2: UserCredentials uc = FindUser(AppVAU, encodedUsername); results = new object[] { uc }; return results; /* DOESN'T WORK */
            //{ "jsonrpc":"2.0","id":1,
            //  "result":{ "script":"0331303051c1047573657203676574678e4b8e1fbcbbee525143f5092b95d14008be4e69",
            //      "state":"HALT, BREAK","gas_consumed":"2.082",
            //      "stack":[
            //          { "type":"Array","value":[
            //              {"type":"Array","value":[
            //                  {"type":"ByteArray","value":"313030"},{"type":"ByteArray","value":"313030"},{"type":"Integer","value":"4"},
            //                  {"type":"Boolean","value":false},{"type":"Boolean","value":false},{"type":"Boolean","value":false},
            //                  {"type":"Boolean","value":false},{"type":"Boolean","value":false},{"type":"Boolean","value":false},
            //                  {"type":"Boolean","value":false},{"type":"Boolean","value":false},{"type":"Boolean","value":false},
            //                  {"type":"Boolean","value":false},{"type":"Boolean","value":false},{"type":"Boolean","value":false}]}]}]}}

            //const string NeoDraw_ContractHash = "694ebe0840d1952b09f5435152eebbbc1f8e4b8e";
            //var response = api.TestInvokeScript(NeoDraw_ContractHash, new object[] { "getall", "point", new object[] { "100" } });
            // TEST CASE 3: UserPoint[] points = new UserPoint[(int)nPoints]; results = points; return results;
            //{ "jsonrpc":"2.0","id":1,
            //  "result":{ "script":"0331303051c105706f696e7406676574616c6c678e4b8e1fbcbbee525143f5092b95d14008be4e69",
            //      "state":"HALT, BREAK","gas_consumed":"7.724",
            //      "stack":[
            //          { "type":"Array","value":[
            //              { "type":"Array","value":[
            //                  { "type":"ByteArray","value":"3130"},{"type":"ByteArray","value":"3230"},{"type":"Integer","value":"4"},
            //                  { "type":"Boolean","value":false},{"type":"Boolean","value":false},{"type":"Boolean","value":false},
            //                  { "type":"Boolean","value":false},{"type":"Boolean","value":false},{"type":"Boolean","value":false},
            //                  { "type":"Boolean","value":false},{"type":"Boolean","value":false},{"type":"Boolean","value":false},
            //                  { "type":"Boolean","value":false},{"type":"Boolean","value":false},{"type":"Boolean","value":false}]},
            //              { "type":"Array","value":[
            //                  { "type":"ByteArray","value":"3430"},{"type":"ByteArray","value":"3630"},{"type":"Integer","value":"4"},
            //                  { "type":"Boolean","value":false},{"type":"Boolean","value":false},{"type":"Boolean","value":false},
            //                  { "type":"Boolean","value":false},{"type":"Boolean","value":false},{"type":"Boolean","value":false},
            //                  { "type":"Boolean","value":false},{"type":"Boolean","value":false},{"type":"Boolean","value":false},
            //                  { "type":"Boolean","value":false},{"type":"Boolean","value":false},{"type":"Boolean","value":false}]},
            //              { "type":"Array","value":[
            //                  { "type":"ByteArray","value":"35"},{"type":"ByteArray","value":"35"},{"type":"Integer","value":"4"},
            //                  { "type":"Boolean","value":false},{"type":"Boolean","value":false},{"type":"Boolean","value":false},
            //                  { "type":"Boolean","value":false},{"type":"Boolean","value":false},{"type":"Boolean","value":false},
            //                  { "type":"Boolean","value":false},{"type":"Boolean","value":false},{"type":"Boolean","value":false},
            //                  { "type":"Boolean","value":false},{"type":"Boolean","value":false},{"type":"Boolean","value":false}]}]}]}}                                                                     //TEST CASE 3: UserPoint[] points = new UserPoint[(int)nPoints]; results = points; return results; // DOESN'T WORK

            const string NeoDraw_ContractHash = "694ebe0840d1952b09f5435152eebbbc1f8e4b8e";
            var          response3            = api.TestInvokeScript(NeoDraw_ContractHash, new object[] { "getall", "point", new object[] { "100" } });

            object[] resultsArray3 = (object[])response3.result;
            Console.WriteLine("resultsArray.length: " + resultsArray3.Length);
            for (int element = 0; element < resultsArray3.Length; element++)
            {
                byte[] bx = (byte[])(((object[])((object[])resultsArray3[element])[0])[0]);
                byte[] by = (byte[])(((object[])((object[])resultsArray3[element])[0])[1]);
                string sx = Encoding.ASCII.GetString(bx);
                string sy = Encoding.ASCII.GetString(by);
                Console.WriteLine("sx,sy: " + sx + " " + sy);
                int ix = Int32.Parse(sx);
                int iy = Int32.Parse(sy);
                Console.WriteLine("ix,iy: " + ix.ToString() + " " + iy.ToString());
            }

            const string TestNetAccount_PrivateKey = "40f0cdc78e81005fca121d433e530bd170b0b3fb3bc465cc15d717f0ebdb8674";
            var          TestNetAccount_KeyPair    = new KeyPair(TestNetAccount_PrivateKey.HexToBytes());
            var          response5 = api.CallContract(TestNetAccount_KeyPair, NeoDraw_ContractHash, new object[] { "add", "user", new object[] { "1005", "1006" } });

            var response2 = api.TestInvokeScript(NeoDraw_ContractHash, new object[] { "get", "user", new object[] { "100" } });

            object[] resultsArray2     = (object[])response2.result;
            byte[]   bencodedUsername2 = (byte[])(((object[])((object[])resultsArray2[0])[0])[0]);
            byte[]   bencodedPassword2 = (byte[])(((object[])((object[])resultsArray2[0])[0])[1]);
            string   sencodedUsername2 = Encoding.ASCII.GetString(bencodedUsername2).Replace("\0", "");
            string   sencodedPassword2 = Encoding.ASCII.GetString(bencodedPassword2).Replace("\0", "");

            Console.WriteLine("sencodedUsername2,sencodedPassword2: '" + sencodedUsername2 + "' '" + sencodedPassword2 + "'");
            Console.WriteLine("sencodedUsername2,sencodedPassword2: " + sencodedUsername2.Length + " " + sencodedPassword2.Length + "");

            var response4 = api.TestInvokeScript(NeoDraw_ContractHash, new object[] { "add", "user", new object[] { "1002", "1003" } });

            object[] resultsArray4     = (object[])response4.result;
            byte[]   bencodedUsername4 = (byte[])(((object[])((object[])resultsArray4[0])[0])[1]); //SWAPPED
            byte[]   bencodedPassword4 = (byte[])(((object[])((object[])resultsArray4[0])[0])[0]);
            string   sencodedUsername4 = Encoding.ASCII.GetString(bencodedUsername4).Replace("\0", "");
            string   sencodedPassword4 = Encoding.ASCII.GetString(bencodedPassword4).Replace("\0", "");

            Console.WriteLine("sencodedUsername4,sencodedPassword4: '" + sencodedUsername4 + "' '" + sencodedPassword4 + "'");
            Console.WriteLine("sencodedUsername4,sencodedPassword4: " + sencodedUsername4.Length + " " + sencodedPassword4.Length + "");


            int raIndex = 0;

            foreach (object resultsElement in resultsArray3)
            {
                Console.WriteLine("resultsElement:" + resultsElement.GetType().Name);
                if (resultsElement.GetType().Name != "Object[]")
                {
                    Console.WriteLine("resultsElement:\t" + resultsElement.ToString());
                }
                else
                {
                    int      rIndex  = 0;
                    object[] results = (object[])resultsElement;
                    if (results != null)
                    {
                        Console.WriteLine("results.length: " + results.Length);
                        foreach (object result in results)
                        {
                            Console.WriteLine("result:\t" + raIndex.ToString() + "\t" + rIndex.ToString() + "\t" + result.ToString() + "\t" + result.GetType().Name);
                            if (result.GetType().Name == "Object[]")
                            {
                                int oooooIndex = 0;
                                foreach (object ooooo in (object[])result)
                                {
                                    if (ooooo != null)
                                    {
                                        Console.WriteLine("ooooo:\t" + raIndex.ToString() + "\t" + rIndex.ToString() + "\t" + oooooIndex.ToString() + "\t" + ooooo.ToString() + "\t" + ooooo.GetType().Name);
                                        if (ooooo.GetType().Name == "Object[]")
                                        {
                                            int ooooIndex = 0;
                                            foreach (object oooo in (object[])ooooo)
                                            {
                                                if (oooo != null)
                                                {
                                                    Console.WriteLine("oooo:\t" + raIndex.ToString() + "\t" + rIndex.ToString() + "\t" + oooooIndex.ToString() + "\t" + ooooIndex.ToString() + "\t" + oooo.ToString() + "\t" + oooo.GetType().Name);
                                                    //if (oooo.GetType().Name == "Object[]")
                                                    //{
                                                    //    int oooIndex = 0;
                                                    //    foreach (object ooo in (object[])oooo)
                                                    //    {
                                                    //        if (ooo != null)
                                                    //        {
                                                    //            Console.WriteLine("ooo:\t" + raIndex.ToString() + "\t" + rIndex.ToString() + "\t" + oooooIndex.ToString() + "\t" + ooooIndex.ToString() + "\t" + oooIndex.ToString() + "\t" + ooo.ToString() + "\t" + ooo.GetType().Name);
                                                    //            if (ooo.GetType().Name == "Object[]")
                                                    //            {
                                                    //                int ooIndex = 0;
                                                    //                foreach (object oo in (object[])ooo)
                                                    //                {
                                                    //                    if (oo != null)
                                                    //                    {
                                                    //                        Console.WriteLine("oo:\t" + raIndex.ToString() + "\t" + rIndex.ToString() + "\t" + oooooIndex.ToString() + "\t" + ooooIndex.ToString() + "\t" + oooIndex.ToString() + "\t" + ooIndex.ToString() + "\t" + oo.ToString() + "\t" + oo.GetType().Name);
                                                    //                        if (oo.GetType().Name == "Object[]" && ((object[])oo).Length > 0)
                                                    //                        {
                                                    //                            int oIndex = 0;
                                                    //                            foreach (object o in (object[])oo)
                                                    //                            {
                                                    //                                if (o != null)
                                                    //                                {
                                                    //                                    Console.WriteLine("o:\t" + raIndex.ToString() + "\t" + rIndex.ToString() + "\t" + oooooIndex.ToString() + "\t" + ooooIndex.ToString() + "\t" + oooIndex.ToString() + "\t" + ooIndex.ToString() + "\t" + oIndex.ToString() + "\t" + o.ToString() + "\t" + o.GetType().Name);
                                                    //                                    oIndex++;
                                                    //                                }
                                                    //                            }
                                                    //                        }
                                                    //                        else
                                                    //                        {
                                                    //                            var oo0 = (string)oo;
                                                    //                            Console.WriteLine("oo0:\t" + raIndex.ToString() + "\t" + rIndex.ToString() + "\t" + oooooIndex.ToString() + "\t" + ooooIndex.ToString() + "\t" + oooIndex.ToString() + "\t" + ooIndex.ToString() + "\t" + oo0.ToString() + "\t" + oo0.GetType().Name);
                                                    //                        }
                                                    //                        ooIndex++;
                                                    //                    }
                                                    //                }
                                                    //            }
                                                    //            oooIndex++;
                                                    //        }
                                                    //    }
                                                    //}
                                                    ooooIndex++;
                                                }
                                            }
                                        }
                                        oooooIndex++;
                                    }
                                }
                            }
                            rIndex++;
                        }
                    }
                    raIndex++;
                }
            }

            Console.WriteLine("Press Enter to Exit...");
            Console.ReadLine();

            // TestInvokeScript let's us call a smart contract method and get back a result
            // NEP5 https://github.com/neo-project/proposals/issues/3

            api = NeoDB.ForMainNet();
            var redPulse = api.GetToken("RPX");

            // you could also create a NEP5 from a contract script hash
            //var redPulse_contractHash = "ecc6b20d3ccac1ee9ef109af5a7cdb85706b1df9";
            //var redPulse = new NEP5(api, redPulse_contractHash);

            Console.WriteLine("*Querying Symbol from RedPulse contract...");
            //var response = api.TestInvokeScript(redPulse_contractHash, "symbol", new object[] { "" });
            //var symbol = System.Text.Encoding.ASCII.GetString((byte[])response.result);
            var symbol = redPulse.Symbol;

            Console.WriteLine(symbol); // should print "RPX"

            // here we get the RedPulse token balance from an address
            Console.WriteLine("*Querying BalanceOf from RedPulse contract...");
            //var balance = api.GetTokenBalance("AVQ6jAQ3Prd32BXU5r2Vb3QL1gYzTpFhaf", "RPX");
            var balance = redPulse.BalanceOf("AVQ6jAQ3Prd32BXU5r2Vb3QL1gYzTpFhaf");

            Console.WriteLine(balance);

            Console.WriteLine("Press any key to quit...");
            Console.ReadKey();
        }
예제 #7
0
파일: Sender.cs 프로젝트: uvmetal/neo-lux
        static void Main(string[] args)
        {
            if (args.Length < 5)
            {
                Console.WriteLine("neo-sender <Net> <PrivateKey> <DestAddress> <Symbol> <Amount>");
                Console.WriteLine("Net          Can be Main, Test or custom URL");
                Console.WriteLine("PrivateKey   Can be a full hex private key or a WIF private key");
                Console.WriteLine("DestAddress  Must be a valid Neo address");
                Console.WriteLine("Symbol       Must be Neo, Gas or any support token (eg: RPX, DBC)");
                return;
            }

            var keyStr        = args[1];
            var outputAddress = args[2];

            var symbol = args[3];   //"GAS"
            var amount = decimal.Parse(args[4]);

            var fromKey = keyStr.Length == 52 ? KeyPair.FromWIF(keyStr) : new KeyPair(keyStr.HexToBytes());

            Console.WriteLine($"Sending {amount} {symbol} from {fromKey.address} to {outputAddress}");

            var    net = args[0].ToLowerInvariant();
            NeoAPI api;

            switch (net)
            {
            case "main": api = NeoDB.ForMainNet(); break;

            case "test": api = NeoDB.ForTestNet(); break;

            default: api = new NeoDB(net); break;
            }

            bool result = false;

            try
            {
                if (api.IsToken(symbol))
                {
                    var token = api.GetToken(symbol);
                    result = token.Transfer(fromKey, outputAddress, amount);
                }
                else
                if (api.IsAsset(symbol))
                {
                    result = api.SendAsset(fromKey, outputAddress, symbol, amount);
                }
                else
                {
                    Console.WriteLine("Unknown symbol.");
                    Environment.Exit(-1);
                }
            }
            catch
            {
                Console.WriteLine("Error executing transaction.");
                Environment.Exit(-1);
            }

            Console.WriteLine("Transaction result: " + result);
        }