Docs
Docs
Home
Getting Started
Agent Tooling
CLI
Supported Chains
Acala
Aptos
Arbitrum
Arc
Asset Hub
Astar
Avalanche
Base
Berachain
Bifrost
Binance Smart Chain
Bittensor
Blast
Boba Network
Bridge Hub
Celo
Centrifuge
Chiliz
Cronos
Enjin
Ethereum
Etherlink
Flow EVM Gateway
Gnosis
Hydration
Hyperliquid
Immutable
Ink
IoTeX
Kusama
Linea
LISK
Manta Atlantic
Manta Pacific
Mantle
MegaETH
Monad
Movement
Neuroweb
opBNB
Optimism
Plasma
Polkadot
Polygon
Pulsechain
Robinhood
Ronin
Scroll
Sonic
Starknet
Taiko
Tempo
Sui
TRON
Unichain
Viction
World Chain
XDC Network
XX Network
Zetachain
zkSync Era
Zora
Supported ChainsPlasmaJSON-RPC APIAccount Methods

eth_accounts - Plasma RPC Method

Returns a list of addresses owned by the client on Plasma. Typically returns an empty array on public RPC endpoints.

Plasma RPC endpoint: endpoint URLs, plans and pricing.

Returns a list of addresses owned by the client on Plasma.

Why Plasma? Build on an EVM Layer 1 for stablecoin payments with PlasmaBFT consensus and Reth execution with 1 second blocks, XPL gas, full EVM JSON-RPC, and debug plus txpool on Dwellir.

Important Note

On public RPC endpoints like Dwellir, eth_accounts returns an empty array because the node does not hold any private keys. This method is primarily useful for:

  • Local development nodes (Ganache, Hardhat, Anvil)
  • Private nodes with managed accounts
  • Wallet provider connections (MetaMask injects accounts)

When to Use This Method

eth_accounts is relevant for payment app developers, wallet teams, and teams shipping Solidity contracts for dollar transfers in specific scenarios:

  • Development Testing - Retrieve test accounts from local nodes
  • Wallet Detection - Check if a wallet provider has connected accounts
  • Client Verification - Confirm node account access capabilities

Best Practices

  • Most public providers disable this method for security reasons; expect an empty array return
  • Use wallet libraries (ethers.js, web3.py) for account management instead of relying on node-side accounts
  • An empty array return is normal on managed providers and does not indicate an error condition
JSON-RPC request
{
  "jsonrpc": "2.0",
  "method": "eth_accounts",
  "params": [],
  "id": 1
}

Code Examples

Common Use Cases

1. Development Environment Detection

Check if running against a development node with test accounts:

JavaScript
async function isDevEnvironment(provider) {
  const accounts = await provider.listAccounts();
  return accounts.length > 0;
}

const isDev = await isDevEnvironment(provider);
if (isDev) {
  console.log('Development environment detected');
}

2. Wallet Connection Check

Verify wallet provider has connected accounts:

JavaScript
async function checkWalletConnection() {
  if (typeof window.ethereum === 'undefined') {
    return { connected: false, reason: 'No wallet detected' };
  }

  const accounts = await window.ethereum.request({
    method: 'eth_accounts'
  });

  return {
    connected: accounts.length > 0,
    accounts: accounts
  };
}

3. Fallback Account Selection

Use first available account or request connection:

JavaScript
async function getActiveAccount() {
  // Check existing connections
  let accounts = await window.ethereum.request({
    method: 'eth_accounts'
  });

  // Request connection if no accounts
  if (accounts.length === 0) {
    accounts = await window.ethereum.request({
      method: 'eth_requestAccounts'
    });
  }

  return accounts[0] || null;
}

Error Handling

Common errors and solutions:

Error CodeDescriptionSolution
-32601Method not foundNode may not support this method
-32603Internal errorRetry with exponential backoff
JavaScript
async function safeGetAccounts(provider) {
  try {
    const accounts = await provider.listAccounts();
    return { success: true, accounts };
  } catch (error) {
    if (error.code === -32601) {
      console.warn('eth_accounts not supported on this node');
      return { success: false, accounts: [], reason: 'unsupported' };
    }
    throw error;
  }
}

Related Methods

  • eth_requestAccounts - Request wallet connection (browser wallets)
  • eth_getBalance - Get account balance
  • eth_getTransactionCount - Get account nonce

eth_getTransactionCount

Get the number of transactions sent from an address (nonce) on Plasma. Essential for nonce management, transaction signing, and detecting stuck transactions.

eth_sendRawTransaction

Submit signed transactions to Plasma. Essential for broadcasting transactions for stablecoin transfers, payment apps, and wallets that need 1 second confirmation.

On this page

Important NoteWhen to Use This MethodBest PracticesCode ExamplesCommon Use Cases1. Development Environment Detection2. Wallet Connection Check3. Fallback Account SelectionError HandlingRelated Methods