Test Accounts

Localnet provides pre-funded test accounts for immediate use.

Available Accounts

NameAddressInitial Balance
alicebwick1alice…1,000,000 BWICK (1,000,000,000,000 ubwick)
bobbwick1bob…500,000 BWICK (500,000,000,000 ubwick)
These accounts are automatically available when localnet is running.

Using Test Accounts

Check Balance

bwick balance --key alice
Output:
Balances for alice (bwick1alice...)

DENOM    AMOUNT
ubwick     1,000,000,000,000  (1,000,000 BWICK)

Send Tokens

# Alice sends to Bob
bwick tx send bwick1bob... 100000ubwick --from alice

Deploy Contracts

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

Execute Contracts

bwick program execute bwick1contract... '{"increment":{}}' --from bob

Account Details

Alice

Primary test account, typically used for deployments.
# View full account info
bwick keys show alice

# Get address
bwick keys show alice --address

Bob

Secondary test account, useful for testing transfers.
bwick keys show bob

Mnemonics

Test accounts use deterministic mnemonics for reproducibility. Query the actual mnemonics from your localnet keyring:
These mnemonics are public and for testing only. NEVER use them for real funds.
# Export a test account mnemonic
bwick keys export alice --unsafe --unarmored-hex

Creating Additional Accounts

Generate New Account

bwick keys generate dev-test

Fund from Alice

bwick tx send $(bwick keys show dev-test --address) 100000ubwick --from alice

Import Existing

bwick keys import my-test --mnemonic "your twelve word mnemonic phrase here"

Multi-Account Workflows

Token Transfer

# Alice → Bob
bwick tx send $(bwick keys show bob --address) 50000ubwick --from alice

Contract Ownership Transfer

# Alice deploys
CONTRACT=$(bwick program deploy artifacts/my_contract.wasm --from alice --label "Shared Contract" | grep "Contract:" | awk '{print $2}')

# Bob executes
bwick program execute $CONTRACT '{"increment":{}}' --from bob

# Query result
bwick program query $CONTRACT '{"get_count":{}}'

Checking Balances

Single Account

bwick balance --key alice

All Test Accounts

for key in alice bob; do
  echo "=== $key ==="
  bwick balance --key $key
done

JSON Output

bwick balance --key alice --output json
{
  "address": "bwick1alice...",
  "balances": [
    {"denom": "ubwick", "amount": "1000000000000"}
  ]
}

Reset Account Balances

To restore accounts to initial state:
# Reset entire localnet
bwick localnet stop --clean
bwick localnet start
Accounts return to their initial balances (alice: 1,000,000 BWICK, bob: 500,000 BWICK).

Scripting with Test Accounts

Bash Script

#!/bin/bash

# Deploy and test with multiple accounts
CONTRACT=$(bwick program deploy artifacts/counter.wasm \
  --from alice \
  --label "Counter" \
  --msg '{"count":0}' | grep "Contract:" | awk '{print $2}')

echo "Contract: $CONTRACT"

# Alice increments
bwick program execute $CONTRACT '{"increment":{}}' --from alice

# Bob increments
bwick program execute $CONTRACT '{"increment":{}}' --from bob

# Check count
bwick program query $CONTRACT '{"get_count":{}}'
# Expected: {"count": 2}

Test Script

#!/bin/bash
set -e

echo "Testing token transfer..."

# Get initial balances
ALICE_BEFORE=$(bwick balance --key alice --output json | jq -r '.balances[0].amount')
BOB_BEFORE=$(bwick balance --key bob --output json | jq -r '.balances[0].amount')

# Transfer
bwick tx send $(bwick keys show bob --address) 1000ubwick --from alice

# Get final balances
ALICE_AFTER=$(bwick balance --key alice --output json | jq -r '.balances[0].amount')
BOB_AFTER=$(bwick balance --key bob --output json | jq -r '.balances[0].amount')

# Verify
if [ "$BOB_AFTER" -gt "$BOB_BEFORE" ]; then
  echo "✓ Transfer successful"
else
  echo "✗ Transfer failed"
  exit 1
fi

Troubleshooting

Test accounts are only available when localnet is running:
bwick localnet status
bwick localnet start  # if not running
Account may have spent its balance. Reset localnet:
bwick localnet stop --clean
bwick localnet start
Localnet uses the test keyring backend:
bwick keys list --keyring-backend test

Best Practices

  1. Use alice for deployments - Keep bob for testing interactions
  2. Reset often - Start fresh to avoid state confusion
  3. Script everything - Make tests reproducible
  4. Check balances - Verify before complex operations
  5. Use JSON output - Easier parsing in scripts