Skip to content

Commit

Permalink
Create diagnostics_web3.js
Browse files Browse the repository at this point in the history
  • Loading branch information
phwizard authored Jul 22, 2021
1 parent 14954a3 commit 93fbe94
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions diagnostics_web3.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Web 3 diagnostics utility
// (c) Taras Filatov, Dappros Ltd, 26.04.2021

var Web3 = require('web3');
// var provider = 'http://3.129.190.111';
var provider = 'http://172.31.29.233';
var web3Provider = new Web3.providers.HttpProvider(provider);
var web3 = new Web3(web3Provider);

// get last block
web3.eth.getBlockNumber().then((result) => {
console.log("Latest Ethereum Block is ",result);
});

// get accounts
web3.eth.personal.getAccounts().then((result) => {
console.log("Accounts list: ",result);
});

// get a specific block
web3.eth.getBlockTransactionCount(17).then(console.log);
web3.eth.getBlock(17).then(console.log);

0 comments on commit 93fbe94

Please sign in to comment.