7

I want to use power of Eth to enable payment and some rpc related operations to my app. Which version(1.0 beta or 0.+) of webjs I need to use. May I know why?

2 Answers 2

11

You don't have to move to the new version if you don't have any issues with the one you are currently using. The new web3 1.0 version is still in beta and there is no official release date yet so there is no need to upgrade.

Some important changes of the new version include:

  • Events - changed the way we listen to Smart Contract Events.
    • HttpProvider is no longer supported for events.
    • WebsocketProvider is the web3 1.0 way of listening to events via subscribe/unsubscribe
  • Returns - majority of the returns have been converted into Promises. Additionally previous functions that returned BigNumber are now returning a String representation of that number.
  • Utilities - utility functions (fromWei, toWei, etc.) have been moved into a web3.util package
  • Modularization - a lot of refactoring has been made to decouple the web3 modules and make it possible to use them individually.

If you want to know if any specific functionality has been changed you can find more on their wiki page: web3.js 1.0 documentation

2
  • thanks, I am starting new and need to decide which version to take for a new project
    – jeff
    Feb 19, 2018 at 9:55
  • If you're starting from scratch I would go with the new web3js version as @MedMansour suggested.
    – valdi.k
    Feb 19, 2018 at 13:13
5

Te web3js version 1.0 is actually better than the old version and feels more modern and much more intuitive. The semantics of the methods are basically the same between the 2 versions but the declarations, output, and input of each method has changed a lot. If you are already using the 0.x version, just keep using it. If you didn't start with web3 yet, go to version 1.0.

NOTE : You may not find many tutorials to start with on version 1.0 since it is not that stable, yet.

1
  • 1
    the confusing thing I find with 1.0 beta version is the removal of personal api. In 0.2x.x I use web3.personal.unlockAccount to unlock the account and then right after call a method on my contract. But in the beta version, I dont know how I do this since there is no unlockAccount. So what is used in 1.0beta to unlock the account so I can call my contract?
    – Chipe
    Jun 25, 2018 at 22:23

Your Answer

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

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