Hello guys I'm having a "Invalid transaction signature." error. Can't get pass this one. Am I missing something?
client, err := ethclient.Dial("path/to/geth.ipc")
if err != nil {
return err
}
ks := keystore.NewKeyStore("path/to/keystore", keystore.StandardScryptN, keystore.StandardScryptP)
to := common.HexToAddress("0x999b010976f0fb4d4e43646bc6c8fbd9ea7f5323")
from := common.HexToAddress("0x53a8368b7f6d140cdb5e0bf6dce0cbe9e6934430")
data := []byte("Lorem ipsum")
value := big.NewInt(10000000000000000)
gasPrice, err := client.SuggestGasPrice(context.Background())
if err != nil {
return err
}
msg := ethereum.CallMsg{
From: from,
To: &to,
GasPrice: gasPrice,
Value: value,
Data: data,
}
gasLimit, err := client.EstimateGas(context.Background(), msg)
if err != nil {
return err
}
nonce, err := client.PendingNonceAt(context.Background(), from)
if err != nil {
return err
}
newTx := types.NewTransaction(nonce, to, value, gasLimit, gasPrice, data)
networkID, err := client.NetworkID(context.Background())
if err != nil {
return err
}
signedTx, err := ks.SignTxWithPassphrase(accounts.Account{Address: from}, "secret", newTx, networkID)
if err != nil {
return err
}
if err := client.SendTransaction(context.Background(), signedTx); err != nil {
return err // Error triggered here
}
"path/to/keystore"
path under--datadir
of the node you're connecting to"Invalid transaction signature."
in the latest geth codebase.Geth Version: 1.8.14-unstable Git Commit: 99e1a5e0fb6f238319042dd2c4c8468dc786a4b7
build from source