NO_DNA

Reference documentation for Anchor's NO_DNA support

Anchor supports the NO_DNA convention for non-human CLI usage. See no-dna.org. Set NO_DNA to a non-empty value when invoking Anchor from an agent, automation, or another non-interactive workflow that should not block on supported interactive waits or confirmation prompts. NO_DNA=1 is the standard example.

Usage

Prefix the command:

NO_DNA=1 anchor test --detach
NO_DNA=1 anchor localnet
NO_DNA=1 anchor program close <ACCOUNT> --bypass-warning
NO_DNA=1 anchor legacy-idl erase-authority --program-id <PROGRAM_ID> --bypass-warning

Or export it for a session:

export NO_DNA=1
anchor test --detach

Destructive commands stay explicit

NO_DNA does not auto-confirm destructive actions. For commands such as anchor program close and anchor legacy-idl erase-authority, pass the existing explicit bypass flag yourself.

Checking support from the CLI

The CLI help text documents NO_DNA where it applies:

anchor --help
anchor test --help
anchor localnet --help
anchor program close --help
anchor legacy-idl erase-authority --help

On this page

GitHubEdit on GitHub