# getBalance

Solana API method that returns the balance of the account of the provided public key.

Parameters:

  • address — the public key of the account to query as a base58 encoded string.

Returns:

Example:

  • Solana web3.js
  • Solana.py
  • cURL
import { PublicKey, Connection } from "@solana/web3.js"

const nodeUrl = "CHAINSTACK_NODE_URL"
const publicKey = new PublicKey(
  "HSH3LftAhgNEQmpNRuE1ghnbqVHsxt8edvid1zdLxH5C"
);

(async () => {  
  const connect = new Connection(nodeUrl);
  console.log(await connect.getBalance(publicKey))
})()