getIdentity
Returns this RPC node's identity Pubkey.
Request
curl / JSON-RPC
{ "jsonrpc": "2.0", "id": 1, "method": "getIdentity"}Kit
import { createSolanaRpc } from "@solana/kit"; const rpc_url = "https://rpc.openinfra.sh";const rpc = createSolanaRpc(rpc_url); let identity = await rpc.getIdentity().send(); console.log(identity);Rust
use anyhow::Result;use solana_client::nonblocking::rpc_client::RpcClient;use solana_commitment_config::CommitmentConfig; #[tokio::main]async fn main() -> Result<()> { let client = RpcClient::new_with_commitment( String::from("https://rpc.openinfra.sh"), CommitmentConfig::confirmed(), ); let identity = client.get_identity().await?; println!("{:#?}", identity); Ok(())}Parameters
This method takes no parameters.
Response
{ "jsonrpc": "2.0", "result": { "identity": "2r1F4iWqVcb8M1DbAjQuFpebkQHY9hcVU4WuW2DJBppN" }, "id": 1}| Field | Type | Description |
|---|---|---|
| identity | string | The identity pubkey of the current node, as a base-58 encoded string. |