Is there a tutorial or detailed explanation on how to fetch all the transactions from a deployed contract on Solana? My concrete question is: I deployed a contract (https://explorer.solana.com/address/Ge74Zarei96aTUAswrMUiHDUPpTCk427XBX7Syby71wQ?cluster=devnet) and want to fetch all the accounts that were created when the function "start_stuff_off" was called. My attempt was been using anchor-py, as shown below:

client = AsyncClient("https://api.devnet.solana.com")
acc = await BaseAccount.fetch(client, adrr_contract)

whereas BaseAccount is auto-generated using the ClientGenerator from anchorpy. Any pointers/suggestions much appreciated!

PS - My current code can be found here (https://github.com/gabrielfior/solana-analytics/blob/master/Untitled.ipynb)

1 Answer 1


Easiest way is probably to use a getProgramAccounts RPC call, and search for the first 8 bytes matching the discriminator of the particular type of Anchor account you're looking for.

Detailed explanation here:


And Python implementation here: https://michaelhly.github.io/solana-py/rpc/async_api/#solana.rpc.async_api.AsyncClient.get_program_accounts

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.