Skip to main content

gnokey

Used for account & key management and general interactions with the Gnoland blockchain.

Generate a New Seed Phrase

Generate a new seed phrase and add it to your keybase with the following command.

gnokey generate

Add a New Key

You can add a new private key to the keybase using the following command.

gnokey add {KEY_NAME}

Options

NameTypeDescription
accountUIntAccount number for HD derivation.
dryrunBooleanPerforms action, but doesn't add key to local keystore.
indexUIntAddress index number for HD derivation.
ledgerBooleanStores a local reference to a private key on a Ledger device.
multisigString []Constructs and stores a multisig public key (implies --pubkey).
nobackupBooleanDoesn't print out seed phrase (if others are watching the terminal).
nosortBooleanKeys passed to --multisig are taken in the order they're supplied.
pubkeyStringParses a public key in bech32 format and save it to disk.
recoverBooleanProvides seed phrase to recover existing key instead of creating.
thresholdIntK out of N required signatures. For use in conjunction with --multisig (default: 1).

Test Seed Phrase: source bonus chronic canvas draft south burst lottery vacant surface solve popular case indicate oppose farm nothing bullet exhibit title speed wink action roast

Using a ledger device

You can add a ledger device using the following command

[!NOTE] Before running this command make sure your ledger device is connected, with the cosmos app installed and open in it.

gnokey add {LEDGER_KEY_NAME} --ledger

List all Known Keys

List all keys stored in your keybase with the following command.

gnokey list

Delete a Key

Delete a key from your keybase with the following command.

gnokey delete {KEY_NAME}

Options

NameTypeDescription
yesBooleanSkips confirmation prompt.
forceBooleanRemoves key unconditionally.

Export a Private Key (Encrypted & Unencrypted)

Export a private key's (encrypted or unencrypted) armor using the following command.

gnokey export

Options

NameTypeDescription
keyStringName or Bech32 address of the private key
output-pathStringThe desired output path for the armor file
unsafeBoolExport the private key armor as unencrypted

Import a Private Key (Encrypted & Unencrypted)

Import a private key's (encrypted or unencrypted) armor with the following command.

gnokey import

Options

NameTypeDescription
armor-pathStringThe path to the encrypted armor file.
nameStringThe name of the private key.
unsafeBoolImport the private key armor as unencrypted

Make an ABCI Query

Make an ABCI Query with the following command.

gnokey query {QUERY_PATH}

Query

Query PathDescriptionExample
auth/accounts/{ADDRESS}Returns information about an account.gnokey query auth/accounts/g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5
bank/balances/{ADDRESS}Returns balances of an account.gnokey query bank/balances/g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5
vm/qfuncsReturns public facing function signatures as JSON.gnokey query vm/qfuncs --data "gno.land/r/demo/boards"
vm/qfileReturns the file bytes, or list of files if directory.gnokey query vm/qfile --data "gno.land/r/demo/boards"
vm/qrenderCalls .Render(path) in readonly mode.gnokey query vm/qrender --data "gno.land/r/demo/boards"
vm/qevalEvaluates any expression in readonly mode and returns the results.gnokey query vm/qeval --data "gno.land/r/demo/boards GetBoardIDFromName("my_board")"
vm/store(not yet supported) Fetches items from the store.-
vm/package(not yet supported) Fetches a package's files.-

Options

NameTypeDescription
dataUInt8 []Queries data bytes.
heightInt64(not yet supported) Queries height.
proveBoolean(not yet supported) Proves query result.

Sign and Broadcast a Transaction

You can sign and broadcast a transaction with the following command.

gnokey maketx {SUB_COMMAND} {ADDRESS or KeyName}

Subcommands

NameDescription
addpkgUploads a new package.
callCalls a public function.
sendThe amount of coins to send.

addpkg

This subcommand lets you upload a new package.

gnokey maketx addpkg \
-deposit="1ugnot" \
-gas-fee="1ugnot" \
-gas-wanted="5000000" \
-pkgpath={Registered Realm path} \
-pkgdir={Package folder path} \
{ADDRESS} \
> unsigned.tx

SignBroadcast Options

NameTypeDescription
gas-wantedInt64The maximum amount of gas to use for the transaction.
gas-feeStringThe gas fee to pay for the transaction.
memoStringAny descriptive text.
broadcastBooleanBroadcasts the transaction.
chainidStringDefines the chainid to sign for (should only be used with --broadcast)

makeTx AddPackage Options

NameTypeDescription
pkgpathStringThe package path (required).
pkgdirStringThe path to package files (required).
depositStringThe amount of coins to send.

call

This subcommand lets you call a public function.

# Register
gnokey maketx call \
-gas-fee="1ugnot" \
-gas-wanted="5000000" \
-pkgpath="gno.land/r/demo/users" \
-send="200000000ugnot" \
-func="Register" \
-args="" \
-args={NAME} \
-args="" \
{ADDRESS} \
> unsigned.tx

SignBroadcast Options

NameTypeDescription
gas-wantedInt64The maximum amount of gas to use for the transaction.
gas-feeStringThe gas fee to pay for the transaction.
memoStringAny descriptive text.
broadcastBooleanBroadcasts the transaction.
chainidStringThe chainid to sign for (should only be used with --broadcast)

makeTx Call Options

NameTypeDescription
sendStringThe amount of coins to send.
pkgpathStringThe package path (required).
funcStringThe contract to call (required).
argsStringAn argument of the function being called. Can be used multiple times in a single call command to accommodate possible multiple function arguments.
info

Currently, only primitive types are supported as -args parameters. This limitation will be addressed in the future. Alternatively, see how maketx run works.

send

This subcommand lets you send a native currency to an address.

gnokey maketx send \
-gas-fee="1ugnot" \
-gas-wanted="5000000" \
-send={SEND_AMOUNT} \
-to={TO_ADDRESS} \
{ADDRESS} \
> unsigned.tx

SignBroadcast Options

NameTypeDescription
gas-wantedInt64The maximum amount of gas to use for the transaction.
gas-feeStringThe gas fee to pay for the transaction.
memoStringAny descriptive text.
broadcastBooleanBroadcasts the transaction.
chainidStringThe chainid to sign for (implies --broadcast)

makeTx Send Options

NameTypeDescription
sendStringAmount of coins to send.
toStringThe destination address.

Sign a Document

Sign a document with the following command.

gnokey sign

Options

NameTypeDescription
txpathStringThe path to file of tx to sign (default: -).
chainidStringThe chainid to sign for (default: dev).
numberUIntThe account number of the account to sign with (required)
sequenceUIntThe sequence number of the account to sign with (required)
show-signbytesBooleanShows signature bytes.

Verify a Document Signature

Verify a document signature with the following command.

gnokey verify

Options

NameTypeDescription
docpathStringThe path of the document file to verify.

Broadcast a Signed Document

Broadcast a signed document with the following command.

gnokey broadcast {signed transaction file document}