Anchor,Solana -> failed to send transaction: Transaction simulation failed Custom Error 0x0

1.7k Views Asked by At

I am trying to build a simple coin flip game in solana.

Full code here

I get this error: Error: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: custom program error: 0x0

I followed some tutorials on how to use PDA's but couldn't find a report/workaround to an error as such.

Tests are running on localhost

I did some research and it might be that the account was already initialized ( maybe, no idea)

the part that is giving the error:

try {
  await program.rpc.initialize(bump,
      {
        accounts: {
          treasury: treasuryPda, // publickey for our new account
          user: provider.wallet.publicKey,
          systemProgram: SystemProgram.programId // just for Anchor reference
        },
      });
} catch (error) {
  console.log("Transaction error: ", error);
  console.log("blabla:", error.toString());
}
0

There are 0 best solutions below