Menu

1 / 2

Solana Transactions Cost Money Even When They Fail

DEV Community·Prasiddh Naik·6 months ago
#OHk306MR
#web3#blockchain#cryptocurrency#solana#error
Reading 0:00
15s threshold

Here's what I learned in 3 weeks: failed transactions on Solana cost real SOL .

The Surprise

As a backend dev, I'm used to failed requests being free. A 500 error? Retry it. It's no big deal.

Solana is different. When you send a transaction, three things can happen:

CLI catches it → Free (local balance check)

Simulation catches it → Free (RPC preflight check)

On-chain fails → Costs 0.000005 SOL

Watching It Happen

I created a broke wallet (0 SOL) and tried to transfer:

solana transfer --from /tmp/broke-wallet.json $RECIPIENT 1 # Error: insufficient funds (caught locally, free)

Enter fullscreen mode

Exit fullscreen mode

Then I used a funded wallet but tried to send more than my balance:

// With skipPreflight = true (dangerous) await rpc . sendTransaction ( tx , { skipPreflight : true });

Enter fullscreen mode

Exit fullscreen mode

Result:

Signature: 5NWqdwSCmc3vz2PAwMmBQppL6uogPB7qkRWzUnCFtA9...…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.