@greymass/antelope-cli
v0.0.2
Published
Command line utilities for Wharf
Downloads
210
Readme
@greymass/antelope-cli
The @greymass/antelope-cli command line tool.
⚠️ Warning: This project is a work in progress. Use at your own risk.
Installation
This command line tool currently requires the use of nodejs version 18 or above (due to its usage of built-in fetch).
It can be run using npx:
npx @greymass/antelope-cli helpor installed globally and run as antelope-cli:
npm install -g @greymass/antelope-cli
antelope-cli helpUsage
Once installed, simply run antelope-cli to see a list of available commands.
Usage: antelope-cli [options] [command]
Wharf Command Line Utilities
Options:
-V, --version output the version number
-h, --help display help for command
Commands:
keys Generate a new set of public and private keys
generate [options] <account> Generate Contract Kit code for the named smart contract
chain Manage local LEAP blockchain
compile [options] [file] Compile C++ contract files
deploy [options] [wasm] Deploy a compiled contract to the blockchain
dev [options] Start local chain and watch for changes
wallet Manage wallet, accounts, and sign transactions
help [command] display help for commandCreating Accounts
Create new accounts on the local blockchain (requires local chain to be running).
Create Account with Auto-generated Name
antelope-cli wallet account createThis will:
- Generate a random 12-character account name
- Generate a new key pair for the account
- Create the account on the blockchain using the dev keys
- Allocate RAM (8192 bytes) and stake CPU/NET (1.0000 SYS each)
- Automatically store the private key in your wallet with the account name
Create Account with Custom Name
antelope-cli wallet account create --name mycontractCreate Account on Remote Chain
antelope-cli wallet account create --url https://jungle4.greymass.com --name myaccountNote: The account creation command uses Wharf Session Kit and automatically stores the generated key in your wallet with the account name. This makes it seamless to deploy contracts later - just use antelope-cli deploy --account mycontract and it will automatically find and use the right key!
Managing Wallet Keys
The CLI includes a secure wallet system for managing private keys, creating accounts, and signing transactions locally.
The wallet command is your central hub for all key and account management.
Creating Keys
Create a new wallet key with default encryption:
antelope-cli wallet createCreate a key with a custom name and password:
antelope-cli wallet create --name mykey --passwordWhen the --password flag is used, you'll be prompted to enter and confirm a password. Otherwise, keys are encrypted with a default password (not stored in plain text).
Listing Keys
View all keys in your wallet:
antelope-cli wallet keysOutput example:
Found 2 key(s) in wallet:
1. default
Public Key: PUB_K1_5TXDWwucfSa9Ghh49di3vxthzUcLSDE5yuxEMCJvw29Jpjq4mp
Created: 11/10/2025, 10:25:34 PM
2. mykey
Public Key: PUB_K1_8KL3xG2WPZQAVd1ze2eY3Fgzr9DWF9hDhjusYgPegfHeNQDeF1
Created: 11/10/2025, 10:25:47 PMCreating Additional Keys
Create additional keys in your wallet:
# With auto-generated name
antelope-cli wallet keys create
# With custom name
antelope-cli wallet keys create --name production
# With custom password
antelope-cli wallet keys create --name production --passwordSigning Transactions
Sign a transaction using a key from your wallet:
# Sign with default key (uses 'default' key or first available)
antelope-cli wallet transact transaction.json
# Sign with specific key
antelope-cli wallet transact transaction.json --key mykey
# Sign with password-protected key
antelope-cli wallet transact transaction.json --key production --password
# Save signed transaction to file
antelope-cli wallet transact transaction.json --output signed.json
# Sign and broadcast to a local node
antelope-cli wallet transact transaction.json --broadcast --url http://127.0.0.1:8888The transaction can be provided as:
- A path to a JSON file containing the transaction
- A JSON string directly on the command line
Example transaction format:
{
"expiration": "2025-11-11T00:00:00",
"ref_block_num": 12345,
"ref_block_prefix": 67890,
"max_net_usage_words": 0,
"max_cpu_usage_ms": 0,
"delay_sec": 0,
"context_free_actions": [],
"actions": [
{
"account": "eosio.token",
"name": "transfer",
"authorization": [
{
"actor": "testaccount",
"permission": "active"
}
],
"data": "..."
}
],
"transaction_extensions": []
}Security Notes
- All keys are stored encrypted in
~/.wharfkit/wallet/keys.json - Keys are never stored in plain text
- If no password is provided, a default encryption password is used
- For production use, always use custom passwords with the
--passwordflag - The wallet file has restrictive permissions (0600) to prevent unauthorized access
Generating Contract Code
The cli tool is capable of generating Typescript code based on a deployed smart contract for use in your application.
npx @greymass/antelope-cli generate [options] <account>To generate the code for the eosio.token contract on the Jungle 4 testnet:
npx @greymass/antelope-cli generate -u https://jungle4.greymass.com eosio.tokenThis will output the code directly into the console window similar to this example code.
If you'd prefer to save this as a file, use the -f flag followed by a filename:
npx @greymass/antelope-cli generate -u https://jungle4.greymass.com eosio.token -f tokencontract.tsTo see a full list of options for the generate command, run the help command against it:
npx @greymass/antelope-cli help generateCompiling Smart Contracts
The CLI includes a compile command to compile C++ contract files to WASM format using the CDT (Contract Development Toolkit) that comes with LEAP.
Prerequisites
The compile command requires LEAP to be installed (which includes the CDT compiler). You can install it automatically by running:
antelope-cli chain local startUsage
Compile a single file:
antelope-cli compile mycontract.cppCompile all .cpp files in the current directory:
antelope-cli compileSpecify output directory:
antelope-cli compile mycontract.cpp -o ./buildOutput
By default, compiled WASM files are output to the current directory. You can specify a different output directory using the -o or --output flag.
For example:
antelope-cli compile -o ./buildThis will compile all .cpp files in the current directory and save the resulting .wasm files to the ./build directory.
Options
-o, --output <directory> Output directory for compiled WASM files (default: ".")
-h, --help display help for commandDeploying Contracts
Deploy compiled smart contracts to a blockchain.
Deploy a Specific WASM File
antelope-cli deploy mycontract.wasmThe command will automatically look for the corresponding .abi file alongside the WASM file.
Deploy with Custom Account Name
antelope-cli deploy mycontract.wasm --account myaccountDeploy to a Specific Blockchain
# Deploy to local chain (default)
antelope-cli deploy mycontract.wasm
# Deploy to a remote chain
antelope-cli deploy mycontract.wasm --url https://jungle4.greymass.comAuto-detect WASM File
If you have only one .wasm file in your current directory, you can omit the filename:
antelope-cli deployDeploy Options
-a, --account <name> Contract account name (default: derived from filename)
-u, --url <url> Blockchain API URL (default: http://127.0.0.1:8888)
-h, --help display help for commandNote: Deploy uses Wharf Session Kit with your wallet keys. The deployment key is automatically selected:
- First, tries to find a wallet key with the same name as the account
- Falls back to the 'default' key if available
- Uses the first available key as a last resort
To ensure smooth deployment, create an account first with antelope-cli wallet account create, which automatically stores the key in your wallet.
Development Mode
The dev command provides a complete development workflow: it starts a local blockchain and automatically compiles and deploys your contract whenever you make changes to your C++ files.
Start Development Mode
antelope-cli devThis will:
- ✅ Start a local LEAP blockchain (if not already running)
- ✅ Compile all
.cppfiles in the current directory - ✅ Deploy the compiled contract using Wharf Session Kit
- ✅ Watch for changes to
.cpp,.hpp, and.hfiles - ✅ Automatically recompile and redeploy on changes
Development Mode with Options
# Start with a clean blockchain state
antelope-cli dev --clean
# Specify contract account name
antelope-cli dev --account mycontract
# Use a custom port
antelope-cli dev --port 9000
# Combine options
antelope-cli dev --clean --account mycontract --port 9000Dev Mode Options
-a, --account <name> Contract account name (default: derived from filename)
-p, --port <port> Port for local blockchain (default: 8888)
-c, --clean Start with a clean blockchain state
-h, --help display help for commandDevelopment Workflow
The typical development workflow is:
Navigate to your contract directory:
cd my-contractStart development mode:
antelope-cli devEdit your contract files (
.cpp,.hpp)- The contract will automatically recompile and redeploy
- Watch the console for compilation and deployment status
Test your contract using WharfKit sessions or your preferred tools
Stop development mode with
Ctrl+C
Note: Development mode is designed for rapid iteration during development. For production deployments, use antelope-cli compile followed by antelope-cli deploy with appropriate production settings.
Managing a Local Blockchain
The CLI includes tools to quickly set up and manage a local LEAP blockchain for development and testing.
Quick Start
Start a local blockchain with one command (automatically installs LEAP if needed):
antelope-cli chain local startThis will:
- ✅ Automatically detect and install LEAP (nodeos) if not present
- ✅ Create necessary configuration and data directories
- ✅ Start nodeos with sensible defaults for development
- ✅ Set up a dev wallet with pre-configured keys
- ✅ Begin producing blocks immediately
Available Commands
Start the local chain:
# Basic start
antelope-cli chain local start
# Start with clean state (reset blockchain data)
antelope-cli chain local start --clean
# Start on a custom port (default: 8888)
antelope-cli chain local start --port 9000Check chain status:
antelope-cli chain local statusShows:
- Running status and PID
- Chain URL and data directory
- Current head block number
View chain logs:
# Show last 50 log lines (includes block production)
antelope-cli chain local logs
# Follow logs in real-time
antelope-cli chain local logs --follow
# Show only errors and warnings
antelope-cli chain local logs --errors
# Follow only errors and warnings
antelope-cli chain local logs --follow --errorsStop the chain:
antelope-cli chain local stopCheck LEAP installation:
antelope-cli chain checkShows which LEAP binaries are installed and their versions.
Development Keys
The local chain comes with pre-configured development keys:
Public Key: EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV
Private Key: 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3These are automatically imported into the dev wallet.
Configuration
- Chain URL:
http://127.0.0.1:8888(or custom port) - Data Directory:
~/.wharfkit/chain - Config Directory:
~/.wharfkit/config - Wallet Directory:
~/.wharfkit/wallet
Troubleshooting
If the chain fails to start:
- Check logs:
antelope-cli chain local logs --errors - Clean state:
antelope-cli chain local start --clean - Verify LEAP:
antelope-cli chain check
Made with ☕️ & ❤️ by Greymass.
