public void Test_Server_Rollback() { RestClientLib.RestClient client = new RestClientLib.RestClient(); //send request to the BlockChain Server string url = $"{rootUrl}/test/rollback"; string result = client.Get(url); }
public void Test_End() { RestClientLib.RestClient client = new RestClientLib.RestClient(); //send request to the BlockChain Server string url = $"{rootUrl}/test/end?{TestId}"; string result = client.Get(url); }
public void Test_Start(string TestId) { this.TestId = TestId; RestClientLib.RestClient client = new RestClientLib.RestClient(); //send request to the BlockChain Server string url = $"{rootUrl}/test/start?{TestId}"; string result = client.Get(url); }
//Sends a chain request to the BlockChain server (asks the server to return a list of BlockChain objects) public string chain() { RestClientLib.RestClient client = new RestClientLib.RestClient(); //send the Get request string url = rootUrl + "/chain"; string json = client.Get(url); //display the results (json) return(json); }
//Sends a mine reqest to the BlockChain server public string mine(string address) { RestClientLib.RestClient client = new RestClientLib.RestClient(); //build the request url and send the Get request string url = rootUrl + "/Mine?" + address; string json = client.Get(url); //deserialize the result into the Mine object var json_serializer = new JavaScriptSerializer(); Mine result = json_serializer.Deserialize <Mine>(json); return(string.Format("Index={0}, Message={1}, proof={2}, PreviousHash={3}", result.Index, result.Message, result.Proof, result.PreviousHash)); }
public string PendingTransactions() { RestClientLib.RestClient client = new RestClientLib.RestClient(); //send the Get request string url = rootUrl + "/pending"; string json = client.Get(url); //deserialize the list of transactions retured from the server var json_serializer = new JavaScriptSerializer(); List <Transaction> txList = json_serializer.Deserialize <List <Transaction> >(json); StringBuilder b = new StringBuilder(); //output each transaction returned to the console foreach (Transaction tx in txList) { b.AppendLine(tx.ToString()); } return(b.ToString()); }
public void Test_Server_Miner_Stop() { RestClientLib.RestClient client = new RestClientLib.RestClient(); string url = $"{rootUrl}/test/miner/stop"; string result = client.Get(url); }
public void Test_Server_Miner_Start(string address) { RestClientLib.RestClient client = new RestClientLib.RestClient(); string url = $"{rootUrl}/test/miner/start?{address}"; string result = client.Get(url); }