Skip to main content
The thru-cli abi command manages on-chain ABI accounts that store program interface definitions. ABIs describe the instructions, accounts, and data structures that a program exposes, enabling clients and tools to interact with programs in a type-safe way.
Transaction Fees: Currently all transaction fees are set to 0. Transaction fees will be implemented and charged in future releases.

Prerequisites

  • CLI setup with configured keys and RPC endpoint
  • An ABI definition file in YAML format
  • For official ABIs: a deployed managed program

ABI Account Types

Thru supports three types of on-chain ABI accounts, each suited to different use cases:

Official

Tied to a managed program. Only the program authority can create and update it. This is the standard choice for program authors publishing their own ABI.

Third-Party

Created by anyone for an existing program they do not control. Useful for community-contributed ABIs or when the program author has not published one.

Standalone

Not associated with any specific program. Useful for shared type libraries or reusable ABI definitions.

Command Overview

Create

Upload a new ABI definition to the blockchain. Choose the variant that matches your use case.

Official ABI

Create an ABI account linked to a managed program you control.
thru-cli abi create <SEED> <ABI_FILE> [OPTIONS]
SEED
string
required
Seed for the managed program meta account. Must match the seed used when creating the program.
ABI_FILE
string
required
Path to the ABI definition YAML file.
--ephemeral
boolean
Set if the managed program uses ephemeral accounts.
--authority
string
default:"default"
Authority account name from your configuration.
--fee-payer
string
default:"default"
Account to pay transaction fees.
Example:
thru-cli abi create my_program ./program.abi.yaml

Third-Party ABI

Create an ABI account for a program you do not own.
thru-cli abi create-third-party <TARGET_PROGRAM> <SEED> <ABI_FILE> [OPTIONS]
TARGET_PROGRAM
string
required
Public key (Thru address) of the target program.
SEED
string
required
32-byte hex seed for the third-party ABI meta account.
ABI_FILE
string
required
Path to the ABI definition YAML file.
--ephemeral
boolean
Ephemeral flag for the ABI account.
--authority
string
default:"default"
Authority account name from your configuration.
--fee-payer
string
default:"default"
Account to pay transaction fees.
Example:
thru-cli abi create-third-party \
  ta1234567890abcdef1234567890abcdef12345678 \
  0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef \
  ./program.abi.yaml

Standalone ABI

Create an ABI account not associated with any program.
thru-cli abi create-standalone <SEED> <ABI_FILE> [OPTIONS]
SEED
string
required
Seed string used to derive the standalone ABI meta seed.
ABI_FILE
string
required
Path to the ABI definition YAML file.
--ephemeral
boolean
Ephemeral flag for the ABI account.
--authority
string
default:"default"
Authority account name from your configuration.
--fee-payer
string
default:"default"
Account to pay transaction fees.
Example:
thru-cli abi create-standalone shared_types ./types.abi.yaml

Upgrade

Replace the ABI data on an existing account with a new YAML file. The account must not be finalized.

Official ABI

thru-cli abi upgrade <SEED> <ABI_FILE> [OPTIONS]
SEED
string
required
Seed for the managed program meta account.
ABI_FILE
string
required
Path to the updated ABI definition YAML file.
--ephemeral
boolean
Set if the managed program uses ephemeral accounts.
--authority
string
default:"default"
Authority account name from your configuration.
--fee-payer
string
default:"default"
Account to pay transaction fees.
Example:
thru-cli abi upgrade my_program ./program_v2.abi.yaml

Third-Party ABI

thru-cli abi upgrade-third-party <TARGET_PROGRAM> <SEED> <ABI_FILE> [OPTIONS]
Example:
thru-cli abi upgrade-third-party \
  ta1234567890abcdef1234567890abcdef12345678 \
  0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef \
  ./program_v2.abi.yaml

Standalone ABI

thru-cli abi upgrade-standalone <SEED> <ABI_FILE> [OPTIONS]
Example:
thru-cli abi upgrade-standalone shared_types ./types_v2.abi.yaml
Finalized ABI accounts cannot be upgraded. Attempting to upgrade a finalized account will fail.

Finalize

Make an ABI account permanently immutable. Once finalized, the ABI data can never be changed or deleted.

Official ABI

thru-cli abi finalize <SEED> [OPTIONS]
SEED
string
required
Seed for the managed program meta account.
--ephemeral
boolean
Set if the managed program uses ephemeral accounts.
--authority
string
default:"default"
Authority account name from your configuration.
--fee-payer
string
default:"default"
Account to pay transaction fees.
Example:
thru-cli abi finalize my_program

Third-Party ABI

thru-cli abi finalize-third-party <TARGET_PROGRAM> <SEED> [OPTIONS]

Standalone ABI

thru-cli abi finalize-standalone <SEED> [OPTIONS]
Finalization is irreversible. Once finalized, the ABI account cannot be upgraded or closed. Only finalize when you are certain the ABI is correct and complete.

Close

Close an ABI account and reclaim its balance. The account must not be finalized.

Official ABI

thru-cli abi close <SEED> [OPTIONS]
SEED
string
required
Seed for the managed program meta account.
--ephemeral
boolean
Set if the managed program uses ephemeral accounts.
--authority
string
default:"default"
Authority account name from your configuration.
--fee-payer
string
default:"default"
Account to pay transaction fees.
Example:
thru-cli abi close my_program

Third-Party ABI

thru-cli abi close-third-party <TARGET_PROGRAM> <SEED> [OPTIONS]

Standalone ABI

thru-cli abi close-standalone <SEED> [OPTIONS]
Finalized ABI accounts cannot be closed. Only non-finalized accounts can be removed.

Get

Inspect an ABI account’s metadata and optionally export the ABI YAML contents to the terminal or a file.
thru-cli abi get <ABI_ACCOUNT> [OPTIONS]
ABI_ACCOUNT
string
required
Public key (Thru address) of the ABI account to inspect.
--data
string
default:"N"
Whether to include the ABI YAML contents in the output. Set to Y to display, N to show only metadata.
--out
string
File path to write the ABI YAML contents to. Useful for downloading an on-chain ABI for local use.
Example:
thru-cli abi get ta1234567890abcdef1234567890abcdef12345678

Common Workflows

Deploy a Program with ABI

1

Deploy your program

thru-cli program create my_program ./build/program.so
2

Upload the ABI

thru-cli abi create my_program ./program.abi.yaml
3

Verify the ABI

thru-cli abi get --data Y ta_abi_account_address
4

(Optional) Finalize once stable

thru-cli abi finalize my_program

Upgrade a Program and ABI

1

Upload the new program binary

thru-cli program upgrade my_program ./build/program_v2.so
2

Upgrade the ABI

thru-cli abi upgrade my_program ./program_v2.abi.yaml
3

Verify the updated ABI

thru-cli abi get --data Y ta_abi_account_address

Contribute a Third-Party ABI

1

Write the ABI YAML for the target program

Create a YAML file describing the program’s instructions and account structures.
2

Upload the third-party ABI

thru-cli abi create-third-party \
  ta_target_program_address \
  0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef \
  ./community_abi.yaml
3

Share the ABI account address

Others can inspect and download your ABI using:
thru-cli abi get --data Y --out ./program.abi.yaml ta_abi_account_address