2

I'm new to this web3 API and I'm trying to use it with NodeJS. I've not been able to make a single transaction from one address to another. I've been able to successfully retrieve the balance of my address.

The method I'm using is documented here but when I execute the script, it will give an error saying that my params are not formatted well

Returned error: Invalid params: invalid type: map, expected a 0x-prefixed, hex-encoded vector of bytes.

My params:

amount = '0x' + (+web3.utils.toWei('0.06', 'ether')).toString(16)
var rawTx = {
    from: ethAddress,
    to: destinationAddress,
    value: amount 
}

The variables ethAddress and destinationAddress are set correctly.

Any help would be much appreciated!

  • How do you generate the rawTx? Are addresses prefixed with '0x'? The link in your question is from web3 1.0 which is in beta and it may have a bug. – Ismael Sep 4 '17 at 19:32
  • Yes, it's all prefixed with 0x. Everything is in hex format. – Albêr Sep 5 '17 at 20:40
  • Without something to test with it is impossible to tell. I'd suggest to try with the stable release web3 v0.20, it might be a bug with v1.0. – Ismael Sep 6 '17 at 4:29
  • Just to be sure, what do I really have to do? I set the provider to be https://api.myetherapi.com/eth. That's correct to do right? – Albêr Sep 6 '17 at 10:36
  • Sorry, but I've never used myetherapi.com previously and can't help with that, perhaps you want to ask a new question about it. – Ismael Sep 6 '17 at 19:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.