|
| 1 | +# Solana Transaction Flow: High Level E2E flow of transactions through the Solana network |
| 2 | + |
| 3 | +Let's walk through the process of sending 1 SOL to your friend on the Solana network. |
| 4 | + |
| 5 | +## 1. Creating the Transaction |
| 6 | + |
| 7 | +You open your Solana wallet app and enter: |
| 8 | +* Recipient: Your friend's wallet address |
| 9 | +* Amount: 1 SOL |
| 10 | + |
| 11 | +The app creates a transaction that includes: |
| 12 | +* Instruction: "Transfer 1 SOL from my address to my friend's address" |
| 13 | +* A recent blockhash: Like a timestamp to ensure the transaction is fresh |
| 14 | +* Your signature: To prove it's really you making the transaction |
| 15 | + |
| 16 | +```json |
| 17 | +Transaction { |
| 18 | + instruction: "Transfer 1 SOL from ABC123... to XYZ789...", |
| 19 | + blockhash: "Recent123...", |
| 20 | + signature: "YourSignature456..." |
| 21 | +} |
| 22 | +``` |
| 23 | + |
| 24 | +## 2. Sending the Transaction |
| 25 | + |
| 26 | +Your wallet app sends this transaction to a Solana node (think of it as a computer in the Solana network). |
| 27 | + |
| 28 | +The node checks: |
| 29 | +1. Is the signature valid? |
| 30 | +2. Is the blockhash recent? |
| 31 | +3. Do you have enough SOL? |
| 32 | + |
| 33 | +If all checks pass, the node shares this transaction with other nodes. |
| 34 | + |
| 35 | +## 3. Leader Selection |
| 36 | + |
| 37 | +Solana has a schedule of which node (called a validator) will be the leader at each moment. |
| 38 | + |
| 39 | +Let's say Validator Bob is the current leader. All nodes send your transaction to Bob. |
| 40 | + |
| 41 | +## 4. Processing the Transaction |
| 42 | + |
| 43 | +Bob receives your transaction and many others. He: |
| 44 | +1. Bundles these transactions into a block |
| 45 | +2. Processes each transaction in the block |
| 46 | + |
| 47 | +For your transaction, Bob's computer: |
| 48 | +* Subtracts 1 SOL from your account |
| 49 | +* Adds 1 SOL to your friend's account |
| 50 | + |
| 51 | +## 5. Proof of History and Consensus |
| 52 | + |
| 53 | +As Bob processes transactions, he's also running a special clock called Proof of History (PoH). |
| 54 | +It's like a super-fast stopwatch that puts a timestamp on every action. |
| 55 | + |
| 56 | +Bob sends out the processed block with all its transactions and PoH timestamps. |
| 57 | + |
| 58 | +Other validators check Bob's work: |
| 59 | +* Did he process all transactions correctly? |
| 60 | +* Do the PoH timestamps make sense? |
| 61 | + |
| 62 | +If most validators agree Bob did a good job, your transaction is confirmed. |
| 63 | + |
| 64 | +## 6. Confirmation |
| 65 | + |
| 66 | +Your wallet app checks with the network and sees that your transaction is confirmed. |
| 67 | +It shows you a message: "1 SOL sent successfully to your friend!" |
| 68 | + |
| 69 | +Your friend's wallet balance increases by 1 SOL. |
| 70 | + |
| 71 | +## Diagram |
| 72 | + |
| 73 | +```mermaid |
| 74 | +graph TD |
| 75 | + A[User Wallet] -->|1. Create & Sign Transaction| B(Solana Node) |
| 76 | + B -->|2. Validate & Propagate| C{Gossip Network} |
| 77 | + C -->|3. Reach Leader| D[Current Leader] |
| 78 | + D -->|4. Bundle & Process| E[Create Block] |
| 79 | + E -->|5. Apply PoH| F[Proof of History] |
| 80 | + F -->|6. Broadcast| G[Validator Network] |
| 81 | + G -->|7. Verify & Vote| H{Consensus} |
| 82 | + H -->|8. Confirm| I[User Wallet] |
| 83 | + style A fill:#f9f,stroke:#333,stroke-width:2px |
| 84 | + style I fill:#f9f,stroke:#333,stroke-width:2px |
| 85 | + style D fill:#bbf,stroke:#333,stroke-width:2px |
| 86 | + style F fill:#bfb,stroke:#333,stroke-width:2px |
| 87 | +``` |
| 88 | + |
| 89 | +## Key Points: |
| 90 | + |
| 91 | +1. Your transaction is bundled with others for efficiency. |
| 92 | +2. One leader (validator) processes transactions at a time. |
| 93 | +3. Other validators check the leader's work. |
| 94 | +4. The unique PoH "clock" helps keep everything in order. |
| 95 | +5. This process happens very fast - usually in less than a second! |
| 96 | + |
0 commit comments