# eth_getAccountInfo

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

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

Retrieves account information including balance, code, and nonce for a given address at a specified block.

Reference: https://www.alchemy.com/docs/chains/monad/monad-api-endpoints/eth-get-account-info

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| Address | string | Yes | The address of the account to query. |
| Block | string or enum | Yes | The block number, tag, or hash at which to retrieve the account information. |

## Result

**Account information** (object): An object containing the account's balance, code, and nonce.

## Example

### Request

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

### Response

```json
{
  "jsonrpc": "2.0",
  "result": {
    "balance": "0x1cfe56f3795885980000",
    "code": "0x",
    "nonce": "0x5"
  },
  "id": 1
}
```

## Code Examples

### cURL

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

### JavaScript

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

fetch('https://monad-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://monad-mainnet.g.alchemy.com/v2/docs-demo"

payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "eth_getAccountInfo",
    "params": ["0xfe3b557e8fb62b89f4916b721be55ceb828dbd73", "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://monad-mainnet.g.alchemy.com/v2/docs-demo"

	payload := strings.NewReader("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"eth_getAccountInfo\",\n  \"params\": [\n    \"0xfe3b557e8fb62b89f4916b721be55ceb828dbd73\",\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://monad-mainnet.g.alchemy.com/v2/docs-demo")
  .header("Content-Type", "application/json")
  .body("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"eth_getAccountInfo\",\n  \"params\": [\n    \"0xfe3b557e8fb62b89f4916b721be55ceb828dbd73\",\n    \"latest\"\n  ]\n}")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://monad-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_getAccountInfo\",\n  \"params\": [\n    \"0xfe3b557e8fb62b89f4916b721be55ceb828dbd73\",\n    \"latest\"\n  ]\n}", false);
var response = await client.PostAsync(request);

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

```


## OpenRPC Method Specification

```yaml
name: eth_getAccountInfo
description: Retrieves account information including balance, code, and nonce for a given address at a specified block.
params:
  - name: Address
    required: true
    description: The address of the account to query.
    schema:
      title: hex encoded address
      type: string
      pattern: ^0x[0-9a-fA-F]{40}$
  - name: Block
    required: true
    description: The block number, tag, or hash at which to retrieve the account information.
    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
          description: Unsigned integer block height (e.g., 0 for genesis).
          type: string
          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
        - 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: Account information
  description: An object containing the account's balance, code, and nonce.
  schema:
    type: object
    required:
      - balance
      - code
      - nonce
    additionalProperties: false
    properties:
      balance:
        title: hex encoded unsigned integer
        type: string
        pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
        description: The account's current balance in wei, encoded as a hexadecimal string.
      code:
        title: hex encoded bytes
        type: string
        pattern: ^0x[0-9a-f]*$
        description: The compiled bytecode deployed at the address.
      nonce:
        title: hex encoded unsigned integer
        type: string
        pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
        description: The number of transactions sent from the account since genesis.
examples:
  - name: eth_getAccountInfo example
    params:
      - name: Address
        value: '0xfe3b557e8fb62b89f4916b721be55ceb828dbd73'
      - name: Block
        value: latest
    result:
      name: Account information
      value:
        balance: '0x1cfe56f3795885980000'
        code: 0x
        nonce: '0x5'
```
