eth_accounts - Polygon
Example code for the eth_accounts json-rpc method. Сomplete guide on how to use eth_accounts json-rpc in GetBlock.io Web3 documentation.
The eth_accounts method returns a list of addresses owned by the client node. Since GetBlock provides access to shared infrastructure rather than personal nodes, this method typically returns an empty array, as account management is not handled by the RPC endpoint.
This method is part of the Polygon JSON-RPC Core API and is useful for checking if any accounts are available for signing transactions directly through the node.
Parameters
None
Request
curl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "eth_accounts",
"params": [],
"id": "getblock.io"
}'import axios from 'axios';
const url = 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/';
const payload = {
jsonrpc: '2.0',
method: 'eth_accounts',
params: [],
id: 'getblock.io'
};
axios.post(url, payload, {
headers: { 'Content-Type': 'application/json' }
})
.then(response => console.log('Accounts:', response.data.result))
.catch(error => console.error(error));Response
{
"jsonrpc": "2.0",
"id": "getblock.io",
"result": []
}Response Parameters
jsonrpc
string
JSON-RPC version (2.0)
id
string
Request identifier
result
array
List of account addresses (typically empty for shared nodes)
Use Case
The eth_accounts method is typically used for:
Checking if the connected node manages any accounts
Verifying node configuration for account-based operations
Determining available signers for transaction signing
Development and debugging purposes
Error Handling
403
Forbidden
Missing or invalid ACCESS-TOKEN
-32600
Invalid Request
Malformed request body
Web3 Integration
Last updated
Was this helpful?