eth_accounts - Arbitrum
Example code for the eth_accounts JSON RPC method. Сomplete guide on how to use eth_accounts JSON RPC in GetBlock Web3 documentation.
This method gets a list of addresses owned by the client.
Parameters
None
Request
curl --location 'https://go.getblock.us/<ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"method": "eth_accounts",
"params": [],
"id": "getblock.io"
}'import 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://go.getblock.us/<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);
});
Response
{
"jsonrpc": "2.0",
"id": "1",
"result": [
"0xd1f5279be4b4dd94133a23dee1b23f5bfe436tf3r"
]
}Response Parameter Definition
result
string
An array of addresses owned by the client.
If the accounts doesn't have any address, it returns empty array.
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
403
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
Last updated
Was this helpful?