> For the complete documentation index, see [llms.txt](https://poseidon.seaeye.cn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://poseidon.seaeye.cn/evm/utils/generate_account_from_mnemonic.md).

# 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
