# eth_getStorageAt

> For the complete documentation index, see [llms.txt](/docs/llms.txt).

POST https://linea-mainnet.g.alchemy.com/v2/{apiKey}

Returns the value from a storage position at a given address.

Reference: https://www.alchemy.com/docs/chains/linea/linea-api-endpoints/eth-get-storage-at

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| Address | string | Yes | The address of the contract to read storage from. |
| Storage slot | string | Yes | The index position of the storage slot to retrieve, as a hexadecimal string. |
| Block | string or enum | Yes | The block number, tag, or hash at which to retrieve the storage value. |

## Result

**Value** (string): The value stored at the given storage slot, encoded as a hexadecimal string.

## Example

### Request

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

### Response

```json
{
  "jsonrpc": "2.0",
  "result": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "id": 1
}
```

## Code Examples

### cURL

```bash
curl --request POST \
  --url https://linea-mainnet.g.alchemy.com/v2/docs-demo \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_getStorageAt",
  "params": [
    "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73",
    "0x0",
    "latest"
  ]
}'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    jsonrpc: '2.0',
    id: 1,
    method: 'eth_getStorageAt',
    params: ['0xfe3b557e8fb62b89f4916b721be55ceb828dbd73', '0x0', 'latest']
  })
};

fetch('https://linea-mainnet.g.alchemy.com/v2/docs-demo', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://linea-mainnet.g.alchemy.com/v2/docs-demo"

payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "eth_getStorageAt",
    "params": ["0xfe3b557e8fb62b89f4916b721be55ceb828dbd73", "0x0", "latest"]
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

### Go

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://linea-mainnet.g.alchemy.com/v2/docs-demo"

	payload := strings.NewReader("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"eth_getStorageAt\",\n  \"params\": [\n    \"0xfe3b557e8fb62b89f4916b721be55ceb828dbd73\",\n    \"0x0\",\n    \"latest\"\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
```

### Java

```java
HttpResponse<String> response = Unirest.post("https://linea-mainnet.g.alchemy.com/v2/docs-demo")
  .header("Content-Type", "application/json")
  .body("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"eth_getStorageAt\",\n  \"params\": [\n    \"0xfe3b557e8fb62b89f4916b721be55ceb828dbd73\",\n    \"0x0\",\n    \"latest\"\n  ]\n}")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://linea-mainnet.g.alchemy.com/v2/docs-demo");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddJsonBody("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"eth_getStorageAt\",\n  \"params\": [\n    \"0xfe3b557e8fb62b89f4916b721be55ceb828dbd73\",\n    \"0x0\",\n    \"latest\"\n  ]\n}", false);
var response = await client.PostAsync(request);

Console.WriteLine("{0}", response.Content);

```


## OpenRPC Method Specification

```yaml
name: eth_getStorageAt
description: Returns the value from a storage position at a given address.
params:
  - name: Address
    required: true
    description: The address of the contract to read storage from.
    schema:
      title: hex encoded address
      type: string
      pattern: ^0x[0-9a-fA-F]{40}$
  - name: Storage slot
    required: true
    description: The index position of the storage slot to retrieve, as a hexadecimal string.
    schema:
      title: hex encoded 256 bit unsigned integer
      type: string
      pattern: ^0x([1-9a-f]+[0-9a-f]{0,31})|0$
  - name: Block
    required: true
    description: The block number, tag, or hash at which to retrieve the storage value.
    schema:
      title: Block number, tag, or block hash
      description: Identifies a block by explicit number, a predefined tag (e.g., latest/safe/finalized), or a 32-byte block hash.
      anyOf:
        - title: Block number
          type: string
          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
          description: Unsigned integer block height (e.g., 0 for genesis).
        - title: Block tag
          description: A well-known tag such as "latest", "earliest", "pending", "safe", or "finalized".
          type: string
          enum:
            - earliest
            - finalized
            - safe
            - latest
            - pending
        - title: Block hash
          type: string
          pattern: ^0x[0-9a-f]{64}$
          description: 32-byte Keccak hash of the block header identifying a specific block.
result:
  name: Value
  description: The value stored at the given storage slot, encoded as a hexadecimal string.
  schema:
    title: hex encoded bytes
    type: string
    pattern: ^0x[0-9a-f]*$
examples:
  - name: eth_getStorageAt example
    params:
      - name: Address
        value: '0xfe3b557e8fb62b89f4916b721be55ceb828dbd73'
      - name: Storage slot
        value: '0x0'
      - name: Block
        value: latest
    result:
      name: Value
      value: '0x0000000000000000000000000000000000000000000000000000000000000000'
```
