Create Token
Deploy a new CW20 token on bwickchain with the bwick token create command.
Setup
Before creating tokens, ensure the CW20 base contract is deployed.
Deploy CW20 Base Contract
# Run the deployment script
./scripts/deploy-cw20.sh
Downloading CW20 base contract v2.0.0...
Deploying to bwick-1...
Transaction hash: ABC123...
Code ID: 1
Success! Configure bwick CLI:
bwick config set cw20-code-id 1
bwick config set cw20-code-id 1
Verify:
bwick config get cw20-code-id
# 1
Create a Token
bwick token create \
--name "My Token" \
--symbol "MTK" \
--decimals 6 \
--initial-supply 1000000000000 \
--from mykey
Required Flags
| Flag | Description | Example |
|---|
--name | Token name | ”My Token” |
--symbol | Trading symbol (3-12 chars) | “MTK” |
--decimals | Decimal places (0-18) | 6 |
--from | Signing key | mykey |
Optional Flags
| Flag | Description | Default |
|---|
--initial-supply | Starting supply | 0 |
--minter | Minter address | Creator |
--cap | Maximum supply | Unlimited |
--dry-run | Simulate only | false |
Examples
Basic Token
bwick token create \
--name "My Token" \
--symbol "MTK" \
--decimals 6 \
--from mykey
Creates a token with no initial supply. You’ll need to mint tokens afterward.
Token with Initial Supply
bwick token create \
--name "Reward Token" \
--symbol "RWRD" \
--decimals 6 \
--initial-supply 1000000000000 \
--from mykey
Creates 1,000,000 tokens (with 6 decimals) sent to the creator.
Fixed Supply Token
bwick token create \
--name "Fixed Token" \
--symbol "FIX" \
--decimals 6 \
--initial-supply 1000000000000 \
--cap 1000000000000 \
--from mykey
Creates a token with fixed 1M supply (cap equals initial supply).
Token with Different Minter
bwick token create \
--name "DAO Token" \
--symbol "DAO" \
--decimals 6 \
--minter bwick1daocontract... \
--from mykey
Sets a DAO contract as the minter instead of the creator.
Dry Run
Simulate token creation without broadcasting:
bwick token create \
--name "Test Token" \
--symbol "TEST" \
--decimals 6 \
--from mykey \
--dry-run
Output:
Dry run mode - transaction not broadcast
Estimated gas: 250,000
Estimated fee: 2,500 ubwick
Token Details:
Name: Test Token
Symbol: TEST
Decimals: 6
Initial Supply: 0
Minter: bwick1youraddress...
Output
Successful creation returns:
Token Created Successfully!
Contract: bwick1tokencontract123...
Name: My Token
Symbol: MTK
Decimals: 6
TxHash: ABC123DEF456...
Gas Used: 234567
Block: 12345
Save the contract address! You’ll need it for all future operations (mint, transfer, etc.).
Track Your Token
Add the token to your configuration for balance queries:
# Add to tracked tokens
bwick config set cw20-tokens bwick1tokencontract123...
# Now balance queries include this token
bwick balance --all --key mykey
Decimals Guide
The decimals field determines the smallest unit:
| Decimals | 1 Token = | Use Case |
|---|
| 0 | 1 | NFT-like, indivisible |
| 6 | 1,000,000 | Standard (like ubwick) |
| 8 | 100,000,000 | Bitcoin-style |
| 18 | 10^18 | Ethereum-style |
Use 6 decimals to match the native ubwick denomination.
Error Handling
The CLI provides user-friendly error messages:
| Error | Meaning | Solution |
|---|
| ”cw20-code-id not configured” | Missing code ID | Run bwick config set cw20-code-id 1 |
| ”insufficient funds” | Not enough ubwick | Fund your account |
| ”invalid symbol” | Symbol too long/short | Use 3-12 characters |
Under the Hood
bwick token create executes a MsgInstantiateContract:
{
"code_id": 1,
"label": "MTK Token",
"msg": {
"name": "My Token",
"symbol": "MTK",
"decimals": 6,
"initial_balances": [
{
"address": "bwick1creator...",
"amount": "1000000000000"
}
],
"mint": {
"minter": "bwick1creator...",
"cap": null
}
},
"funds": []
}
Next Steps
Mint Tokens
Create additional supply
Transfer Tokens
Send tokens to others