知乎專欄 | 多維度架構 | | | 微信號 netkiller-ebook | | | QQ群:128659835 請註明“讀者” |
var Web3 = require('web3'); var web3 = new Web3('http://localhost:8545');
查看連接狀態
> web3.currentProvider HttpProvider { host: 'http://localhost:8545', timeout: 0, connected: true, headers: undefined }
connected: true 表示連接成功。
var Web3 = require('web3'); var web3 = new Web3(Web3.givenProvider || 'ws://remotenode.com:8546');