Mac OS 10.13.6

I installed node and web3 npm install web3 ... + web3@1.0.0-beta.52 added 331 packages from 246 contributors and audited 9528 packages in 144.776s found 0 vulnerabilities

Instructions from tutorial:

var Web3 = require('web3') undefined Web3 [Function: Web3]

In the tutorial when the guy types Web3 he gets a long list of items. All I get is : [Function: Web3] Following the rest of the tutorial, I don't get the results he does.

  • Try var Web3 = require('web3'); and then var web3 = new Web3('YourProviderAddress');. – goodvibration Apr 29 '19 at 18:25
  • Thanks for you reply. Yes that was the next step in the tutorial and I did that: > var url = 'mainnet.infura.io/v3/d0d6e36175ea48808cdfb76d8c1397c1' undefined > var web3 = new Web3(url) undefined > web3 Web3 { providerResolver: ProviderResolver { providersModuleFactory: ProvidersModuleFactory {} }, givenProvider: null, _currentProvider: ... > address = '0xE853c56864A2ebe4576a807D26Fdc4A0adA51919' then I execute: web3.eth.getBalance(address, (err, bal) => { balance = bal}) > balance ReferenceError: balance is not defined when it should return the balance – sylviatrilling Apr 30 '19 at 21:45
  • Finally got it to work by changing instantiation to: web3 = new Web3(new Web3.providers.HttpProvider("ropsten.infura.io/v3/d0d6...")) – sylviatrilling May 3 '19 at 19:17

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.