Skip to main content
← All agent examples

Export Ethereum USDC transfers.

Export USDC Transfer logs on Ethereum with bounded eth_getLogs ranges, adaptive splitting, request limits, and resumable block checkpoints. This recipe reads blockchain data. It does not create an account, sign a transaction, or fund credit.

Pay per request with USDC is available for supported RPC calls and batches without an account where billing requirements allow. A filtered 10,000-block log request costs 0.000013 USDC where supported. Check the network limit and get a free quote. The downloadable scripts below use an RPC key and do not make payments.

Try SolidRPC without an account.

Copy and run this request to check the connection. No account, API key, or payment is needed. Each command makes one read-only request and stops after 15 seconds.

Ethereum · check chain ID
curl --silent --show-error --fail-with-body --max-time 15 \
  'https://rpc.solidrpc.io/public/evm/1' \
  -H 'Content-Type: application/json' \
  --data '{"jsonrpc":"2.0","id":1,"method":"eth_chainId","params":[]}'

Expected result: 0x1 (Ethereum, chain ID 1).

Then read USDC transfers from Ethereum block 21,000,000. This filtered, one-block sample checks the method before you plan an export.

Ethereum · one-block USDC sample
curl --silent --show-error --fail-with-body --max-time 15 \
  'https://rpc.solidrpc.io/public/evm/1' \
  -H 'Content-Type: application/json' \
  --data '{"jsonrpc":"2.0","id":1,"method":"eth_getLogs","params":[{"fromBlock":"0x1406f40","toBlock":"0x1406f40","address":"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}]}'

A successful response contains a result array of logs. An empty array is valid. A JSON-RPC error is a failed request, even with HTTP 200.

Use public RPC for small checks and light traffic. Public limits apply, including single-call requests, rate limits, and a 2 MiB response cap. Stop on errors or throttling. Indexing and production backfills need an authenticated endpoint.

Need your agent to manage keys, usage, and billing? Set up agent access with an approved budget. Free accounts do not support agent control.

Give your agent the task.

Task prompt
Export Ethereum USDC Transfer events for the block range I provide using SolidRPC. Estimate the request count, test a small historical range, and ask before spending. Use address and topic filters, bounded chunks, and persistent checkpoints. Do not treat an RPC error as an empty result.

For the downloadable script below, use an ak_ RPC key. Follow agent account setup when you need delegated account access. A management token beginning with sa_ cannot be used for RPC calls.

Check coverage and limits.

Required methods: eth_chainId, eth_blockNumber, eth_getLogs. Read the network catalog and rate limits before a large run. One billable method call uses one response unit. Retries and range splits add requests.

Ethereum has chain ID 1. USDC is 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48. Filter by this contract and the Transfer(address,address,uint256) event topic. Historical logs are distinct from historical state. Check Ethereum coverage and sample your earliest required block before a large export.

There is no universal successful range size. Log density and response size matter. Start with 100 blocks, split size-limit errors, and stop on quota, authorization, or unresolved provider errors. The example caps ranges at 1,000 blocks per request and a run at 100,001 blocks. Those are example safeguards, not advertised service limits. Choose finalized historical ranges and reconcile block hashes when operating near the head.

Contract reference: Circle’s official USDC addresses. Do not substitute a similarly named bridged token.

Run the example.

Download ethereum-usdc-transfers.mjs and its shared rpc-client.mjs into the same folder. Review them before running. The helper refuses management tokens and redirects, sends the RPC key in a header, and makes read-only calls with bounded retries.

Configuration
# Node.js 22 or newer. Save both linked scripts in one folder.
export RPC_ORIGIN='https://rpc.solidrpc.io'
export RPC_KEY_FILE='/absolute/path/to/private/rpc-key'
Run
# Replace these with the block range you intend to export.
FROM_BLOCK=21000000 TO_BLOCK=21000099 \
CHUNK_BLOCKS=100 MAX_REQUESTS=100 \
node ethereum-usdc-transfers.mjs > transfers.ndjson 2> progress.log

Keep the key file outside your repository. The scripts print results without credentials. They do not automatically purchase more credit when the account runs out.

Know what success looks like.

Each output line is a decoded transfer with its block hash, transaction hash, log index, sender, recipient, and exact USDC amount. A successfully queried empty range produces no transfer rows and still writes a completed-range checkpoint to stderr.

On failure, preserve both output and the progress log. Resume at the next block after the last completed range, writing to a new output file. Deduplicate combined output by block hash, transaction hash, and log index. The request cap counts logical calls, and each can make up to four HTTP attempts. This is not a full continuously running indexer.

For errors, inspect HTTP status and the JSON-RPC error separately. Use the error reference. Report any partial result instead of claiming the entire task completed.

Need account access? Read the setup guide or open the management API contract.