getTransactionCount
Learn getTransactionCount use cases, code examples, request parameters, response structure, and tips.
Last updated
{
"context": {
"slot": 221446650
},
"value": 1874219342
}{
"jsonrpc": "2.0",
"id": 1,
"method": "getTransactionCount",
"params": [
{
"commitment": "finalized"
}
]
}const fetch = require('node-fetch');
async function getTransactionCount(rpcUrl) {
try {
const response = await fetch(rpcUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
jsonrpc: '2.0',
id: 1,
method: 'getTransactionCount',
"params": [
{
"commitment": "confirmed"
}
]
}),
});
const data = await response.json();
// Print the exact full response
console.log('Full RPC Response:');
console.log(JSON.stringify(data, null, 2));
return data;
} catch (error) {
console.error('Error getting health:', error.message);
return null;
}
}
// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';
getTransactionCount(RPC_URL);import requests
import json
def get_transaction_count(rpc_url):
try:
response = requests.post(
rpc_url,
headers={
'Content-Type': 'application/json',
},
json={
'jsonrpc': '2.0',
'id': 1,
'method': 'getTransactionCount',
'params': [
{
'commitment': 'confirmed'
}
]
}
)
data = response.json()
# Print the exact full response
print('Full RPC Response:')
print(json.dumps(data, indent=2))
return data
except Exception as error:
print(f'Error getting health: {error}')
return None
# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_transaction_count(RPC_URL){
"jsonrpc": "2.0",
"result": 430177731688,
"id": 1
}