文章目錄
- `web3.eth.accounts` 回傳 undefined
web3.eth.accounts 回傳 undefined
錯誤:
truffle(develop)> web3.eth.accounts[0]
undefined
web3.eth.accounts 已被啟用
最新版本v1.5.2 可以這么寫
web3.eth.getAccounts().then(function(acc){ accounts = acc })
accounts[0]
控制臺:
truffle(develop)> web3.eth.getAccounts().then(function(acc){ accounts = acc })
undefined
truffle(develop)> accounts[0]
'0x95886D9241c643E6963C4F450779B9b0A974B8C7'
truffle(develop)> accounts[1]
'0xfb5e22Dbc4E1781288402742591ee4dB9E421F27'
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/303937.html
標籤:區塊鏈
