# generate\_account\_from\_mnemonic

将助记词转换为账户地址与私钥。参考 BIP-39 标准。

## 方法定义

```python
@staticmethod
def generate_account_from_mnemonic(mnemonic: str, passphrase: str = "", account_path: str = "m/44'/60'/0'/0/0") -> Optional[Tuple[ChecksumAddress, HexBytes]]
```

## 参数说明

| 参数            | 类型  | 说明                  |
| ------------- | --- | ------------------- |
| mnemonic      | str | 助记词字符串,以空格分隔        |
| passphrase    | str | 助记词密码,可为空,默认为空字符串   |
| account\_path | str | 分层确定性钱包账户路径,默认为标准路径 |

## 返回值

| 类型                                           | 说明            |
| -------------------------------------------- | ------------- |
| Optional\[Tuple\[ChecksumAddress, HexBytes]] | 由账户地址和私钥组成的元组 |

## 示例代码

```python
# 从助记词生成账户
mnemonic = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"
account_data = Utils.generate_account_from_mnemonic(
    mnemonic=mnemonic,
    passphrase="optional password",
    account_path="m/44'/60'/0'/0/1"  # 使用自定义路径
)

if account_data:
    address, private_key = account_data
    print(f"Generated Account Address: {address}")
    print(f"Private Key: {private_key.hex()}")
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://poseidon.seaeye.cn/evm/utils/generate_account_from_mnemonic.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
