Skip to content

Advanced RPC Methods

Typed Alchemy also exposes token, utility, and simulation JSON-RPC methods. Use the network selector for each group.

Token Metadata

from alchemy import Alchemy

async with Alchemy.new() as client:
  metadata = await client.token('ethereum').get_token_metadata(
    '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
  )
  print(metadata)

Token Balances

from alchemy import Alchemy

async with Alchemy.new() as client:
  balances = await client.token('ethereum').get_token_balances(
    '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045',
    'erc20',
    options={'maxCount': 5},
  )
  print(balances['tokenBalances'])

Transaction Receipts

from alchemy import Alchemy

async with Alchemy.new() as client:
  receipts = await client.utility('ethereum').get_transaction_receipts({
    'blockNumber': '0xF1D1C6',
  })
  print(receipts['receipts'])

Simulate Asset Changes

from alchemy import Alchemy

async with Alchemy.new() as client:
  changes = await client.simulation('ethereum').asset_changes({
    'from': '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045',
    'to': '0x1E6E8695FAb3Eb382534915eA8d7Cc1D1994B152',
    'value': '0xDE0B6B3A7640000',
    'gas': '0x5208',
  })
  print(changes['changes'])