Local Development
Thexyz localnet command provides a complete local blockchain environment for development and testing.
Why Localnet?
| Benefit | Description |
|---|---|
| Fast iteration | No waiting for testnet blocks |
| Free transactions | No need for testnet tokens |
| Full control | Reset state anytime |
| Offline development | No network required |
What’s Included
When you start localnet, you get:- Full XYZ Chain node running locally
- Pre-funded test accounts (alice, bob)
- All APIs (RPC, REST, gRPC)
- WASM contracts enabled for smart contracts
Architecture
Quick Start
Endpoints
| Service | URL | Purpose |
|---|---|---|
| RPC | http://localhost:26657 | Transactions, blocks, consensus |
| REST API | http://localhost:1317 | Chain state queries |
| gRPC | localhost:9090 | Programmatic access |
Test Accounts
Localnet comes with pre-funded accounts:| Name | Balance | Purpose |
|---|---|---|
alice | 1,000,000 XYZ | Primary test account |
bob | 500,000 XYZ | Secondary test account |
Data Directory
Localnet stores data in~/.xyz-localnet/:
Reset State
To start fresh:Development Workflow
1. Start Localnet
2. Deploy Contract
3. Interact
4. Iterate
Make changes and redeploy:5. Reset When Needed
Troubleshooting
Port already in use
Port already in use
Another process is using port 26657, 1317, or 9090:
Localnet won't start
Localnet won't start
Try resetting:
Test accounts not found
Test accounts not found
Ensure localnet is running:Test accounts are only available when localnet is active.