When I'm working whit web3 I have something like:

 var abi = [...];
var contract = new web3.eth.Contract(abi,"0x86Fa049857E0209aa7D9e616F7eb3b3B78ECfdb0");

then I use something like:


In truffle test I have a contract instance in hand, and I use


without the "methods" indirection, what is different from the two contract instances?

1 Answer 1


The difference is that Truffle injects Web3.js 0.20 into the test script, whereas you are working with Web3.js 1.0.

Web3.js is a whole lot different from Web3.js 0.20.

  • in this case, which is best to learn and use? latest Web3.js ?
    – KitKarson
    Commented May 30, 2018 at 2:12
  • I would say so, yes.
    – Henk
    Commented May 30, 2018 at 8:46

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.