首页 > 解决方案 > 如何在 Web3 中切换当前帐户

问题描述

我在 web3 有一个默认帐户,使用这个:

web3.eth.defaultAccount=web3.eth.accounts[0]

我想使用 Web3 代码切换到 web3.eth.accounts[1.]。
同样我们可以手动切换帐户,我想使用 Web3 更改它

切换后我想在 localhost 的控制台中打印当前帐户地址。

标签: ethereumsolidityweb3accounts

解决方案


推荐阅读