Establish a JSON RPC connection
URL to the fullnode JSON RPC endpoint
OptionalcommitmentOrConfig: Commitment | ConnectionConfigoptional default commitment level or optional ConnectionConfig configuration object
The default commitment used for requests
The RPC endpoint
Optionaloverride: CommitmentOptionalencoding: "base64" | "jsonParsed"Optionalextra: anyOptionalcommitment: CommitmentOptionalcommitment: CommitmentInstead, call confirmTransaction and pass in TransactionConfirmationStrategy
Fetch all the account info for the specified public key
OptionalcommitmentOrConfig: Commitment | GetAccountInfoConfigFetch all the account info for the specified public key, return with context
OptionalcommitmentOrConfig: Commitment | GetAccountInfoConfigOptionalconfig: GetAccountInfoConfigFetch the balance for the specified public key
OptionalcommitmentOrConfig: Commitment | GetBalanceConfigFetch the balance for the specified public key, return with context
OptionalcommitmentOrConfig: Commitment | GetBalanceConfigFetch a processed block from the cluster.
OptionalrawConfig: GetBlockConfigFetch a processed block from the cluster.
OptionalrawConfig: GetVersionedBlockConfigFetch a processed block from the cluster.
Fetch a processed block from the cluster.
OptionalconfigOrCommitment: Commitment | GetBlockProductionConfigFetch a list of Signatures from the cluster for a block, excluding rewards
Optionalcommitment: FinalityReturn the list of nodes that are currently participating in the cluster
Fetch a list of Transactions and transaction statuses from the cluster for a confirmed block.
Optionalcommitment: FinalityDeprecated since RPC v1.7.0. Please use getBlock instead.
Fetch a list of Signatures from the cluster for a confirmed block, excluding rewards
Optionalcommitment: FinalityDeprecated since RPC v1.7.0. Please use getBlockSignatures instead.
Fetch a list of all the confirmed signatures for transactions involving an address within a specified slot range. Max range allowed is 10,000 slots.
queried address
start slot, inclusive
end slot, inclusive
Deprecated since RPC v1.3. Please use getConfirmedSignaturesForAddress2 instead.
Returns confirmed signatures for transactions involving an address backwards in time from the provided signature or most recent confirmed block
Optionaloptions: ConfirmedSignaturesForAddress2OptionsOptionalcommitment: FinalityDeprecated since RPC v1.7.0. Please use getSignaturesForAddress instead.
Fetch a transaction details for a confirmed transaction
Optionalcommitment: FinalityDeprecated since RPC v1.7.0. Please use getTransaction instead.
Fetch the Epoch Info parameters
OptionalcommitmentOrConfig: Commitment | GetEpochInfoConfigFetch the Epoch Schedule parameters
Fetch the fee calculator for a recent blockhash from the cluster, return with context
Optionalcommitment: CommitmentDeprecated since RPC v1.9.0. Please use getFeeForMessage instead.
Fetch the fee for a message from the cluster, return with context
Optionalcommitment: CommitmentFetch the cluster InflationGovernor parameters
Optionalcommitment: CommitmentFetch the specific inflation values for the current epoch
Fetch the inflation reward for a list of addresses for an epoch
Optionalepoch: numberOptionalcommitmentOrConfig: Commitment | GetInflationRewardConfigFetch the 20 largest accounts with their current balances
Optionalconfig: GetLargestAccountsConfigFetch the latest blockhash from the cluster
OptionalcommitmentOrConfig: Commitment | GetLatestBlockhashConfigFetch the latest blockhash from the cluster
OptionalcommitmentOrConfig: Commitment | GetLatestBlockhashConfigFetch the leader schedule for the current epoch
Fetch the minimum balance needed to exempt an account of dataLength
size from rent
Optionalcommitment: CommitmentFetch all the account info for multiple accounts specified by an array of public keys
OptionalcommitmentOrConfig: Commitment | GetMultipleAccountsConfigFetch all the account info for multiple accounts specified by an array of public keys, return with context
OptionalcommitmentOrConfig: Commitment | GetMultipleAccountsConfigFetch all the account info for multiple accounts specified by an array of public keys, return with context
OptionalrawConfig: GetMultipleAccountsConfigFetch the contents of a Nonce account from the cluster
OptionalcommitmentOrConfig: Commitment | GetNonceConfigFetch the contents of a Nonce account from the cluster, return with context
OptionalcommitmentOrConfig: Commitment | GetNonceAndContextConfigFetch parsed account info for the specified public key
OptionalcommitmentOrConfig: Commitment | GetAccountInfoConfigFetch parsed transaction details for a confirmed or finalized block
OptionalrawConfig: GetVersionedBlockConfigFetch parsed transaction details for a confirmed or finalized block
Fetch parsed transaction details for a confirmed or finalized block
Fetch parsed transaction details for a confirmed transaction
Optionalcommitment: FinalityDeprecated since RPC v1.7.0. Please use getParsedTransaction instead.
Fetch parsed transaction details for a batch of confirmed transactions
Optionalcommitment: FinalityDeprecated since RPC v1.7.0. Please use getParsedTransactions instead.
Fetch and parse all the accounts owned by the specified program id
OptionalconfigOrCommitment: Commitment | GetParsedProgramAccountsConfigFetch parsed token accounts owned by the specified account
Optionalcommitment: CommitmentFetch parsed transaction details for a confirmed or finalized transaction
OptionalcommitmentOrConfig: Finality | GetVersionedTransactionConfigFetch parsed transaction details for a batch of confirmed transactions
OptionalcommitmentOrConfig: Finality | GetVersionedTransactionConfigFetch all the accounts owned by the specified program id
Fetch all the accounts owned by the specified program id
OptionalconfigOrCommitment: Commitment | GetProgramAccountsConfigFetch a recent blockhash from the cluster
Optionalcommitment: CommitmentDeprecated since RPC v1.8.0. Please use getLatestBlockhash instead.
Fetch a recent blockhash from the cluster, return with context
Optionalcommitment: CommitmentDeprecated since RPC v1.9.0. Please use getLatestBlockhash instead.
Fetch recent performance samples
Optionallimit: numberFetch a list of prioritization fees from recent blocks.
Optionalconfig: GetRecentPrioritizationFeesConfigReturns confirmed signatures for transactions involving an address backwards in time from the provided signature or most recent confirmed block
queried address
Optionaloptions: SignaturesForAddressOptionsOptionalcommitment: FinalityFetch the current status of a signature
Optionalconfig: SignatureStatusConfigFetch the current statuses of a batch of signatures
Optionalconfig: SignatureStatusConfigFetch the current slot that the node is processing
OptionalcommitmentOrConfig: Commitment | GetSlotConfigFetch the current slot leader of the cluster
OptionalcommitmentOrConfig: Commitment | GetSlotLeaderConfigReturns epoch activation information for a stake account that has been delegated
OptionalcommitmentOrConfig: Commitment | GetStakeActivationConfigOptionalepoch: numberget the stake minimum delegation
Optionalconfig: GetStakeMinimumDelegationConfigFetch information about the current supply
Optionalconfig: Commitment | GetSupplyConfigFetch the current balance of a token account
Optionalcommitment: CommitmentFetch all the token accounts owned by the specified account
OptionalcommitmentOrConfig: Commitment | GetTokenAccountsByOwnerConfigFetch the 20 largest token accounts with their current balances for a given mint.
Optionalcommitment: CommitmentFetch the current supply of a token mint
Optionalcommitment: CommitmentFetch the current total currency supply of the cluster in lamports
Optionalcommitment: CommitmentDeprecated since RPC v1.2.8. Please use getSupply instead.
Fetch a confirmed or finalized transaction from the cluster.
OptionalrawConfig: GetTransactionConfigFetch a confirmed or finalized transaction from the cluster.
Fetch the current transaction count of the cluster
OptionalcommitmentOrConfig: Commitment | GetTransactionCountConfigFetch transaction details for a batch of confirmed transactions. Similar to getParsedTransactions but returns a TransactionResponse.
OptionalcommitmentOrConfig: GetTransactionConfig | FinalityFetch transaction details for a batch of confirmed transactions. Similar to getParsedTransactions but returns a VersionedTransactionResponse.
Return the list of nodes that are currently participating in the cluster
Optionalcommitment: CommitmentReturns whether a blockhash is still valid or not
OptionalrawConfig: IsBlockhashValidConfigRegister a callback to be invoked whenever the specified account changes
Public key of the account to monitor
Function to invoke whenever the account is changed
Optionalconfig: Readonly<subscription id
Optionalcommitment: CommitmentInstead, pass in an AccountSubscriptionConfig
Registers a callback to be invoked whenever logs are emitted.
Optionalcommitment: CommitmentRegister a callback to be invoked whenever accounts owned by the specified program change
Public key of the program to monitor
Function to invoke whenever the account is changed
Optionalconfig: Readonly<subscription id
Optionalcommitment: CommitmentOptionalfilters: GetProgramAccountsFilter[]Instead, pass in a ProgramAccountSubscriptionConfig
Register a callback to be invoked upon root changes
Function to invoke whenever the root changes
subscription id
Register a callback to be invoked upon signature updates
Transaction signature string in base 58
Function to invoke on signature notifications
Optionalcommitment: CommitmentSpecify the commitment level signature must reach before notification
subscription id
Register a callback to be invoked when a transaction is received and/or processed.
Transaction signature string in base 58
Function to invoke on signature notifications
Optionaloptions: SignatureSubscriptionOptionsEnable received notifications and set the commitment level that signature must reach before notification
subscription id
Register a callback to be invoked upon slot changes
Function to invoke whenever the slot changes
subscription id
Register a callback to be invoked upon slot updates. SlotUpdate's may be useful to track live progress of a cluster.
Function to invoke whenever the slot updates
subscription id
Request an allocation of lamports to the specified address
import { Connection, PublicKey, LAMPORTS_PER_SOL } from "@solana/web3.js";
(async () => {
const connection = new Connection("https://api.testnet.solana.com", "confirmed");
const myAddress = new PublicKey("2nr1bHFT86W9tGnyvmYW4vcHKsQB3sVQfnddasz4kExM");
const signature = await connection.requestAirdrop(myAddress, LAMPORTS_PER_SOL);
await connection.confirmTransaction(signature);
})();
Send a transaction that has already been signed, serialized into the wire format, and encoded as a base64 string
Optionaloptions: SendOptionsSend a transaction that has already been signed and serialized into the wire format
Optionaloptions: SendOptionsSign and send a transaction
Optionaloptions: SendOptionsInstead, call sendTransaction with a VersionedTransaction
Send a signed transaction
Optionaloptions: SendOptionsSimulate a transaction
Optionalsigners: Signer[]OptionalincludeAccounts: boolean | PublicKey[]Instead, call simulateTransaction with VersionedTransaction and SimulateTransactionConfig parameters
Simulate a transaction
Optionalconfig: SimulateTransactionConfig
A connection to a fullnode JSON RPC endpoint