Solana RPC
At Chainup Cloud, we manage Solana RPC endpoints, handling hundreds of billions of requests each month. To simplify integration for developers, we've created documentation with examples of how to call RPC methods using cURL, JavaScript, Python. Chainup Cloud supports a wide range of Solana APIs, making development easier and more efficient.
You can review the official Solana RPC documentation HERE
Example RPC
Curl Javascript Python
Copy curl https://api.chainup.net/solana/mainnet/<YOUR_API_KEY> \
-X POST \
-H "Content-Type: application/json" \
--data '{"jsonrpc": "2.0","id": 1,"method": "getAccountInfo","params": ["7cVfgArCheMR6Cs4t6vz5rfnqd56vZq4ndaBrY5xkxXy",{"encoding": "base58"}]}'
Copy const axios = require('axios');
//npm install axios if you don have the module installed`
let options = {
url: "https://api.chainup.net/solana/mainnet/<YOUR_API_KEY>",
method: "post",
headers:
{
"content-type": "application/json"
},
body: JSON.stringify({"jsonrpc": "2.0","id": 1,"method": "getAccountInfo","params": ["7cVfgArCheMR6Cs4t6vz5rfnqd56vZq4ndaBrY5xkxXy",{"encoding": "base58"}])
};
axios(options)
.then(response => {
console.log('Post successful: response:', response.data);
})
.catch(error => {
console.error('An error has occurred:', error);
});
Copy import requests
import json
# Set the headers for the request
headers = {
"Content-Type": "application/json",
"CONSISTENT-HASH": "true"
}
# Prepare the payload for the RPC request
payload = json.dumps({
"jsonrpc": "2.0",
"id": 1,
"method": "getAccountInfo",
"params": [
"7cVfgArCheMR6Cs4t6vz5rfnqd56vZq4ndaBrY5xkxXy",
{"encoding": "base58"}
]
})
# Send the POST request to the Solana RPC endpoint
url = "https://api.chainup.net/solana/mainnet/<YOUR_API_KEY>"
try:
r = requests.post(url=url, headers=headers, data=payload)
# Check if the request was successful
if r.status_code == 200:
print("Post successful: response: ", r.content)
else:
print(f"An error occurred: {r.status_code}")
except requests.exceptions.RequestException as e:
print(f"Request failed: {e}")
Last updated 5 months ago