1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

web3 unlock account error

Discussion in 'Finance' started by Ntydrm, Aug 2, 2020.

  1. Ntydrm

    Ntydrm Guest

    I have two geth nodes, each has an account:

    node1(IP:192.168.43.12): account1
    node2(IP:192.168.43.39): account2


    the two accounts are created using geth --datadir /root/chain/node1/data account new, the keystore files are generated and saved on each node.

    I use web3 to attach node1 in nodejs environment:

    const Web3 = require('web3');
    const web3 = new Web3('http://192.168.43.12:8545');


    and try to unlock account2 created on node2 before sending a token transaction like below:

    await web3.eth.personal.unlockAccount(account2, "account2 password", 1000);


    I got an error like below:

    Error: Node error: {"code":-32000,"message":"no key for given address or file"}


    I also tried if attach to node2 and the unlock process is correct.

    const Web3 = require('web3');
    const web3 = new Web3('http://192.168.43.39:8545');
    await web3.eth.personal.unlockAccount(account2, "account2 password", 1000);


    How can I unlock an account use web3 without the limitation of node connection?

    Thanks.

    Login To add answer/comment
     

Share This Page