Basic Operations
This guide covers the most common operations you'll perform with the Ethereum blockchain using TheRPC API.
# Retrieving Basic Information
Get Latest Block Number
JavaScript1{
2 "jsonrpc": "2.0",
3 "method": "eth_blockNumber",
4 "params": [],
5 "id": 1
6}
See eth_blockNumber for more details.
Check Account Balance
JavaScript1{
2 "jsonrpc": "2.0",
3 "method": "eth_getBalance",
4 "params": [
5 "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
6 "latest"
7 ],
8 "id": 1
9}
See eth_getBalance for more details.
# Transaction Operations
Get Transaction Status
JavaScript1{
2 "jsonrpc": "2.0",
3 "method": "eth_getTransactionByHash",
4 "params": [
5 "0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b"
6 ],
7 "id": 1
8}
See eth_getTransactionByHash for more details.
Check Transaction Receipt
JavaScript1{
2 "jsonrpc": "2.0",
3 "method": "eth_getTransactionReceipt",
4 "params": [
5 "0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b"
6 ],
7 "id": 1
8}
See eth_getTransactionReceipt for more details.
# Block Information
Get Block by Number
JavaScript1{
2 "jsonrpc": "2.0",
3 "method": "eth_getBlockByNumber",
4 "params": [
5 "0xE81224",
6 false
7 ],
8 "id": 1
9}
See eth_getBlockByNumber for more details.
Get Block by Hash
JavaScript1{
2 "jsonrpc": "2.0",
3 "method": "eth_getBlockByHash",
4 "params": [
5 "0xdc0818cf78f21a8e70579cb46a43643f78291264dda342ae31049421c82d21ae",
6 false
7 ],
8 "id": 1
9}
See eth_getBlockByHash for more details.
# Smart Contract Interactions
Call Contract Method
JavaScript1{
2 "jsonrpc": "2.0",
3 "method": "eth_call",
4 "params": [
5 {
6 "to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
7 "data": "0x70a08231000000000000000000000000742d35Cc6634C0532925a3b844Bc454e4438f44e"
8 },
9 "latest"
10 ],
11 "id": 1
12}
See eth_call for more details.
Get Contract Code
JavaScript1{
2 "jsonrpc": "2.0",
3 "method": "eth_getCode",
4 "params": [
5 "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
6 "latest"
7 ],
8 "id": 1
9}
See eth_getCode for more details.
# Network Status
Get Network Version
JavaScript1{
2 "jsonrpc": "2.0",
3 "method": "net_version",
4 "params": [],
5 "id": 1
6}
See net_version for more details.
Check Node Sync Status
JavaScript1{
2 "jsonrpc": "2.0",
3 "method": "eth_syncing",
4 "params": [],
5 "id": 1
6}
See eth_syncing for more details.
# Gas and Nonce
Get Gas Price
JavaScript1{
2 "jsonrpc": "2.0",
3 "method": "eth_gasPrice",
4 "params": [],
5 "id": 1
6}
See eth_gasPrice for more details.
Get Transaction Count (Nonce)
JavaScript1{
2 "jsonrpc": "2.0",
3 "method": "eth_getTransactionCount",
4 "params": [
5 "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
6 "latest"
7 ],
8 "id": 1
9}
See eth_getTransactionCount for more details.
Implementation Examples
For language-specific implementations, check our SDKs:
See also
- All Available Methods - Complete API reference
- Authentication Guide - Secure your API access
- FAQ - Common questions and answers