【问题标题】:How can I create account come with mnemonic use web3.py?如何创建带有助记符使用 web3.py 的帐户?
【发布时间】:2022-07-15 21:29:35
【问题描述】:

account = web3.eth.account.create() 这个账号只有private_key和address,我也要助记词,怎么办?

为了创建一个帐户,我希望得到带有 private_key、address、mnemonic 的结果... 我该怎么做?

【问题讨论】:

  • 请澄清您的具体问题或提供更多详细信息以准确突出您的需求。正如目前所写的那样,很难准确地说出你在问什么。

标签: python ethereum web3py


【解决方案1】:
    >>> from eth_account import Account
    >>> Account.enable_unaudited_hdwallet_features()
    >>> acct, mnemonic = Account.create_with_mnemonic()
    >>> acct.address # doctest: +SKIP
    '0x5ce9454909639D2D17A3F753ce7d93fa0b9aB12E'
    >>> acct == Account.from_mnemonic(mnemonic)
    True

【讨论】:

    猜你喜欢
    • 2021-09-04
    • 2018-09-20
    • 1970-01-01
    • 1970-01-01
    • 2018-10-30
    • 2021-08-23
    • 2017-12-07
    • 1970-01-01
    • 2019-02-13
    相关资源
    最近更新 更多