I am creating PDA accounts which have seeds consisting of user-wallet-publicKey and a static-text

In frontend I want to show either user-data if user already created his account or a button to deploy new user-related-pda-account, for that I want to know if user already created / deployed account related to him or not

I am generating PDA-address in frontend like this:

const timerProgram = getTimerProgram(provider)
const [timerStatsPDA, _] = await PublicKey.findProgramAddress(

I am searching for function similar like this

const isExist = await isAccountExist(timerStatsPDA)

1 Answer 1


We can use connection.getAccountInfo() as follows to determine if any given account-address exist on blockchain or not

import { useConnection } from '@solana/wallet-adapter-react'
const { connection } = useConnection()
const accountInfo = await connection.getAccountInfo(timerStatsPDA)
const isExist = accountInfo !== null

I am using connection object from @solana/wallet-adapter-react here, but you can use connection from other npm-packages like @solana/web3.js

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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