getFirstAvailableBlock
Learn getFirstAvailableBlock use cases, code examples, request parameters, response structure, and tips.
Last updated
{
"jsonrpc": "2.0",
"id": 1,
"method": "getFirstAvailableBlock"
}const fetch = require('node-fetch');
async function getFirstAvailableBlock(rpcUrl) {
try {
const response = await fetch(rpcUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
jsonrpc: '2.0',
id: 1,
method: 'getFirstAvailableBlock'
}),
});
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';
getFirstAvailableBlock(RPC_URL);import requests
import json
def get_first_available_block(rpc_url):
try:
response = requests.post(
rpc_url,
headers={
'Content-Type': 'application/json',
},
json={
'jsonrpc': '2.0',
'id': 1,
'method': 'getFirstAvailableBlock'
}
)
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_first_available_block(RPC_URL){
"jsonrpc": "2.0",
"result": 0,
"id": 1
}