mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
respond back to client with sig
This commit is contained in:
parent
a2a6a57c70
commit
d7b70c03b9
1 changed files with 25 additions and 1 deletions
|
|
@ -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.
|
// Send a response back to person contacting us.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue