public string Parse([FromBody] BeforeParse parse) { AssetTypesRegisterer.RegisterTypes(); WAction walletservice = new WAction(); KeyPair privatekey = walletservice.GetKeyPair(parse.BeforeParsePrivateKey); if (privatekey == null) { // comment:プライベートキーが適正ではありません! AfterParse missparse = new AfterParse(); missparse.AfterParsepublickey = string.Empty; string resultjson = JsonSerializer.Serialize(missparse); return(resultjson); } Address mypublickey = Inputjudgement1(privatekey); if (mypublickey == null) { //comment:パブリックキーに変換できませんでした! AfterParse missparse = new AfterParse(); missparse.AfterParsepublickey = string.Empty; string resultjson = JsonSerializer.Serialize(missparse); return(resultjson); } string ParsePublicKey = Convert.ToString(mypublickey); AfterParse afterparse = new AfterParse(); afterparse.AfterParsepublickey = ParsePublicKey; string successjson = JsonSerializer.Serialize(afterparse); return(successjson); }
public string ReadFile([FromBody] RegistName registname) { AssetTypesRegisterer.RegisterTypes(); Process process = new Process(); string arg = registname.nickname;//argumenrt ProcessStartInfo psinfo = new ProcessStartInfo() { FileName = "/usr/local/bin/ReadKeyFile.sh", UseShellExecute = false, RedirectStandardOutput = true, CreateNoWindow = true, Arguments = "\t" + arg, }; Process p = Process.Start(psinfo); p.WaitForExit(); string privatekey = p.StandardOutput.ReadToEnd(); privatekey = privatekey.Substring(0, privatekey.Length - 1); p.Close(); WAction walletservice = new WAction(); KeyPair privatekey1 = walletservice.GetKeyPair(privatekey); if (privatekey1 == null) { // comment:プライベートキーが正しく取得できませんでした! getkeypair getkeypair = new getkeypair(); getkeypair.PrivateKey = string.Empty; getkeypair.PublicKey = string.Empty; string resultjson = JsonSerializer.Serialize(getkeypair); return(resultjson); } Address mypublickey = Inputjudgement1(privatekey1); if (mypublickey == null) { //comment:パブリックキーに変換できませんでした! getkeypair getkeypair = new getkeypair(); getkeypair.PrivateKey = string.Empty; getkeypair.PublicKey = string.Empty; string resultjson = JsonSerializer.Serialize(getkeypair); return(resultjson); } string ParsePublicKey = Convert.ToString(mypublickey); getkeypair keypair = new getkeypair(); keypair.PrivateKey = privatekey; keypair.PublicKey = ParsePublicKey; string keypairjson = JsonSerializer.Serialize(keypair); return(keypairjson); }
public async Task <string> Coinsend([FromBody] Transactioninfo info) { AssetTypesRegisterer.RegisterTypes(); WAction walletservice = new WAction(); KeyPair privatekey = walletservice.GetKeyPair(info.my_privatekey); if (privatekey == null) { // comment:プライベートキーが適正ではありません! Result txresult = new Result(); txresult.code = 1; txresult.transactionId = string.Empty; txresult.result = string.Empty; string resultjson = JsonSerializer.Serialize(txresult); return(resultjson); } Address mypublickey = Inputjudgement1(privatekey); if (mypublickey == null) { //comment:パブリックキーを適正に変換できませんでした! Result txresult = new Result(); txresult.code = 2; txresult.transactionId = string.Empty; txresult.result = string.Empty; string resultjson = JsonSerializer.Serialize(txresult); return(resultjson); } Address opponetpublickey = Inputjudgement2(info.opponet_pubkey); if (opponetpublickey == null) { // comment:入力された送信相手のパブリックキーが不適正です!入力値を再確認してください! Result txresult = new Result(); txresult.code = 3; txresult.transactionId = string.Empty; txresult.result = string.Empty; string resultjson = JsonSerializer.Serialize(txresult); return(resultjson); } decimal amount = Inputnumjudgement(info.send_amount); if (amount == 0m) { //comment:数字ではない文字が入力されています!数字に直してください Result txresult = new Result(); txresult.code = 4; txresult.transactionId = string.Empty; txresult.result = string.Empty; string resultjson = JsonSerializer.Serialize(txresult); return(resultjson); } (string transaction, string result) = await walletservice.Send(privatekey, mypublickey, opponetpublickey, amount); Result successtxresult = new Result(); successtxresult.code = 5; successtxresult.transactionId = transaction; successtxresult.result = result; string successresultjson = JsonSerializer.Serialize(successtxresult); return(successresultjson); }