Sei Giga Developer Guide
This is a sneak peek at the patterns and optimizations developers should consider when building on Sei Giga. For current EVM development tutorials, check out the EVM development guides.
Why Build on Sei Giga?
- Familiar Tools: Full EVM compatibility—use existing Ethereum tooling
- Parallel Execution: Transactions touching different state run simultaneously
- Lower Costs: Efficient architecture means cheaper transactions
- Native Precompiles: Access to staking, and more from Solidity
Key Development Patterns
Pattern 1: User-Isolated State
Sei Giga’s parallel execution engine rewards contracts with isolated state. When users’ operations don’t touch shared state, they execute simultaneously.
// GOOD: Each user has isolated state - transfers can run in parallel
contract OptimizedToken {
mapping(address => uint256) private balances;
function transfer(address to, uint256 amount) public {
require(balances[msg.sender] >= amount);
balances[msg.sender] -= amount;
balances[to] += amount;
}
}
// BAD: Global counter forces sequential execution
contract PoorToken {
uint256 public totalTransfers; // Every transfer conflicts!
function transfer(address to, uint256 amount) public {
totalTransfers++; // Blocks parallelism
// ... transfer logic
}
}Pattern 2: Struct Packing
Pack struct variables to minimize storage slots and reduce gas costs.
contract OptimizedStorage {
// GOOD: Uses 1 storage slot (256 bits total)
struct User {
uint128 balance; // 128 bits
uint64 lastUpdate; // 64 bits
uint64 nonce; // 64 bits
}
// BAD: Uses 3 storage slots
struct InefficientUser {
uint256 balance; // 256 bits = 1 slot
uint64 lastUpdate; // 64 bits = 1 slot (wastes 192 bits)
uint64 nonce; // 64 bits = 1 slot (wastes 192 bits)
}
}Pattern 3: Event-Driven Architecture
Store historical data in events instead of storage to reduce costs.
contract EventDrivenAuction {
mapping(uint256 => uint128) public highestBids;
// Bid history stored in events, not storage
event BidPlaced(uint256 indexed auctionId, address indexed bidder, uint256 amount);
function bid(uint256 auctionId) external payable {
require(msg.value > highestBids[auctionId], "Bid too low");
highestBids[auctionId] = uint128(msg.value);
emit BidPlaced(auctionId, msg.sender, msg.value); // Cheap!
}
}Gas Optimization Tips
Quick Wins:
- Use
memoryfor temporary data,calldatafor read-only parameters - Cache array lengths in loops:
uint256 len = arr.length; - Use
unchecked { i++; }in loops where overflow is impossible - Batch operations to amortize base transaction costs
Native Precompiles
Sei Giga will also provide precompiles for direct access to chain features from Solidity.
See the Precompiles documentation for full details.
Development Checklists
Parallel Execution Checklist
- Isolate state by user/entity
- Avoid global counters and shared state
- Use mappings over arrays for lookups
Gas Optimization Checklist
- Pack structs to minimize storage slots
- Use events for historical data
- Cache array lengths in loops
- Batch operations when possible
Next Steps
- Full Tutorials - Start with the EVM development guides
- Architecture Details - Review the Sei Giga Overview
- Precompiles - Explore native precompiles for advanced features
Last updated on