2

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
}
5
  • please confirm that your account keystore json file exists in the "path/to/keystore" path under --datadir of the node you're connecting to
    – Ha ĐANG
    Aug 31, 2018 at 2:45
  • Yes it exists the password, network ID is also correct when I dump the values.
    – emurmotol
    Aug 31, 2018 at 2:59
  • which geth version are you using, I cannot find "Invalid transaction signature." in the latest geth codebase.
    – Ha ĐANG
    Aug 31, 2018 at 3:25
  • I'm using Geth Version: 1.8.14-unstable Git Commit: 99e1a5e0fb6f238319042dd2c4c8468dc786a4b7 build from source
    – emurmotol
    Aug 31, 2018 at 3:42
  • okay, let me try to run on my local to see what's happen
    – Ha ĐANG
    Aug 31, 2018 at 6:55

1 Answer 1

0

I used your source code and able to run on my local without any problem. I put the code into github, please check it out.

https://github.com/hadv/ipc-client

tnx was submitted and mined successfully by the node.

INFO [08-31|16:58:32.050] Setting new local account                address=0xE348073d55AdE0Ef0E5696bA51D5565003233D0C
INFO [08-31|16:58:32.051] Submitted transaction                    fullhash=0xff173c546e3bbd345013348c85e8921ccf7e9aed23e74af044843d5e54e04754 recipient=0xD5089c1Fdf8ceBF58c6bBb50a86C1c55893634b8

It seems that you make somethings wrong somewhere in node config!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.