4

I've tried to change the value of defaultAccount on web3.min.js from void to an address, but it didn't seem to work and web3.eth.defaultAccount remained undefined when I called it from the console.

How do I preset that variable?

This is what I'm doing:

Defined from

I believed the from field would've done the trick, but it didn't. So I tried to force the value

change the variable just to make sure

and then I run truffle console

Running on console

4
  • Please post a screenshot or a console trace how do you do this and how you inspect it did not change? There shouldn't be anything magical about this and it should just work. Commented Sep 27, 2018 at 11:40
  • There it is, Mikko Commented Sep 27, 2018 at 13:13
  • You are definitely doing something wrong as you are not supposed to edit web3.min.js - have you tried to set the variable as shown in the answer below? Commented Sep 27, 2018 at 14:18
  • I did it after my attempt to only put the from parameter failed. About the code below: do you mean putting it in truffle.js? I understood I'd have to do it on the console, which I was already doing anyways Commented Sep 27, 2018 at 15:42

1 Answer 1

2

// set the default account web3.eth.defaultAccount = '0xWalletAddress';

Refer to https://web3js.readthedocs.io/en/1.0/web3-eth.html#defaultaccount

1
  • I'm aware I can change this while running the console, I just want to save that time and have it pre-defined Commented Sep 27, 2018 at 12:27

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.