Skip to content

AlgoKey

algokey is a command-line utility for Algorand key material. It generates and imports keys, signs transactions and logic signatures, and manages post-quantum (PQ) and consensus participation keys.

algokey operates entirely offline. It has no data directory, accepts no --datadir flag, reads no ALGORAND_DATA environment variable, and never opens a network connection. Every command reads and writes local files. A node does not need to be installed on the same machine, running, or synced.

algokey is distributed with the Algorand node software and is installed alongside goal, algod, and kmd. Installing that software makes algokey available; starting a node is not required.

algokey --version (-v) prints the build version. The first line of its output is the version encoded as an integer and can be ignored.

$ algokey --version
5497558138880
5.0.0.stable [rel/stable] (commit #da5946a1)
go-algorand is licensed with AGPLv3.0
source code available at https://github.com/algorand/go-algorand
CommandDescription
algokey generateGenerates an Ed25519 key
algokey importRecreates an Ed25519 key file from a mnemonic
algokey exportRecovers the mnemonic and address from an Ed25519 key file
algokey signSigns transactions with an Ed25519 key
algokey multisigAdds a multisig signature to transactions
algokey multisig append-auth-addrAdds multisig preimage fields for a rekeyed sender
algokey pq generateGenerates a post-quantum key
algokey pq infoPrints scheme, public key, salt, and address from a PQ key file
algokey pq importRecreates a PQ key file from a mnemonic
algokey pq signSigns transactions with a post-quantum key
algokey pq sign-programSigns a compiled logic signature program with a PQ key
algokey pq check-addressReports whether an address is post-quantum compliant
algokey part generateGenerates a consensus participation key
algokey part infoPrints participation key metadata
algokey part reparentChanges a participation key’s parent account
algokey part keyregBuilds an unsigned key registration transaction

Key sources. Commands that sign accept a key either as a file (--keyfile) or as a mnemonic (--mnemonic). The two are mutually exclusive; supplying both or neither is an error.

Mnemonics are 25-word Algo25 phrases. Every algokey command that reads or prints a mnemonic uses the legacy Algo25 scheme: 24 words encoding a 32-byte seed, plus a 25th checksum word. algokey does not support the 24-word hierarchical deterministic (xHD) scheme now preferred for Standard Accounts, and cannot derive keys from an xHD phrase. See Account Overview for the difference.

Flag shorthands are not uniform. generate, import, and export use -f for --keyfile. sign, multisig, and every pq command use -k. The long form --keyfile is accepted everywhere and avoids the inconsistency.

File permissions. Ed25519 and post-quantum private key files are written with mode 0600, as is every transaction and logic signature algokey writes. Public key files — the address written by --pubkeyfile — are written with mode 0666. Participation key databases are created by the database layer and follow neither convention.

Standard input and output. A filename of - means standard input or standard output, but only on the flags that support it: every file flag of pq sign and pq sign-program, the --keyfile of pq info, both file flags of multisig append-auth-addr, and part keyreg --outputFile. Everywhere else — including algokey sign, plain algokey multisig, and the key files written by generate, import, pq generate, and pq import- is an ordinary filename.

Exit codes. Commands exit 0 on success and 1 on failure, writing the failure message to standard error. See Errors for one addition to this.

Generates a random Ed25519 key. Prints the mnemonic and address, and optionally writes them to files. Writing no files still prints both values.

NameTypeRequiredDescription
--keyfile, -fstringNoPath to write the 32-byte private key seed. Omit to print only.
--pubkeyfile, -pstringNoPath to write the checksummed address, followed by a newline.
$ algokey generate
Private key mnemonic: enforce increase awake [19 omitted] diagram absorb beach
Public key: YQLS3TNWOFTEJGIDN54FABOSGHSLFJSSEIF2DBBGYXC3MP7NV3NHEZRKTY

Recreates an Ed25519 key file from a mnemonic. Surrounding whitespace in the mnemonic is ignored. The mnemonic and the derived address are always printed. Because --keyfile is optional, algokey import -m "…" on its own is a mnemonic-to-address lookup that writes nothing.

NameTypeRequiredDescription
--mnemonic, -mstringYesThe 25-word mnemonic to recover the key seed from.
--keyfile, -fstringNoPath to write the recovered private key seed.

Recovers the mnemonic and address from an Ed25519 key file. This is the inverse of import, and has no post-quantum equivalent — see Post-Quantum Keys.

NameTypeRequiredDescription
--keyfile, -fstringYesPath to the private key file to export.
--pubkeyfile, -pstringNoPath to write the checksummed address.

The key file must be exactly 32 bytes. A file of any other length is rejected rather than truncated or padded.

Signs every transaction in a file with an Ed25519 key, producing a sig signature. The input may contain multiple concatenated transactions; each is signed and written to the output in order.

When the signing key does not match the transaction’s sender, algokey sets the signed transaction’s AuthAddr to the signing key’s address, which is the form required for a rekeyed sender. When the key does match the sender, algokey does not set AuthAddr.

sign never clears an authorization field. An AuthAddr, msig, lsig, or pqsig already present in the input is carried through to the output unchanged and the new sig is added alongside it — unlike pq sign --overwrite, which clears those fields first. A transaction carrying two categories of signature is rejected by the network, so the output of algokey multisig append-auth-addr is not a valid input to algokey sign.

NameTypeRequiredDescription
--txfile, -tstringYesPath to the input transaction file (MessagePack).
--outfile, -ostringYesPath to write the signed transactions.
--keyfile, -kstringNoPath to the private key file. Mutually exclusive with --mnemonic.
--mnemonic, -mstringNoThe 25-word mnemonic. Mutually exclusive with --keyfile.

Adds one multisig signature to every transaction in a file. The transaction must already carry a multisig preimage identifying the participating addresses and threshold; this command contributes a single subsignature and does not create the preimage.

NameTypeRequiredDescription
--txfile, -tstringYesPath to the input transaction file.
--outfile, -ostringYesPath to write the signed transactions.
--keyfile, -kstringNoPath to the private key file. Mutually exclusive with --mnemonic.
--mnemonic, -mstringNoThe 25-word mnemonic. Mutually exclusive with --keyfile.

Adds the multisig preimage and AuthAddr fields to a transaction sent from an account that has been rekeyed to a multisig account. It writes the fields only; it adds no signature. Unlike the other transaction commands, it processes only the first transaction in the input file; any others are dropped without an error.

NameTypeRequiredDescription
--params, -pstringYesThreshold and addresses as one quoted string: "<threshold> <addr1> <addr2> …". Requires a threshold and at least two addresses.
--txfile, -tstringYesPath to the input transaction file.
--outfile, -ostringNoPath to write the result. If omitted, the input file is modified in place.

The derived multisig address must differ from the transaction’s sender.

Because only the first transaction is processed, omitting --outfile on a file that holds more than one transaction overwrites the input in place with just that first transaction and loses the rest silently. Pass an explicit --outfile whenever the input may contain more than one transaction.

These commands manage accounts secured by Falcon-1024 signatures. algokey generates post-quantum keys, signs transactions and delegated logic signatures with them, and checks address compliance.

A post-quantum key file stores the derived Falcon signing keys, never the mnemonic entropy they came from. There is therefore no algokey pq export: the mnemonic is displayed once by pq generate and cannot be recovered from the key file afterwards.

Losing the mnemonic does not lose the account, because the key file still signs for it. It does foreclose recreating the key with pq import, and because the scheme identifier is part of the derivation, it forecloses producing that mnemonic’s key for any other post-quantum scheme.

That derivation is a single domain-separated hash of the mnemonic entropy together with the scheme identifier, yielding one key per scheme. It is not hierarchical deterministic derivation: there is no key tree, no derivation path, and no relationship to the xHD scheme used for Standard Accounts.

Generates a post-quantum key, writes the key file, and prints the mnemonic followed by the key’s scheme, public key, address salt, and address.

NameTypeRequiredDescription
--keyfile, -kstringYesPath to write the private key file.
--scheme, -SstringNoSignature scheme. Accepts falcon-1024, matched case-insensitively, or the two-character code f1, matched exactly. Default falcon-1024.
$ algokey pq generate -k pq.key
PQ private key mnemonic: bullet actor evolve [19 omitted] struggle absorb bounce
Write these words down: they cannot be recovered from the key file.
PQ scheme: falcon-1024
PQ public key: CmLGYOTU2/Y0msATCoDwr5hERG9L4gy8ZeQfJLxF5FMkLALSTEwtBOEm…
PQ address salt: 1
PQ address: EGGRNA45S7W3FCDQOEX7H64KCECFHIBWO5MB6B724NVPFQNOFPQQLDF3RY

The mnemonic and public key are abbreviated above. The mnemonic is 25 words on a single line, and the public key is 2,392 base64 characters encoding 1,793 bytes. The key file is 4,153 bytes.

The address salt is a search result rather than a fixed value. algokey selects the lowest salt that yields an address off the Ed25519 curve, so a given key may report 0, 1, or a higher value. The example above required salt 1, meaning the salt-0 candidate was a valid curve point.

Prints the scheme, public key, address salt, and address stored in a post-quantum key file. It does not print the mnemonic, which the file does not contain.

NameTypeRequiredDescription
--keyfile, -kstringYesPath to the private key file to read.

Recreates a post-quantum key file from a mnemonic. The scheme identifier is part of the key derivation, so the same mnemonic produces a different, independent key under each scheme, and the scheme supplied here must match the one used to generate the key.

NameTypeRequiredDescription
--mnemonic, -mstringYesThe 25-word mnemonic.
--keyfile, -kstringYesPath to write the recovered private key file.
--scheme, -SstringNoSignature scheme. Default falcon-1024.

Derivation is deterministic: importing the mnemonic from the pq generate example above recreates a byte-identical key file.

$ algokey pq import -m "bullet actor evolve … absorb bounce" -k restored.key
PQ scheme: falcon-1024
PQ address salt: 1
PQ address: EGGRNA45S7W3FCDQOEX7H64KCECFHIBWO5MB6B724NVPFQNOFPQQLDF3RY

Signs every transaction in a file with a post-quantum key, producing a pqsig signature. As with algokey sign, AuthAddr is set only when the key’s address differs from the sender.

NameTypeRequiredDescription
--txfile, -tstringYesPath to the input transaction file.
--outfile, -ostringYesPath to write the signed transactions.
--keyfile, -kstringNoPath to the private key file. Mutually exclusive with --mnemonic.
--mnemonic, -mstringNoThe 25-word mnemonic. Mutually exclusive with --keyfile.
--scheme, -SstringNoSignature scheme, used with --mnemonic. Default falcon-1024.
--overwriteboolNoReplaces any existing signature. Default false.

A transaction that already carries a signature is rejected unless --overwrite is supplied. --overwrite is a replacement rather than a merge: it clears the sig, msig, lsig, and pqsig fields and the AuthAddr field before signing.

A Falcon signature is substantially larger than an Ed25519 one, and its length varies between keys and messages. Signing a 112-byte key registration transaction produces an output of approximately 3 KB.

$ algokey pq sign -k pq.key -t keyreg.txn -o keyreg.stxn
$ ls -l keyreg.txn keyreg.stxn
112 keyreg.txn
3165 keyreg.stxn

Signs a compiled logic signature program with a post-quantum key, producing a delegated logic signature. The signed payload binds the delegating account’s address to the program, which differs from Ed25519 delegation.

NameTypeRequiredDescription
--program, -pstringYesPath to a compiled program. Transaction Execution Approval Language (TEAL) source is rejected.
--outfile, -ostringYesPath to write the logic signature.
--keyfile, -kstringNoPath to the private key file. Mutually exclusive with --mnemonic.
--mnemonic, -mstringNoThe 25-word mnemonic. Mutually exclusive with --keyfile.
--scheme, -SstringNoSignature scheme, used with --mnemonic. Default falcon-1024.

The program must be compiled bytecode. algokey rejects an input whose filename ends in .teal, and rejects any input consisting entirely of printable ASCII, since both indicate uncompiled source. Compiling requires no node.

$ goal clerk compile approval.teal -o approval.tok
approval.teal: U3ZXEUNFRSUDPPNFC6U7OBYO4S4AUOEP4RDBI23L2Q5TX3K5LTSVWQOKFM
$ algokey pq sign-program -k pq.key -p approval.tok -o delegated.lsig

A logic signature carries only one type of delegation signature. A post-quantum delegated logic signature therefore cannot also carry a multisig signature; transaction verification rejects a logic signature that carries more than one.

Reports whether an address is post-quantum compliant, meaning it does not correspond to a point on the Ed25519 curve. Nodes apply this check when a transaction is submitted, so it identifies addresses that would be rejected before they are used.

NameTypeRequiredDescription
ADDRESSstringYesPositional. One 58-character Algorand address.
$ algokey pq check-address \
EGGRNA45S7W3FCDQOEX7H64KCECFHIBWO5MB6B724NVPFQNOFPQQLDF3RY
address EGGRNA45S7W3FCDQOEX7H64KCECFHIBWO5MB6B724NVPFQNOFPQQLDF3RY is PQ
compliant
$ algokey pq check-address \
5476XEHANTSFYJTFDDMGL7OP5OLEPEAS262CUG5QR3IKILKNCAR5YNYJVA
address 5476XEHANTSFYJTFDDMGL7OP5OLEPEAS262CUG5QR3IKILKNCAR5YNYJVA is not PQ
compliant

The second address is an ordinary Ed25519 address, which is by definition a curve point and therefore never post-quantum compliant.

These commands manage the voting keys an account registers to participate in consensus. They operate on a local participation key database file and require no node.

Generates a participation key valid for a range of rounds. Generation can take several minutes.

NameTypeRequiredDescription
--keyfilestringYesPath to write the participation key database.
--firstuint64YesFirst round the key is valid for.
--lastuint64YesLast round the key is valid for. Must be greater than or equal to --first.
--dilutionuint64NoKey dilution for two-level keys. Defaults to 1 + floor(sqrt(last - first)), so a 1,000-round window gives 32.
--parentstringNoAddress of the account the key belongs to.

Prints the metadata of a participation key database.

NameTypeRequiredDescription
--keyfilestringYesPath to the participation key database.

Changes the parent account recorded in a participation key database.

NameTypeRequiredDescription
--keyfilestringYesPath to the participation key database.
--parentstringYesAddress of the new parent account.

Builds a key registration transaction and writes it unsigned, ready to be signed by algokey sign or algokey pq sign. Genesis hashes for the supported networks are built in, so no node is consulted. Setting the ALGOKEY_GENESIS_HASH environment variable overrides the built-in hash and bypasses the --network lookup entirely. It exists for testing, and is the only environment variable algokey reads.

NameTypeRequiredDescription
--firstvaliduint64YesFirst round the transaction may be committed. With --keyfile, may not be earlier than the participation key’s own first valid round.
--networkstringYesNetwork whose genesis hash the transaction targets. One of mainnet, testnet, betanet, devnet.
--lastvaliduint64NoLast round the transaction may be committed. Defaults to --firstvalid plus 1000. The range may not exceed 1000 rounds.
--feeuint64NoTransaction fee in microAlgos. Default 1000, which is also an enforced minimum.
--offlineboolNoBuilds a transaction taking the account offline. Default false.
--keyfilestringNoParticipation key database to register. Online registrations only.
--accountstringNoAddress to take offline. Offline registrations only.
--outputFile, -ostringNoPath to write the transaction, or - for standard output. Defaults to <keyfile>.tx.

--keyfile and --account are mutually exclusive: --keyfile applies when bringing an account online, --account when taking one offline.

When --outputFile is omitted the transaction is written to <keyfile>.tx. Because --keyfile is not permitted with --offline, an offline registration that omits --outputFile writes to a file named .tx in the working directory. An existing output file is never overwritten — the command fails rather than replacing it, so re-running it is not idempotent. On success the path written is printed to standard output.

Errors raised by the commands themselves are written to standard error with exit code 1. Flag-validation failures caught by the command-line parser — a missing required flag, an unknown flag — are also echoed to standard output.

MessageCondition
Must specify one of keyfile or mnemonicsign or multisig given neither key source
Cannot specify both keyfile and mnemonicsign or multisig given both key sources
must specify --keyfile or --mnemonicA pq command given neither key source
cannot specify both --keyfile and --mnemonicA pq command given both key sources
Key file <path> is <n> bytes, expected a 32-byte Ed25519 seedEd25519 key file is not exactly 32 bytes
Cannot recover key seed from mnemonic: <error>Ed25519 mnemonic fails checksum or word validation
cannot recover PQ key entropy from mnemonic: <error>A pq command given a mnemonic that fails validation
pq signature scheme not supported: "<scheme>"--scheme names a scheme other than falcon-1024/f1
pq key file is malformed: <detail>PQ key file fails to decode or has wrong key sizes
pq address salt is not compliant: address <address>PQ key file whose stored salt yields an on-curve address
transaction already has a signaturepq sign on a signed transaction without --overwrite
program is emptypq sign-program given an empty program file
<file> looks like TEAL source; compile it first (e.g. goal clerk compile) and don't use the .teal extensionpq sign-program given a .teal filename
program is not compiled bytecode; compile it first (e.g. goal clerk compile) and don't use the .teal extensionpq sign-program given all-printable-ASCII input
address <address> is not PQ compliantpq check-address given an on-curve address
cannot parse address: decoded bad addr: <value>pq check-address given a malformed address
no transactions found in <file>pq sign given a file containing no transactions
Last round <n> < first round <n>part generate given --last below --first
the provided transaction fee (<n>) is too low, the minimum fee is 1000part keyreg given --fee below 1000
must provide --keyfile when registering participation keyspart keyreg without --offline and without --keyfile
must provide --account when bringing an account offlinepart keyreg --offline without --account
cannot access keyfile '<path>'part keyreg --keyfile naming a file that does not exist
outputFile '<path>' already existspart keyreg whose output file is already present
the transaction's firstvalid round (<n>) field should be set greater than or equal to the participation key's first valid round (<n>). …part keyreg --firstvalid earlier than the key’s own first valid round
the transaction's specified validity range must be less than or equal to 1000 rounds due to security constraints. …part keyreg whose --lastvalid exceeds --firstvalid by more than 1000

Messages ending in are shown abbreviated; the tool prints a longer explanation. Every other message above is verbatim.