Overview
This guide walks you through creating and executing your first transaction on Sui, from setting up your wallet to transferring SUI tokens.Make sure you’ve installed Sui and configured your client before proceeding.
Prerequisites
Get Test Tokens
Before you can send transactions, you need SUI tokens to pay for gas.- Using CLI
- Using Web Faucet
- Using Discord
Devnet and testnet faucets provide test tokens with no real value. For mainnet, you’ll need to acquire actual SUI.
Transaction Types
Sui supports several transaction types. Let’s start with the most common:1. Transfer SUI Tokens
Transfer SUI from your address to another:Switch Back to Your Main Address
Execute Transfer
--to: Recipient address--sui-coin-object-id: Your SUI coin object (get fromsui client gas)--gas-budget: Maximum gas in MIST (10000000 = 0.01 SUI)--amount: Amount to send in MIST (100000000 = 0.1 SUI)
2. Transfer Objects
Transfer non-SUI objects (like NFTs):This transfers ownership of any object (NFT, game item, etc.) to the recipient.
3. Merge Coins
Combine multiple coin objects into one:4. Split Coins
Split a coin into multiple coins:Understanding Transaction Structure
Every Sui transaction contains:Transaction Data
Transaction Data
- Sender: Address initiating the transaction
- Gas Payment: Coin object used to pay gas
- Gas Budget: Maximum gas willing to pay
- Gas Price: Price per gas unit (typically reference gas price)
- Commands: One or more programmable transaction commands
- Expiration: Optional expiration epoch
Transaction Commands
Transaction Commands
Programmable Transaction Block (PTB) commands:
TransferObjects: Transfer objects to addressesSplitCoins: Split coins into smaller denominationsMergeCoins: Merge coins togetherMoveCall: Call a Move functionPublish: Publish a Move packageMakeMoveVec: Create a vector
Transaction Effects
Transaction Effects
Results after execution:
- Status: Success or failure
- Gas Used: Actual gas consumed
- Created Objects: New objects created
- Mutated Objects: Objects modified
- Deleted Objects: Objects deleted
- Events: Events emitted
Using Programmable Transaction Blocks
PTBs allow you to compose multiple operations atomically:- Splits the gas coin into two coins (0.1 SUI and 0.2 SUI)
- Transfers 0.1 SUI to recipient1
- Transfers 0.2 SUI to recipient2
All operations succeed or fail together - atomic execution guaranteed.
Inspecting Transactions
View Transaction Details
Query Recent Transactions
Check Gas Usage
Transaction Best Practices
Set Appropriate Gas Budget
- Start with 10000000 MIST (0.01 SUI)
- Increase for complex transactions
- Unused gas is refunded
Check Object Versions
- Objects have version numbers
- Using old version fails
- Always use latest version
Handle Errors Gracefully
- Check transaction status
- Retry with higher gas if needed
- Validate addresses before sending
Use PTBs for Efficiency
- Combine operations
- Save on gas costs
- Ensure atomicity
Transaction Lifecycle
Common Issues
InsufficientGas error
InsufficientGas error
Cause: Gas budget too low for transaction complexity.Solution: Increase
--gas-budget:Invalid object version
Invalid object version
Cause: Using outdated object version (concurrent update).Solution:
- Query latest object:
sui client object 0xobj... - Use the current version in your transaction
- Retry transaction
Insufficient balance
Insufficient balance
Cause: Not enough SUI for transfer + gas.Solution:
- Check balance:
sui client balance - Request more from faucet
- Reduce transfer amount
Invalid address format
Invalid address format
Cause: Malformed recipient address.Solution:
- Verify address starts with
0x - Check address is 64 hex characters (after 0x)
- Use
sui client addressesto list valid addresses
Using SDKs
TypeScript SDK
Rust SDK
Next Steps
Quickstart Guide
Build and deploy your first Move package
Programmable Transactions
Master complex transaction composition
TypeScript SDK
Build applications with TypeScript
Transaction Concepts
Deep dive into transaction mechanics
Summary
You’ve successfully:- ✅ Obtained test SUI tokens from the faucet
- ✅ Created and executed your first transaction
- ✅ Transferred SUI between addresses
- ✅ Inspected transaction results
- ✅ Learned about transaction structure and PTBs