In Solana, everything is an account. Your wallets, your NFTs, exchanges, DeFi apps, and all smart contracts (called programs in Solana) are accounts. In fact, the entire concept of the blockchain can be summed as: a bunch of accounts updating each other via transactions. It just so happens that on Solana there are a lot of transactions and a lot of accounts. As a result, keeping up with the sheer volume and speed of this data is quite challenging. But since *everything* is an account, it is crucial for Solana developers to master dealing with accounts. Specifically, reading data from them. This is exactly the problem that Helius Account and Program Account Webhooks are engineered to help with! But first, let’s take a look at how we can do this today.
Current Methods For Solana Account Updates
The most common way of receiving account updates on Solana is by subscribing to an account websocket. Here’s an example of this. This method is very simple to set up but suffers from a number of downsides:
- Websockets aren’t very reliable, they might drop data or the connection might close due to externalities.
- Websockets aren’t very flexible, you can not dynamically add/remove accounts to listen to and you can only listen to one account at a time.
- Websockets do not automatically decode the structure of an account.
- Websockets do not have retries or fault-tolerance mechanisms.
Polling via RPCs
Alternatively, you can poll for account information by invoking RPCs. To get account updates specifically, most developers will periodically call the getProgramAccounts RPC method. The problem with this method is that it’s a very expensive and inefficient operation on the RPC Nodes’ database — which might cause high RPC costs or poor performance. Additionally, polling architectures are more complex to maintain and scale for real time updates.
Enter Helius Account Webhooks
Helius Account Webhooks let you subscribe to hundreds of thousands of accounts and stream all of their updates to a URL of your choosing with added fault-tolerance, retries, automatic IDL decoding, and low latency.
You can also update the webhooks dynamically via our APIs. For example: you may add additional accounts to listen to or remove stale accounts.
The best part? You can also specify account owners (a.k.a PROGRAMS!) to listen to. Instead of calling getProgramAccounts repeatedly, you can simply input your program address for the account owner field and we will stream you all updates for your program accounts!
Check out this video for a quick demo and see for yourself.
Get Started For Free
You can get started for free, without inputting any card or email details by simply navigating to https://dev.helius.xyz, connecting your wallet and clicking “Generate API Key”.
For detailed documentation on how to use the webhooks, please check out our API docs (with code samples), here.