I am running a private ethereum blockchain with POA
geth --port 3000 --networkid 42 --datadir=./blkchain --maxpeers=5 --rpc --rpcport 8543 --rpcaddr 127.0.0.1 --rpccorsdomain "*" --rpcapi "eth,net,web3,personal,miner" --allow-insecure-unlock 2>>eth.log
Then send transactions using Web3js
let tx = {from:accounts[targetAccount],to:accounts[targetAccount],value: 0,gas: 100000, data:web3.utils.toHex(targetAccount)};
web3.eth.accounts.signTransaction(tx, keys[targetAccount]).then(signed => {
var tran = web3.eth.sendSignedTransaction(signed.rawTransaction);
tran.on('transactionHash', hash => {
console.log('write blockchain ', hash);
});
tran.on('error', console.error);
});
Then miner.start() from geth console
Everything works fine.
But when I start geth again without --allow-insecure-unlock there are pending transactions: (eth.pendingTransactions.length > 0) and sendTransaction always return: Error: Returned error: already known.
I don't want to use this param: --allow-insecure-unlock. Any hints for this? Many thanks!!
(If i start geth again with --allow-insecure-unlock, it seems to work again)