web3.eth.accounts undefined 发布时间: 2018 12 19 在truffle里面用 accounts = await web3.eth.getAccounts() 就可以得到账户数组,在前面加await是因为getaccounts 是异步函数 在控制台函数转账,函数参数为 ({from:accounts[0],value:web3.utils.toWei('2','ether')}) 具体可以看web3.utils库的用法