【问题标题】:how to switch accounts automatically in meatamask如何在元掩码中自动切换帐户
【发布时间】:2021-07-10 10:02:17
【问题描述】:

大家好,我有一个在线投票应用程序,该应用程序基于智能合约、ganache 和 web3.js 构建。在这个应用程序中,每个选民都有一个来自 ganache 的地址。 I want when the elector goes to vote he will give his privatekey and metamask take this private key automatically without going to click on metamask and import the address I need this automatically.

【问题讨论】:

    标签: blockchain ethereum solidity smartcontracts web3js


    【解决方案1】:

    设计上不可能。

    Metamask JS API(实现以太坊提供者 API)不允许以编程方式导入帐户(或只读地址)。

    请参阅https://docs.metamask.io/guide/#account-management 了解更多信息。

    【讨论】:

    • 朋友这是什么意思
    • @ZoubairELhattab 这意味着您不能以编程方式导入地址 - 您需要用户手动将其导入 MetaMask。
    • 对不起,如果我打扰了,还有其他解决方案或其他类似 metamask 的应用程序可以做到这一点
    • 我不知道。但我建议编辑您的问题并说明您要实现的目标(可能是用户体验 - 以便他们轻松投票),并希望其他人能给出更好的答案。
    猜你喜欢
    • 1970-01-01
    • 2017-07-23
    • 1970-01-01
    • 2017-03-27
    • 2020-08-01
    • 2018-05-22
    • 1970-01-01
    • 1970-01-01
    • 2020-05-28
    相关资源
    最近更新 更多