Skip to main content
Generate ABI (Application Binary Interface) from an Aleo bytecode file. This command reads a .aleo file and produces a JSON representation of the program’s interface.

Usage

leo abi <FILE> [OPTIONS]

Arguments

FILE
string
required
Path to the .aleo bytecode file

Options

--network
string
default:"testnet"
Network for parsing. Valid values:
  • mainnet - Mainnet network
  • testnet - Testnet network (default)
  • canary - Canary network
--output
string
Output file path. If not specified, prints to stdout.

Examples

Generate ABI to stdout

leo abi program.aleo

Generate ABI to file

leo abi program.aleo --output program_abi.json

Generate ABI for mainnet

leo abi program.aleo --network mainnet --output program_abi.json

Output Format

The generated ABI is a JSON file describing the program’s interface:
{
  "program": "program_name.aleo",
  "functions": [
    {
      "name": "function_name",
      "inputs": [...],
      "outputs": [...]
    }
  ],
  "structs": [...],
  "records": [...],
  "mappings": [...]
}

Use Cases

  • Documentation - Generate API documentation for your program
  • Integration - Provide ABI to frontend applications for integration
  • Tooling - Build tools that interact with Leo programs
  • Analysis - Analyze program interfaces and dependencies
  • Build - Compile Leo programs to bytecode
  • Deploy - Deploy programs to network

Troubleshooting

File not found

Ensure the .aleo file path is correct and the file exists:
ls -la program.aleo

Invalid .aleo file

The file must be valid Aleo bytecode. If you have a Leo source file, compile it first:
leo build
leo abi build/main.aleo