Solana (SOL)
GetBlock provides RPC endpoints that implement the Solana JSON-RPC API standard. These methods are core functionalities for interacting with Solana nodes, enabling seamless integration with the Solana blockchain.
Overview of Solana Network Methods
The Solana network offers a comprehensive suite of methods that enable developers to interact seamlessly with its blockchain infrastructure. This overview provides an in-depth examination of these methods, categorizing them into key functional areas for better understanding and implementation.
What you can expect to find in this documentation:
Compatibility with the Solana mainnet and testnets
Purpose, functionality, and use cases of each Solana method
Required input parameters
Sample requests and responses
Code examples in multiple programming languages (Python, JavaScript)
What you can do with this API:
Query real-time blockchain data
Manage and monitor accounts and balances
Interact with smart contracts
Submit and track transactions
Monitor network activity in real-time
To effectively use the Solana methods listed above, you'll need a reliable tool to send requests to the network. One such tool is Axios, a lightweight and widely used HTTP client. With Axios, you can easily interact with Solana's JSON-RPC API to execute transactions, retrieve blockchain data, and much more.
Quickstart with Axios
Axios is a powerful HTTP client that streamlines communication with APIs, including Solana's JSON-RPC interface. By using Axios, developers can effortlessly send requests and process responses, making blockchain integration straightforward and efficient. Below, we provide a detailed guide to help you get started:
Set Up Your Project
Choose a package manager and initialize your project:
Or, using Yarn:
Install Axios
Install Axios to make API requests:
Or, using Yarn:
Make Your First Request
Set up a new file named index.js
and insert the code snippet provided below:
Replace <ACCESS-TOKEN>
with your actual API key from GetBlock, and <ACCOUNT-PUBKEY>
with the public key of the account you wish to query.
Run Your Script
Execute your script with:
You should see the account balance logged to your console.
Quickstart with Python and requests
requests is a powerful and easy-to-use HTTP library for Python that simplifies API interactions, including Solana’s JSON-RPC API. With requests, developers can send requests, handle responses, and easily integrate blockchain functionality into their projects. Here’s a step-by-step guide to get started:
Set Up Your Project
Create a new directory for your project and navigate into it:
Set up a virtual environment to isolate dependencies:
Install the requests library:
Write Your First Script
Create a new file called main.py
and insert the following code:
Replace <ACCESS-TOKEN> with your actual API key from GetBlock, and <ACCOUNT-PUBKEY> with the public key of the account you wish to query.
Run Your Script
Execute the script with:
You should see the account balance retrieved from the Solana network printed to your console.
Network & Node Info
getClusterNodes
getHealth
getVersion
getIdentity
getGenesisHash
Block & Slot Info
getBlock
getBlockCommitment
getBlockHeight
getBlockProduction
getBlocks
getBlocksWithLimit
getBlockTime
getFirstAvailableBlock
getHighestSnapshotSlot
getSlot
getSlotLeader
getSlotLeaders
minimumLedgerSlot
Account Management
getAccountInfo
getMultipleAccounts
getProgramAccounts
getTokenAccountBalance
getTokenAccountsByDelegate
getTokenAccountsByOwner
getTokenLargestAccounts
getTokenSupply
getMinimumBalanceForRentExemption
requestAirdrop
getBalance
Transactions
sendTransaction
simulateTransaction
getTransaction
getTransactionCount
getSignatureStatuses
getSignaturesForAddress
getFeeForMessage
getLatestBlockhash
isBlockhashValid
Epoch & Stake
getEpochInfo
getEpochSchedule
getInflationGovernor
getInflationRate
getInflationReward
getLeaderSchedule
getStakeMinimumDelegation
Performance & Supply
getRecentPerformanceSamples
getRecentPrioritizationFees
getSupply
Governance / Validators
getVoteAccounts
Subscriptions (WebSocket Only)
accountSubscribe
accountUnsubscribe
blockSubscribe
blockUnsubscribe
logsSubscribe
logsUnsubscribe
programSubscribe
programUnsubscribe
rootSubscribe
rootUnsubscribe
signatureSubscribe
signatureUnsubscribe
slotSubscribe
slotUnsubscribe
slotsUpdatesSubscribe
slotsUpdatesUnsubscribe
voteSubscribe
voteUnsubscr
Conclusion
Solana’s JSON-RPC API offers a fast and efficient way to interact with the network—whether you're managing accounts, sending transactions, or tracking real-time data.
Grouped by functionality, the methods cover everything needed to build scalable Web3 applications with ease. With HTTP and WebSocket support, and tools like Axios and requests, integration is simple for developers of all levels.
Start building today and explore Solana’s full capabilities.
Last updated