> 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/chain/get_storage.md).

# get\_storage

根据合约地址和存储插槽索引获取存储值。

## 方法定义

```python
def get_storage(self, address: ChecksumAddress, slot_index: int) -> Optional[HexBytes]
```

## 参数说明

| 参数          | 类型              | 说明     |
| ----------- | --------------- | ------ |
| address     | ChecksumAddress | 合约地址   |
| slot\_index | int             | 存储插槽索引 |

## 返回值

| 类型                  | 说明  |
| ------------------- | --- |
| Optional\[HexBytes] | 存储值 |

## 示例代码

```python
# 获取存储值
storage = chain.get_storage("0x...", 0)
if storage:
    print(f"Storage Value: {storage.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:

```
GET https://poseidon.seaeye.cn/evm/chain/get_storage.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.
