miguelmota / ethereum-development-with-go-book

📖 A little guide book on Ethereum Development with Go (golang)
https://goethereumbook.org
Other
1.74k stars 427 forks source link

the method shh_newKeyPair does not exist/is not available #45

Closed rohankeskar19 closed 4 years ago

rohankeskar19 commented 4 years ago

Hey, I'm getting the above error for the following code

Geth version : 1.9.11-stable Golang version : go1.13.6 windows/amd64

package main

import (
    "context"
    "fmt"
    "log"

    "github.com/ethereum/go-ethereum/whisper/shhclient"
)

func main() {
    client, err := shhclient.Dial("ws://127.0.0.1:8546")
    if err != nil {
        log.Fatal(err)
    }
    keyID, err := client.NewKeyPair(context.Background())
    if err != nil {
        log.Fatal(err)
    }

    fmt.Println(keyID) // 0ec5cfe4e215239756054992dbc2e10f011db1cdfc88b9ba6301e2f9ea1b58d2

}

This is the exact error

2020/03/11 16:54:48 the method shh_newSymKey does not exist/is not available
exit status 1

This is what is showing in geth console

WARN [03-11|16:49:49.314] Served shh_newKeyPair                    reqid=1 t=0s err="the method shh_newKeyPair does not exist/is not available"
miguelmota commented 4 years ago

Solution: https://github.com/ethereum/go-ethereum/issues/20756#issuecomment-599107744