---
title: "eth_getStorageAt"
description: "返回合约 storage slot 的值（Base Sepolia）"
url: "https://blockreq.com/docs/zh-cn/build/api-reference/base-sepolia/eth_getStorageAt/"
---

# eth_getStorageAt

**网络：** Base Sepolia · 测试网 · Chain ID `84532`（`0x14a34`）

**计为 1 个 Request。** 计费规则见 [Request Counting](https://blockreq.com/docs/zh-cn/pricing/request-counting/index.md)。

`eth_getStorageAt` 按 block tag 读取某个地址的 storage slot。最新状态读取可走标准 EVM 路由；旧区块读取需要 Archive 路由。

## 参数

1. `DATA` - 20 字节合约地址。
2. `QUANTITY` - Storage 位置。
3. `QUANTITY|TAG` - 区块号或 tag。

## 请求

```json
{
  "jsonrpc": "2.0",
  "method": "eth_getStorageAt",
  "params": ["0x0000000000000000000000000000000000000000", "0x0", "latest"],
  "id": 1
}
```

## 代码示例

**cURL**

```bash
curl -X POST https://base-sepolia-rpc.blockreq.com/v1/rpc/public \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"eth_getStorageAt","params":["0x0000000000000000000000000000000000000000","0x0","latest"],"id":1}'
```

**TypeScript**

```typescript
const response = await fetch("https://base-sepolia-rpc.blockreq.com/v1/rpc/public", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
  "jsonrpc": "2.0",
  "method": "eth_getStorageAt",
  "params": [
    "0x0000000000000000000000000000000000000000",
    "0x0",
    "latest"
  ],
  "id": 1
}),
});
const data = await response.json();
console.log(data.result);
```

**Python**

```python
import requests

response = requests.post(
    "https://base-sepolia-rpc.blockreq.com/v1/rpc/public",
    json={
  "jsonrpc": "2.0",
  "method": "eth_getStorageAt",
  "params": [
    "0x0000000000000000000000000000000000000000",
    "0x0",
    "latest"
  ],
  "id": 1
}
)
print(response.json()["result"])
```

**Go**

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"net/http"
)

func main() {
	payload := []byte(`{"jsonrpc":"2.0","method":"eth_getStorageAt","params":["0x0000000000000000000000000000000000000000","0x0","latest"],"id":1}`)
	resp, err := http.Post(
		"https://base-sepolia-rpc.blockreq.com/v1/rpc/public",
		"application/json",
		bytes.NewBuffer(payload),
	)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()

	body, _ := io.ReadAll(resp.Body)
	var result map[string]interface{}
	json.Unmarshal(body, &result)
	fmt.Println(result["result"])
}
```

**viem**

```typescript
import { createPublicClient, http } from "viem";

const client = createPublicClient({
  transport: http("https://base-sepolia-rpc.blockreq.com/v1/rpc/public"),
});

const result = await client.request({
  method: "eth_getStorageAt",
  params: ["0x0000000000000000000000000000000000000000","0x0","latest"],
});
console.log(result);
```

**Foundry**

```bash
cast rpc --rpc-url https://base-sepolia-rpc.blockreq.com/v1/rpc/public eth_getStorageAt 0x0000000000000000000000000000000000000000 0x0 latest
```

**Hardhat**

```javascript
const { ethers } = require("hardhat");

async function main() {
  const provider = new ethers.JsonRpcProvider("https://base-sepolia-rpc.blockreq.com/v1/rpc/public");
  const result = await provider.send("eth_getStorageAt", ["0x0000000000000000000000000000000000000000","0x0","latest"]);
  console.log(result);
}

main();
```
