2

I am running a node locally on the Rinkeby blockchain.

I have an account on the node at the address 0xcA4E218Eb3954f899FE5d8E0B9ddcf3E402E86e7. This account has 3 eth.

I have another account that I generated through web3.eth.createAccount at the address 0x680A47A1D2080Ce349160c0A12B0326259bB7B04. This account also has 3 eth.

When I try to run the below, I get the error: unknown account. Thoughts?

this.web3.eth.sendTransaction({
      from: '0x680A47A1D2080Ce349160c0A12B0326259bB7B04',
      to: '0xcA4E218Eb3954f899FE5d8E0B9ddcf3E402E86e7',
      value: '5000'
    }).then(function (receipt) {
      console.log(receipt)
    }).catch(console.log)

1 Answer 1

2

Which version of web3js are you using?

If you created the account locally then it doesn't exist on the node you're connected to. (Also, web3.eth.createAccount doesn't exist AFAIK - no result when I google it). v1.0 of web3js does have web3.eth.accounts.create though. https://web3js.readthedocs.io/en/1.0/web3-eth-accounts.html#create

Unknown account (from memory) is an error from the remote node, not from web3. If you used web3.eth.accounts.create it returns an object with a signTransaction method you should use when signing a transaction, then you can use sendTransaction or sendRawTransaction to send it.

Also, check the accounts on the node itself, or eth.accounts to see if it's there - I imagine it won't be.

(And be sure to save privkeys as you generate them!)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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