Command Line Interface

Installing libcrypto registers a libcrypto console command. It uses only the Python standard library and exposes wallet, mnemonic, validation, and message signing tools.

usage: libcrypto [-h] [--version]
                 {info,generate,mnemonic,validate,sign-message,verify-message} ...

You can also run it as a module: python -m libcrypto.cli ....

info

libcrypto info

Prints the version, description, and repository URL.

generate

Generate keys and addresses. Without --private-key, a fresh secure key is created.

# From an existing key (WIF or 64-char hex)
libcrypto generate --private-key 0000000000000000000000000000000000000000000000000000000000000001

# Restrict to specific coins (repeatable)
libcrypto generate -c bitcoin -c ethereum -c tron

# Fresh random wallet across the default coin set
libcrypto generate

Options:

Option Description
--private-key, -p WIF or 64-character hex private key.
--coin, -c Coin to generate (repeatable). Defaults to a common set.

mnemonic

# Generate a 12-word phrase (choose 12/15/18/21/24)
libcrypto mnemonic generate --words 24

# Validate a phrase
libcrypto mnemonic validate "abandon abandon abandon ... about"

validate exits 0 when valid, 1 otherwise.

validate

Validate a cryptocurrency address, optionally constrained to a network.

libcrypto validate 1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH
libcrypto validate bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4 --network bitcoin

Exits 0 when valid, 1 otherwise, and prints the detected format, type, and possible networks.

sign-message

Sign a message with the Ethereum (EIP-191) or Bitcoin scheme.

# Ethereum (prints 0x-prefixed 65-byte signature)
libcrypto sign-message "Hello, world!" -c ethereum \
  -p 0000000000000000000000000000000000000000000000000000000000000001

# Bitcoin (prints Base64 signature)
libcrypto sign-message "Hello, world!" -c bitcoin \
  -p 0000000000000000000000000000000000000000000000000000000000000001

Options: --coin/-c (ethereum default, or bitcoin), --private-key/-p (required, WIF or hex).

verify-message

Verify a signed message against an expected signer address.

libcrypto verify-message "Hello, world!" -c ethereum \
  -a 0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf \
  -s 0x<signature-hex>

libcrypto verify-message "Hello, world!" -c bitcoin \
  -a 1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH \
  -s "<base64-signature>"

Prints valid/invalid and, when valid, the recovered signer. Exits 0 when valid, 1 otherwise.

Security

The CLI accepts private keys on the command line for convenience. On shared or logged systems this can expose secrets through shell history and process listings. Prefer offline machines and clear your history when handling real keys.