For the complete documentation index, see llms.txt. This page is also available as Markdown.

eth_accounts - BSC

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 returns a list of addresses owned by the client. For public RPC endpoints like GetBlock, this typically returns an empty array since no private keys are stored server-side. This method is primarily useful when connecting to a local node with unlocked accounts.

Parameters

  • None

Request Example

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"
}'
const axios = require('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(response.data))
.catch(error => console.error(error));

Response Example

{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": []
}

Response Parameters

Parameter
Type
Description

jsonrpc

string

JSON-RPC version (2.0)

id

string

Request identifier

result

array

Empty array for public RPC endpoints

Use Cases

  • Check for locally stored accounts on a node

  • Verify RPC endpoint configuration

  • Wallet integration testing

  • Node account management verification

Error Handling

Error Code
Description

-32601

Method not found - method may be disabled

-32603

Internal error - node processing issues

SDK Integration

Last updated

Was this helpful?