ElA*_*725 4 python python-3.x web3py
我正在使用 web3 制作自己的桌面 BSC 钱包。目前我正在使用
private_key = "private key"
account = w3.eth.account.privateKeyToAccount(private_key)
Run Code Online (Sandbox Code Playgroud)
但我想使用助记词短语(如“你好约翰披萨吉他”)创建帐户。我一直在寻找,但无法实现。
目前请求的功能在 Web3.py 中不稳定
web3 = Web3()
web3.eth.account.enable_unaudited_hdwallet_features()
account = web3.eth.account.from_mnemonic(my_mnemonic, account_path="m/44'/60'/0'/0/0")
Run Code Online (Sandbox Code Playgroud)
注意:默认也account_path匹配以太坊和 BSC。迭代最后一个数字,您将获得下一个帐户。账户对象可以管理一些操作
web3 = Web3()
web3.eth.account.enable_unaudited_hdwallet_features()
account = web3.eth.account.from_mnemonic(my_mnemonic, account_path="m/44'/60'/0'/0/0")
Run Code Online (Sandbox Code Playgroud)