getIdentity
Learn getIdentity use cases, code examples, request parameters, response structure, and tips.
The getIdentity
RPC method returns the public key (identity) of the Solana RPC node you are connected to. Each node in the Solana network has a unique cryptographic keypair, and the public key serves as its node identifier.
✅ Common Use Cases
Identify the RPC Node Retrieve the unique public key of the node serving your request—useful in distributed systems or when using multiple providers.
Cross-reference with Cluster Nodes Combine with
getClusterNodes
to match the identity to other metadata (e.g., gossip, TPU, version) from the full cluster view.Logging and Debugging Track which RPC node handled a given request—ideal for diagnostics in multi-node environments.
Protocol-Level Verification (Advanced) Some advanced tooling may require node identity verification, though this is uncommon in general dApp workflows.
🛠Request Parameters
This method does not take any parameters.
📦 Response Structure
The result
field contains:
{
"jsonrpc": "2.0",
"result": {
"identity": "8Lx6...xKMN"
},
"id": 1
}
identity
string
Base-58 encoded public key of the node you are connected to.
💡 Example: Get RPC Node Identity
{
"jsonrpc": "2.0",
"id": 1,
"method": "getIdentity"
}
Code Examples
const fetch = require('node-fetch');
async function getIdentity(rpcUrl) {
try {
const response = await fetch(rpcUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
jsonrpc: '2.0',
id: 1,
method: 'getIdentity'
}),
});
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';
getIdentity(RPC_URL);
Example Response
{
"jsonrpc": "2.0",
"result": {
"identity": "56vSo3VUVsCqiKow9J2ZY7RWnHg5qrBDEbrvbd1VMzRa"
},
"id": 1
}
🧠Developer Tips
Node-Specific Identity The returned identity is unique to the specific RPC node queried. Connecting to another RPC server (even within the same cluster or provider) may return a different identity.
Not Related to Wallets This identity is not a user wallet or validator address—it strictly identifies the node process itself.
Key Stability A node’s identity is generally stable, but may change if the operator regenerates or replaces the node’s keypair.
Use for Traceability Consider including the node’s identity in debug logs or telemetry to trace request origins in distributed setups.
Last updated