Links
😱

Solana Program Account Webhooks

No more getProgramAccounts calls — get updates about all your program accounts in real-time.

Program Accounts Webhooks

The most infamous (and common) RPC call in Solana is undoubtedly: getProgramAccounts. This call returns all the accounts that your program owns. Since everything in Solana is an account, this call is very useful. However, this call is also VERY slow and inefficient since it has to do a full table scan of an RPC's database. Moreover, you often have to poll this method to periodically keep up with the accounts that your program owns.
No more.
With Helius Program Accounts Webhooks, you can simply subscribe to your program and we will stream you ALL of your programs' account updates in real-time — with built-in retries, low-latency, and fault tolerance.

Example Code

const createProgramWebhook = async () => {
try {
const response = await fetch(
"https://api.helius.xyz/v0/webhooks?api-key=<PASTE YOUR API KEY HERE>",
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
webhookURL: "https://your-webhook-server.com/your-endpoint",
accountAddresses: [],
accountAddressOwners: ["PASTE YOUR PROGRAM ADDRESS HERE"],
webhookType: "account",
}),
}
);
​
const data = await response.json();
console.log({ data });
} catch (e) {
console.error("error", e);
}
}
​
createProgramWebhook();