-
Notifications
You must be signed in to change notification settings - Fork 107
Open
Description
I think there is nothing wrong with the code below as I unlock the account first and then make transaction
package main
import (
"fmt"
"github.com/onrik/ethrpc"
"log"
"github.com/ethereum/go-ethereum/accounts/keystore"
"github.com/ethereum/go-ethereum/accounts"
"math/big"
)
func main() {
client:=ethrpc.New("http://localhost:8545")
_, err := client.Web3ClientVersion()
if err != nil {
log.Fatal("Error Connecting To Node : ",err)
}
ks := keystore.NewKeyStore(
"/home/atif/.ethereum/rinkeby/keystore/",
keystore.LightScryptN,
keystore.LightScryptP)
var unlockedAccount accounts.Account
accs:=ks.Accounts()
if err:=ks.Unlock(accs[1],"abcd");err==nil{
unlockedAccount=accs[1]
fmt.Println("Account Unlocked")
}
t:=ethrpc.T{
From: unlockedAccount.Address.Hex(),
To: "0x92dd679e2d8e107d8122ad5b3c868265e77c8af2",
Gas: 123456,
GasPrice:big.NewInt(12400000),
Value:big.NewInt(20000000000),
Data:"",
Nonce:0,
}
txid, err := client.EthSendTransaction(t)
if err != nil {
log.Fatal("Transaction Error => ",err)
}
fmt.Println(txid)
}
What I want
txid of Real Transaction
What is get
Transaction Error => Error -32000 (authentication needed: password or unlock)
Metadata
Metadata
Assignees
Labels
No labels