log error from Ecrecover

This commit is contained in:
Tim Williams 2018-06-30 15:28:19 -04:00
parent 278086e5fd
commit 9f2d6ee3fc

View file

@ -7,6 +7,7 @@ import (
"fmt" "fmt"
"os" "os"
"encoding/json" "encoding/json"
"github.com/ethereum/go-ethereum/crypto"
) )
const ( const (
@ -56,8 +57,18 @@ func handleRequest(conn net.Conn) {
//Ecrecover takes 2 args, bytes[] and bytes[] //Ecrecover takes 2 args, bytes[] and bytes[]
// we need to pass in the hash of the message as bytes // we need to pass in the hash of the message as bytes
// and the bytes array of the signature // and the bytes array of the signature
//crypto.Ecrecover() var msg = []byte(dat["msg"].(string))
fmt.Println("Message is ", msg) var sig = []byte(dat["sig"].(string))
var address, err = crypto.Ecrecover(msg, sig)
if err != nil {
fmt.Println("The error is ")
fmt.Println(err)
}
s := string(address[:])
fmt.Println("the address is ")
fmt.Println(s)
//fmt.Println(address)
//fmt.Println("Message is ", msg)
} }
if err != nil { if err != nil {
fmt.Println("Error reading:", err.Error()) fmt.Println("Error reading:", err.Error())