eth_accounts - Arbitrum

This method gets a list of addresses owned by the client.

Parameters

  • None

Request

bashcurl --location 'https://shared.us-east-1.getblock.io/<ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
  "jsonrpc": "2.0",
  "method": "eth_accounts",
  "params": [],
  "id": "getblock.io"
}'
javascriptimport axios from 'axios'
let data = JSON.stringify({
  jsonrpc: "2.0",
  method: "eth_accounts",
  params: [],
  id: "getblock.io",
});

let config = {
  method: "post",
  maxBodyLength: Infinity,
  url: "https://shared.us-east-1.getblock.io/<ACCESS_TOKEN>",
  headers: {
    "Content-Type": "application/json",
  },
  data: data,
};

axios
  .request(config)
  .then((response) => {
    console.log(JSON.stringify(response.data));
  })
  .catch((error) => {
    console.log(error);
  });
pythonimport requests
import json

url = "https://shared.us-east-1.getblock.io/<ACESS_TOKEN>"

payload = json.dumps({
  "jsonrpc": "2.0",
  "method": "eth_accounts",
  "params": [],
  "id": "getblock.io"
})
headers = {
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
rs#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::builder()
        .build()?;

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("Content-Type", "application/json".parse()?);

    let data = r#"{
    "jsonrpc": "2.0",
     "method": "eth_accounts",
    "params": [],
    "id": "getblock.io"
}"#;

    let json: serde_json::Value = serde_json::from_str(&data)?;

    let request = client.request(reqwest::Method::POST, "https://shared.us-east-1.getblock.io/<ACCESS_TOKEN>")
        .headers(headers)
        .json(&json);

    let response = request.send().await?;
    let body = response.text().await?;

    println!("{}", body);

    Ok(())
}

Response

java{
  "jsonrpc": "2.0",
  "id": "1",
  "result": [
    "0xd1f5279be4b4dd94133a23dee1b23f5bfe436tf3r"
  ]
}

Response Parameter Definition

FieldData TypeDefinition
resultstring<p>An array of addresses owned by the client. </p><p></p><p>If the accounts doesn't have any address, it returns empty array. </p>

Use case

This method is generally used to:

  • Retrieve the list of locally unlocked accounts on a full node.
  • Identify which account a node can use for signing transactions.
  • Pre–Web3 wallet integrations where the node itself managed keys.

Error handling

Status CodeError MessageCause
403RBAC: access denied Missing or invalid ACCESS_TOKEN.

Integration with Web3

The eth_accounts can help developers to:

  • Identify available signing accounts
  • Auto-select a default wallet in development
  • Validate that a local signer exists
  • Simplify onboarding in testing environments
javascriptconst { ethers } = require('ethers');

// Initialize Ethers provider with GetBlock
const provider = new ethers.JsonRpcProvider(
    'https://shared.us-east-1.getblock.io/<ACCESS-TOKEN>/'
);

// Using the method through Ethers
async function useEthersMethod() {
    try {
        // Method-specific Ethers implementation
        const result = await provider.send('eth_accounts', []);
        console.log('Result:', result);
        return result;
    } catch (error) {
        console.error('Ethers Error:', error);
        throw error;
    }
}