Ethereum
Bereit, das in der Produktion aufzurufen?
Das Free-Tier deckt persönliche Projekte ab. Pay-as-you-go skaliert ohne Karte.
Ethereum
Das Free-Tier deckt persönliche Projekte ab. Pay-as-you-go skaliert ohne Karte.
Almost everything you read from Ethereum is, at bottom, a block. Transactions, receipts, logs, balances, gas prices — they all live inside the chain of blocks that a new validator extends every 12 seconds. Learn to fetch, read, and follow blocks and you've learned the substrate the rest of the JSON-RPC API sits on top of. It's the first thing worth getting comfortable with on chain 1.
This is the foundational guide. After it you'll know what a block actually contains, how to pull one by number or hash, how to follow the head live with a newHeads subscription, and what Ethereum's block tags (latest, safe, finalized) mean for trusting the data. The deeper, scenario-specific guides on reorgs, confirmations, gas, and production hardening build on the vocabulary established here. You can follow along against https://ethereum.therpc.io/YOUR_API_KEY.
number, hash, parentHash (the link to the previous block), timestamp, gasLimit and gasUsed, the EIP-1559 baseFeePerGas, the stateRoot, and post-Dencun blobGasUsed/excessBlobGas. The body holds the ordered list of transactions. Post-Merge, sha3Uncles is the empty-list hash and the uncles array is empty.eth_getBlockByNumber or by hash with eth_getBlockByHash. A boolean flag controls whether you get full transaction objects or just their hashes. The block parameter also accepts the tags latest, safe, finalized, pending, and earliest in place of a number.eth_subscribe('newHeads') subscription over the WebSocket endpoint, which pushes each new block within its 12-second slot.finalized tag rather than tallying a fixed count.finalized block is irreversible unless a third of all staked ETH is slashed; safe is a softer justified guarantee; latest can still reorg out. That tag, not a confirmation number, is what tells you a block is settled on chain 1.latest. Any data pulled at latest can be reorged away before it finalizes. If you're acting on it, check that each new block's parentHash matches what you last stored, and prefer finalized for anything you can't undo. (The reorg guide goes deeper.)finalized never change — cache them indefinitely keyed by hash. Don't cache latest or pending for long, since both move; a TTL of a slot or two is plenty.gasUsed against gasLimit and the current baseFeePerGas. Tracking how full blocks are running tells you whether the base fee is about to climb, which is what you need to set fees that get your transactions included without overpaying.