Base
Pronto para usar isso em produção?
O plano gratuito cobre projetos pessoais. O pay-as-you-go escala sem cartão de crédito.
Base
O plano gratuito cobre projetos pessoais. O pay-as-you-go escala sem cartão de crédito.
This page collects the Base operations developers reach for first: reading the latest block from the sequencer, checking ETH balances, looking up transactions and their receipts, fetching blocks by number or hash, calling smart contracts like Aerodrome or Uniswap, and pulling gas price and nonce before sending a transaction. Every example targets https://base.therpc.io/YOUR_API_KEY and works the same as on Ethereum L1, since Base is an EVM-equivalent OP Stack rollup.
Two foundational reads cover most starting points on Base. eth_blockNumber returns the height of the latest block — with Base producing blocks about every 2 seconds, this value advances quickly. eth_getBalance returns an account's ETH balance, but note the value comes back in wei as a hex string; divide by 10^18 (10 to the 18th power) to convert it to ETH for display.
There are two ways to read a transaction on Base. eth_getTransactionByHash returns the transaction itself by its hash — sender, recipient, value, gas, and input data — and tells you whether it is still pending or already mined. eth_getTransactionReceipt returns the receipt once the transaction is confirmed, including its status (success or revert), the block it landed in, the actual gas used, and the emitted event logs you need to decode token transfers and contract events.
You can fetch a Base block two ways: eth_getBlockByNumber takes a block height (or a tag like latest), and eth_getBlockByHash takes the block's hash. Both accept a boolean second parameter: pass true to get full transaction objects embedded in the block, or false to get just the array of transaction hashes — use false when you only need block metadata, since it returns far less data.
Two methods cover reading from Base smart contracts. eth_call executes a contract's view or pure function without sending a transaction or spending gas — this is how you read an ERC-20 token balance, a pool's reserves on Aerodrome, or any on-chain getter. eth_getCode returns the deployed bytecode at an address, which you can use to confirm a contract exists (an empty result means it is a plain account, not a contract).
Two checks confirm you are talking to a healthy Base endpoint. net_version returns the chain ID as a string — for Base it returns 8453, so you can assert you are on the right network before broadcasting. eth_syncing reports the node's sync state: it returns false when the node is fully caught up to the chain head, or an object with sync progress while it is still catching up.
Before sending a transaction on Base you typically read two values. eth_gasPrice returns the current gas price in wei — on Base, L2 execution fees are low, though the price still moves with demand. eth_getTransactionCount returns an account's nonce, the count of transactions it has already sent. The nonce sequences transactions from an address: each new transaction must use the next nonce in order, so reading it correctly prevents stuck or rejected transactions.