The Problem: Your Mental Model Is Broken
You know how to build APIs. You understand request/response cycles. You know that a successful POST returns 200 OK, and a failed request returns 400 Bad Request. You've never been charged for a 400.
Solana transactions will break every one of those assumptions.
Last week, I sent a transaction that failed due to insufficient funds. The validator still charged me a fee. A 400 Bad Request just cost me real money. That's when I realized: I was thinking about blockchain like it was an API, and it's not.
In this post, I'm going to show you exactly how Solana transactions work, how they differ from REST APIs, and why understanding those differences will make you a better blockchain developer.
Web2: Request/Response
Here's how you think about HTTP today:
POST /transfer
{
"recipient": "alice",
"amount": 100
}
→ Process on server
→ Return result
200 OK: Transfer succeeded
400 Bad Request: Invalid amount
401 Unauthorized: Not authenticated
Key properties:
- Stateless (each request is independent)
- Synchronous (you wait for a response)
- Validated on the server
- Failed requests are free (no charge for 400s)
- No signature needed (the server trusts TLS)
Web3: Signed State Transitions
Solana transactions are fundamentally different. They're not requests to a server. They're cryptographically signed instructions to change on-chain state.
// Build a transaction
const transaction = new Transaction({
recentBlockhash: blockhash,
feePayer: sender.publicKey
});
// Add an instruction
transaction.add(
SystemProgram.transfer({
fromPubkey: sender.publicKey,
toPubkey: recipient,
lamports: amount
})
);
// Sign with private key
transaction.sign(sender);
// Send to network
const signature = await connection.sendRawTransaction(
transaction.serialize()
);
Key differences:
- Stateful (changes on-chain state)
- Asynchronous (sign locally, then wait for validators)
- Validated by the network
- Failed transactions still cost fees
- Must be signed by the payer's private key
The Fee Problem
Here's the biggest shock: you pay whether the transaction succeeds or fails.
I tried to transfer 3.20 SOL with only 2.20 SOL balance. On an API, that would be a 400:
POST /transfer
400: Insufficient funds
Cost: $0.00
On Solana:
solana transfer 2iHFnuzv... 3.2
Error: Insufficient lamports (need 3.2, have 2.2)
Cost: 0.000005 SOL (~$0.0000005 on mainnet)
I got charged for a transaction that didn't execute.
Why? Because validators did work to process my transaction. They:
- Deserialized the signed bytes
- Loaded accounts from storage
- Executed the System Program instruction
- Checked preconditions (balance, signatures, etc.)
- Determined it would fail and rejected it
All of that costs compute resources. So they charge a fee. It's economically rational, and it's completely different from REST APIs.
The Three Commitment Levels
With HTTP, you get one response: 200 or error. Solana has three.
When I send a transaction, it moves through these stages:
1. Processed (~400ms)
A validator included my transaction in a recent block.
Waiting for processed... Transaction processed by validator
What it means: A single validator saw your transaction. Not yet secured by consensus.
Risk level: High (1-2% chance it gets forked away)
2. Confirmed (~800ms)
66%+ of validators voted on the block containing my transaction.
Waiting for confirmation from supermajority... Transaction confirmed by network
What it means: Network consensus. You won. It's almost impossible to reverse.
Risk level: Extremely low (no confirmed transaction has ever been reversed in Solana's history)
3. Finalized (~12s)
At least 31 additional confirmed blocks built on top.
Waiting for finalized... Transaction finalized
What it means: Irreversible. Like a database commit that's replicated to disk and backed up.
Risk level: Zero
Compare this to HTTP where you get one response:
HTTP 200 OK immediately
↑
Done. State changed.
Solana transactions are multi-stage. Different applications wait at different levels:
- Fast-paced DEX? Wait for "confirmed" (~800ms)
- Payment processor? Wait for "finalized" (~12s)
- Bridge operation? Wait for even more finalization
Real Code: I Built This
Here's my transfer tool. I send 0.01 SOL to a recipient:
$ node transfer.mjs 6SSAKkUGpyuB2dg81L4d8USfXjpnUXPX6qwif7bcQKwc 0.01
============================================================
Solana Transfer Tool
============================================================
Connected to Solana devnet
RPC: https://api.devnet.solana.com
Checking balance...
Balance: 2.253960000 SOL
Amount: 0.01 SOL (10,000,000 lamports)
Building transaction...
Signing transaction...
Sending to network...
Waiting for processed... Transaction processed by validator
Waiting for confirmation from supermajority... Transaction confirmed by network
Waiting for finalized... Transaction finalized
Transaction successful!
Signature: 4MNtSnAcA2JL3CgwrVqBAoqyhQVpnvog8LKc65MNjKaroTZDj8F8UhpieMnWRLhV6juAbvMypHP92YnaguRmbNGc
View on Solana Explorer:
https://explorer.solana.com/tx/4MNtSnAcA2JL3CgwrVqBAoqyhQVpnvog8LKc65MNjKaroTZDj8F8UhpieMnWRLhV6juAbvMypHP92YnaguRmbNGc?cluster=devnet
Final balance: 2.23895 SOL
This is the Solana equivalent of an HTTP POST. But look at the differences:
- I sign the transaction with my private key (HTTP just uses TLS)
- I wait through three commitment stages (HTTP returns immediately)
- I get a signature instead of a 200 OK (signatures prove finality)
- I can view the transaction on a public explorer (no such thing in Web2)
The Secret Weapon: Simulation
Remember how I said failed transactions cost fees?
There's a way around it: simulation.
Before you send a transaction, ask the network: "If I send this, what would happen?"
The network runs your transaction in a sandbox. If it would fail, it tells you. And you don't pay.
// Simulate first (costs nothing)
const simulation = await connection.simulateTransaction(unsignedTx);
if (simulation.value.err) {
console.log("Would fail:", simulation.value.err);
// Don't send - you just saved a fee!
} else {
// Safe to send
const sig = await connection.sendTransaction(tx);
}
This is the production pattern. Professional Solana apps always simulate before sending. It saves fees and catches errors early.
Mental Model: From Request/Response to State Transitions
Here's how I had to rethink things:
Before (HTTP Thinking)
1. Craft a request
2. Send it
3. Wait for response
4. Response tells me if it worked
5. If it failed, no penalty
After (Solana Thinking)
1. Build a signed transaction (cryptographic proof)
2. Simulate it (does it work? costs nothing)
3. Send it (if simulation passed)
4. Wait through three commitment stages (processed → confirmed → finalized)
5. If it fails, I still paid the fee (even in a sandbox!)
The key shift: You're not making a request to a server. You're proposing a signed change to global state that thousands of validators must agree on.
Why This Matters
Understanding these differences makes you a better blockchain developer because:
-
You'll design better error handling
- Can't just check for 200 vs 400
- Must handle async multi-stage confirmations
- Must implement retry logic for transient failures
-
You'll write more efficient code
- Simulate before sending (saves fees)
- Batch multiple operations in one transaction
- Choose the right commitment level for your use case
-
You'll make economically rational decisions
- Every transaction has a cost
- Failed transactions cost the same as successful ones
- This changes how you architect systems
-
You'll understand why certain constraints exist
- 1,232 byte transaction size limit (fits in UDP)
- ~90 second blockhash window (network state needs to be fresh)
- Fee charges for failure (validates work done by validators)
The Takeaway
REST APIs lied to you. They made state changes feel free and instantaneous. Solana is honest about it: changing state is work, it takes time, and you pay for it whether it succeeds or fails.
That honesty is uncomfortable at first. But it makes you a better engineer. You start thinking about:
- What operations are actually necessary?
- How can I batch work to minimize fees?
- What happens if this fails?
These are the questions that lead to well-designed systems.
If you're coming from Web2 and feeling lost in blockchain development, this mental shift is everything. Once you stop thinking of transactions as API calls and start thinking of them as cryptographically signed state changes that require network consensus, everything else clicks into place.
Want to experiment? Try building a Solana transfer tool yourself. You'll hit the same realizations I did, and that's where real learning happens.
Further reading:
Top comments (0)