mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
log error from Ecrecover
This commit is contained in:
parent
278086e5fd
commit
9f2d6ee3fc
1 changed files with 14 additions and 3 deletions
|
|
@ -6,7 +6,8 @@ import (
|
||||||
"net"
|
"net"
|
||||||
"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())
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue