Local Development

The bwick localnet command provides a complete local blockchain environment for development and testing.

Why Localnet?

BenefitDescription
Fast iterationNo waiting for testnet blocks
Free transactionsNo need for testnet tokens
Full controlReset state anytime
Offline developmentNo network required

What’s Included

When you start localnet, you get:
  • Full bwickchain node running locally
  • Pre-funded test accounts (alice, bob)
  • All APIs (RPC, REST, gRPC)
  • CosmWasm enabled for smart contracts

Architecture

┌─────────────────────────────────────────────────────────┐
│                    bwick localnet                         │
├─────────────────────────────────────────────────────────┤
│                                                         │
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐    │
│  │   bwickd    │  │  Consensus  │  │   P2P/Net   │    │
│  │   (app)     │◀─│  (BFT PoS)  │◀─│  (network)  │    │
│  └─────────────┘  └─────────────┘  └─────────────┘    │
│         │                                               │
│         ▼                                               │
│  ┌─────────────────────────────────────────────────┐   │
│  │                   APIs                           │   │
│  ├─────────────┬─────────────┬─────────────────────┤   │
│  │ RPC :26657  │ REST :1317  │ gRPC :9090          │   │
│  └─────────────┴─────────────┴─────────────────────┘   │
│                                                         │
└─────────────────────────────────────────────────────────┘

Quick Start

# Start localnet
bwick localnet start

# In another terminal, check it's running
bwick localnet status

# Use test accounts
bwick balance --key alice
bwick balance --key bob

# When done
bwick localnet stop

Endpoints

These are for a node you run locally. To connect to the live chain instead, use the public endpoints: https://rpc.bwick.fun and https://rest.bwick.fun.
ServiceURLPurpose
Chain RPChttp://localhost:26657Transactions, blocks, consensus
REST APIhttp://localhost:1317chain state queries
gRPClocalhost:9090Programmatic access

Test Accounts

Localnet comes with pre-funded accounts:
NameBalancePurpose
alice1,000,000 BWICKPrimary test account
bob500,000 BWICKSecondary test account
These accounts are automatically available in your keyring when localnet starts.

Data Directory

Localnet stores data in ~/.bwick-localnet/:
~/.bwick-localnet/
├── config/
│   ├── genesis.json    # Chain genesis
│   ├── config.toml     # Node configuration
│   └── app.toml        # App configuration
├── data/
│   └── ...             # Chain state
└── keyring-test/
    └── ...             # Test account keys

Reset State

To start fresh:
# Stop if running
bwick localnet stop

# Remove data
rm -rf ~/.bwick-localnet

# Start fresh
bwick localnet start

Development Workflow

1. Start Localnet

bwick localnet start

2. Deploy Contract

bwick program deploy artifacts/my_contract.wasm \
  --from alice \
  --label "Test Contract"

3. Interact

# Query
bwick program query bwick1contract... '{"get_count":{}}'

# Execute
bwick program execute bwick1contract... '{"increment":{}}' --from alice

4. Iterate

Make changes and redeploy:
bwick program build
bwick program deploy artifacts/my_contract.wasm --from alice --label "Test v2"

5. Reset When Needed

bwick localnet stop
rm -rf ~/.bwick-localnet
bwick localnet start

Troubleshooting

Another process is using port 26657, 1317, or 9090:
# Find and kill the process
lsof -i :26657
kill -9 <PID>

# Or stop any running localnet
bwick localnet stop
Try resetting:
bwick localnet stop
rm -rf ~/.bwick-localnet
bwick localnet start
Ensure localnet is running:
bwick localnet status
Test accounts are only available when localnet is active.

Next Steps