# getAccountInfo
Solana API method that returns all information associated with the account of the provided public key.
Parameters:
address
— the public key of the account to query as a base58 encoded string.
Returns:
The result will be an RPC response JSON object with value
equal to one of the following:
<null>
— if the requested account doesn't exist.<object>
— a JSON object containing:lamports: <u64>
— the number of lamports assigned to this account, asu64
.owner: <string>
— the base58 encoded public key of the program this account has been assigned to.data: <[string encoding]|object>
— the data associated with the account, either as encoded binary data or JSON format{<program>: <state>}
, depending on encoding parameter.executable: <bool>
— a boolean indicating if the account contains a program and is strictly read-only.rentEpoch: <u64>
— the epoch at which this account will next owe rent, asu64
.
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.getAccountInfo(publicKey))
})()