Ejemplo n.º 1
0
        static void Test(string[] cmdArgs, BlockChainClassLib.CommandProcessor cmdProc)
        {
            switch (cmdArgs[1])
            {
            case "start":
                TestId = cmdArgs[2];
                cmdProc.Test_Start(TestId);
                break;

            case "end":
                cmdProc.Test_End();
                break;

            case "server_init":
                cmdProc.Test_Server_Init();
                break;

            case "checkpoint":
                cmdProc.Test_Server_Checkpoint();
                break;

            case "rollback":
                cmdProc.Test_Server_Rollback();
                break;

            case "mine":
                string result = cmdProc.mine(cmdArgs[2]);
                Console.WriteLine(result);
                break;

            case "miner":
                if (cmdArgs[2] == "start")
                {
                    cmdProc.Test_Server_Miner_Start(cmdArgs[3]);
                }
                else
                if (cmdArgs[2] == "stop")
                {
                    cmdProc.Test_Server_Miner_Stop();
                }
                break;
            }
        }
Ejemplo n.º 2
0
        public void TestCommandLib_RLWE()
        {
            CryptoProvider.RLWE_Provider provider = new CryptoProvider.RLWE_Provider();
            provider.GenerateKeyPair();

            BlockChainClassLib.Transaction t = new BlockChainClassLib.Transaction();
            t.id = Guid.NewGuid();

            string publicKey = provider.ExportPublicKey();
            string address   = CryptoProvider.AddressEncoder.CreateAddress(publicKey);
            string signature = CryptoProvider.AddressEncoder.SignAddress(address, t.id.ToString(), provider);

            t.Inputs.Add(new BlockChainClassLib.Input(address, signature, publicKey));
            t.Outputs.Add(new BlockChainClassLib.Output("paul", 1));

            BlockChainClassLib.CommandProcessor cmdProc = new BlockChainClassLib.CommandProcessor("RLWE", "localhost", "12345");
            //string json = Newtonsoft.Json.JsonConvert.SerializeObject(t);

            cmdProc.Transfer(t);
            cmdProc.mine(address);
        }