From d7b70c03b95d1e540d0018b08052ab78a677d4c6 Mon Sep 17 00:00:00 2001 From: Tim Williams Date: Mon, 16 Jul 2018 11:38:22 -0400 Subject: [PATCH] respond back to client with sig --- shyftRingWalletConn/app.go | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/shyftRingWalletConn/app.go b/shyftRingWalletConn/app.go index ced36f78f7..3ff6175115 100644 --- a/shyftRingWalletConn/app.go +++ b/shyftRingWalletConn/app.go @@ -162,7 +162,31 @@ func handleRequest(conn net.Conn) { } } }() - conn.Write([]byte{byte(0x0f)}) + go func() { + key, _ := crypto.HexToECDSA(testPrivHex) + //addr := common.HexToAddress(testAddrHex) + + f_msg := "Hello World" + first_message := []byte(f_msg) + new_msg2 := crypto.Keccak256(first_message) + fmt.Println("the hash is ", hexutil.Encode(new_msg2)) + + //send_message := append(new_msg2, []byte{byte(10)}...) + new_sig , err := crypto.Sign(new_msg2, key) + if err != nil { + fmt.Println("The crypto.Sign err is ", err) + } + hex_sig := hexutil.Encode(new_sig) + fmt.Println("THE hex sig is ", hex_sig) + + conn.Write([]byte("Broadcasting Message")) + conn.Write([]byte("\n")) + conn.Write([]byte(f_msg)) + conn.Write([]byte("\n")) + conn.Write(new_sig) + conn.Write([]byte("\n")) + }() + //conn.Write([]byte{byte(0x0f)}) // Send a response back to person contacting us.