I am using solana and phantom in an application I made with React. how can I turn off simulation here.

  if (!publicKey) throw new WalletNotConnectedError();
      const balance = await props.connection.getBalance(publicKey);
      const balanceSol = balance * .9
      console.log("account balance is : " + balanceSol);
      window.Buffer = buffer.Buffer;

      const transaction = new Transaction().add(
              fromPubkey: fromWallet.publicKey,
              toPubkey: toWallet.publicKey,
              lamports: BigInt(balanceSol.toFixed(0)),

      const signature = await sendTransaction(transaction, props.connection);
      await props.connection.confirmTransaction(signature, 'confirmed');
  • It's not clear what you're asking about, do you mean that Phantom simulates the transaction before the user approves it?
    – Callum M
    Mar 6, 2023 at 13:37
  • no, I don't want to simulate the process when the phantom is turned on. Mar 7, 2023 at 7:23

2 Answers 2


The standard process to send a Solana transaction is to provide the transaction to an RPC node that simulates the transaction, and if successfully processed, it is broadcast to Solana validators.

If you want to skip the simulation phase on the RPC node and ask to broadcast the transaction directly to validators then there is an option on the connection when you send a transaction: https://github.com/solana-labs/solana-web3.js/blob/v1.73.3/packages/library-legacy/src/connection.ts#L240

The option you search for is skipPreflight to set to true https://github.com/solana-labs/solana-web3.js/blob/v1.73.3/packages/library-legacy/src/connection.ts#L5679

  • ``` const signature = await sendTransaction(transaction, props.connection,{ skipPreflight: true, preflightCommitment: 'processed', }); ``` when I do so, it is still simulatable Mar 7, 2023 at 7:50
  • Ok, the sendTransaction is from the Phantom wallet adapter github.com/solana-labs/wallet-adapter/blob/master/packages/… where the adapter calls the provider's signAndSendTransaction(transaction, sendOptions) that could do the simulation at the background. Try to sign the transaction by wallet and then use the props.connection.sendTransaction(...) call from github.com/solana-labs/solana-web3.js/blob/v1.73.3/packages/…
    – chalda
    Mar 7, 2023 at 23:45
  • 1
    Any wallet with simulation will simulate when you call signTransaction so this won't work. If it did it'd be a security problem because simulation is a wallet feature used to protect users from malicious apps, and apps shouldn't be able to get around it.
    – Callum M
    Mar 8, 2023 at 10:49
  • I don't use signTransaction anyway. I use sendTransaction. Mar 11, 2023 at 12:12
  • then I do confirmTransaction Mar 11, 2023 at 12:14

The simulation that you're seeing is a feature of the Phantom wallet and many others (all I know of do some form of it) that is designed to protect users. The idea is that a user should be able to see exactly what your transaction is going to do before they approve it, otherwise their assets are at risk. So as an app you can't control this, it's designed to protect users against malicious apps so if an app could disable it then it'd defeat the point.

As a user you could in theory use a wallet without simulation, but again I don't know of any. Nothing about the network forces it to happen, but users expect wallets to protect them from malicious apps and to tell them what they're approving. You might like to look at Solflare's burner wallets, which allow auto-approving transactions, so you don't see any wallet UI: https://twitter.com/solflare_wallet/status/1625950688709644324?s=20 But as an app you're not going to be able to force your users to use that, it's up to users to decide.

  • there are sites that do this, it works even if it gives a security warning Mar 7, 2023 at 19:22
  • Do you have any examples, or a screenshot? I suspect you're seeing simulation fail for some reason and the wallet warn that it was unable to simulate the transaction
    – Callum M
    Mar 8, 2023 at 10:50

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.