I tried to send a tx via geth json rpc using the following code. But the geth rpc server response with "Invalid sender". I also tried HomesteadSigner. In that case there is no error received, but I cannot find the receipt for the transaction, no matter how long I wait. Is there anything wrong? thx for any recommendation
KeystoreDir := "D:\\work\\src\\b710cd2a24e0a6dfdc078df50ea42fc2b8d67fcf"
keyjson, err := ioutil.ReadFile(KeystoreDir)
if err != nil {
log.Fatal(err)
}
password := "test"
key, err := accounts.DecryptKey(keyjson, password)
if err != nil {
log.Fatal("Json key decrypted with bad password")
}
tx := types.NewTransaction(5, addrReceiver, amount, gasLimit, gasPrice, nil)
tx, err = tx.SignECDSA(types.NewEIP155Signer(big.NewInt(1)), key.PrivateKey) //types.HomesteadSigner{}
if err != nil {
return err
}
_, err = types.Sender(types.NewEIP155Signer(big.NewInt(1)), tx)
if err != nil {
log.Fatal("Network ID fault")
}
err = client.SendTransaction(ctx, tx)
if err != nil {
log.Fatalf("Tx Error: %s %x %x %d\n", err, addrSender, addrReceiver, balance.Div(balance, common.Finney))
}