Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

identity show

commandidentity.show
KindLocal read
NeedsAn existing identity. No MOSTRO_PUBKEY, RELAYS, stdin or --yes
PublishesNothing; contacts no relay or node
Local writeNone: no file, directory or SQLite sidecar is created or changed
Statusesok, error
Schemasschemas/identity.show.input.json, schemas/identity.show.output.json

Reports the identity public key of the local store and the last trade index it recorded. Use it to check that a store exists and which identity it holds.

Invocation

mostro-cli --output json identity show

Input

None. Any option of its own is invalid_arguments (exit 2). Root options such as --mostro-pubkey or --relays are accepted and ignored.

Behavior

Opens the store (MCLI_DIR, else .mcli in the home directory) read-only and reads the user row. It creates nothing, even when the store is missing or uses a WAL journal. The mnemonic and private keys are never shown.

Success data: IdentityShowData

FieldTypeMeaning
identity_pubkeyhex64The identity public key of the store
last_trade_indexinteger, 0..2147483647The last trade index recorded in the store; 0 before the first order or take. The next order or take uses the one after it

last_trade_index is a JSON integer, unlike the decimal-string trade indexes of the other outcomes. It is bounded to 0..2147483647 (the last normal BIP32 index), so every JSON reader decodes it exactly.

Outcomes

CasestatuscodeStages
Identity readoknot_applicable ×3
No data directory, no mcli.db, or no user rowerroridentity_missingnot_applicable ×3
The store cannot be read, holds no usable mnemonic, has a -wal file without its -shm file, or records an index out of rangeerroridentity_unreadablenot_applicable ×3
An option was givenerrorinvalid_arguments (exit 2)not_applicable ×3

Errors

invalid_arguments, identity_missing, identity_unreadable, internal_error. After identity_missing, create a store with identity init.

Warnings

None. The schema’s shared WarningCode list names invalid_event_timestamp and cleanup_incomplete, but this command emits no warning.

Examples

After three orders or takes: the next one uses index 4

identity.show/after_three_trades · status ok · exit 0 · fixture

mostro-cli --output json identity show
{
  "schema_version": "1",
  "command": "identity.show",
  "status": "ok",
  "data": {
    "identity_pubkey": "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",
    "last_trade_index": 3
  },
  "error": null,
  "warnings": [],
  "meta": {
    "publication": "not_applicable",
    "daemon_acceptance": "not_applicable",
    "persistence": "not_applicable",
    "snapshot": null
  }
}

A fresh store: no trade index recorded yet

identity.show/new_identity · status ok · exit 0 · fixture

mostro-cli --output json identity show
{
  "schema_version": "1",
  "command": "identity.show",
  "status": "ok",
  "data": {
    "identity_pubkey": "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",
    "last_trade_index": 0
  },
  "error": null,
  "warnings": [],
  "meta": {
    "publication": "not_applicable",
    "daemon_acceptance": "not_applicable",
    "persistence": "not_applicable",
    "snapshot": null
  }
}

No local store

identity.show/identity_missing · status error · identity_missing · exit 1 · fixture

mostro-cli --output json identity show
{
  "schema_version": "1",
  "command": "identity.show",
  "status": "error",
  "data": null,
  "error": {
    "code": "identity_missing",
    "message": "No local identity exists."
  },
  "warnings": [],
  "meta": {
    "publication": "not_applicable",
    "daemon_acceptance": "not_applicable",
    "persistence": "not_applicable",
    "snapshot": null
  }
}

The store exists but cannot be read

identity.show/identity_unreadable · status error · identity_unreadable · exit 1 · fixture

mostro-cli --output json identity show
{
  "schema_version": "1",
  "command": "identity.show",
  "status": "error",
  "data": null,
  "error": {
    "code": "identity_unreadable",
    "message": "The local identity store cannot be read."
  },
  "warnings": [],
  "meta": {
    "publication": "not_applicable",
    "daemon_acceptance": "not_applicable",
    "persistence": "not_applicable",
    "snapshot": null
  }
}

identity show takes no options

identity.show/invalid_arguments · status error · invalid_arguments · exit 2 · fixture

mostro-cli --output json identity show --bogus
{
  "schema_version": "1",
  "command": "identity.show",
  "status": "error",
  "data": null,
  "error": {
    "code": "invalid_arguments",
    "message": "The command arguments are invalid."
  },
  "warnings": [],
  "meta": {
    "publication": "not_applicable",
    "daemon_acceptance": "not_applicable",
    "persistence": "not_applicable",
    "snapshot": null
  }
}

Next

order mine lists the orders of the same store.