Guest User

Untitled

a guest
Jan 23rd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. web3 = new Web3(new Web3.providers.HttpProvider('https://mainnet.infura.io'));
  2. let isListening = await web3.eth.net.isListening();
  3. let numPeers = await web3.eth.net.getPeerCount();
  4. console.log( "node " + infuraUrl + " listening: " + isListening.toString() + " with " + numPeers + " peers");
  5.  
  6. let isListening = await web3.eth.net.isListening();
  7. ^^^^
  8.  
  9. SyntaxError: Unexpected identifier
  10. at createScript (vm.js:80:10)
  11. at Object.runInThisContext (vm.js:139:10)
  12. at Module._compile (module.js:607:28)
  13. at Object.Module._extensions..js (module.js:654:10)
  14. at Module.load (module.js:556:32)
  15. at tryModuleLoad (module.js:499:12)
  16. at Function.Module._load (module.js:491:3)
  17. at Function.Module.runMain (module.js:684:10)
  18. at startup (bootstrap_node.js:187:16)
  19. at bootstrap_node.js:608:3
  20.  
  21. web3 = new Web3(new Web3.providers.HttpProvider(infuraUrl));
  22. console.log("web 3 version " + web3.version);
  23.  
  24. async function logMetaData(){
  25. let isListening = await web3.eth.net.isListening();
  26. let numPeers = await web3.eth.net.getPeerCount();
  27. console.log( "node " + infuraUrl + " listening: " + isListening.toString() + " with " + numPeers + " peers");
  28. };
  29.  
  30. logMetaData();
Add Comment
Please, Sign In to add comment