LinuxCommandLibrary

electrum

Manage and use Bitcoin wallets

TLDR

Create a new wallet

$ electrum [[-w|--wallet]] [path/to/new_wallet.dat] create
copy

Restore an existing wallet from seed offline
$ electrum [[-w|--wallet]] [path/to/recovery_wallet.dat] restore [[-o|--offline]]
copy

Create a signed transaction offline
$ electrum mktx [recipient] [amount] [[-f|--fee]] 0.0000001 [[-F|--from-addr]] [from] [[-o|--offline]]
copy

Display all wallet receiving addresses
$ electrum listaddresses -a
copy

Sign a message
$ electrum signmessage [address] [message]
copy

Verify a message
$ electrum verifymessage [address] [signature] [message]
copy

Connect only to a specific electrum-server instance
$ electrum [[-p|--proxy]] socks5:[127.0.0.1]:9050 [[-s|--server]] [56ckl5obj37gypcu.onion]:50001:t [[-1|--oneserver]]
copy

SYNOPSIS

electrum [global_options] [subcommand] [subcommand_options] [arguments]
The electrum command can launch the graphical user interface by default. For command-line interface (CLI) operations, specific subcommands are typically used. Many CLI commands require a running electrum daemon for full functionality, especially for real-time wallet interactions.

PARAMETERS

--help, -h
    Show help message and exit.

--version
    Show program's version number and exit.

--gui
    Explicitly start the graphical user interface.

--cli
    Explicitly start the command-line interface (often implied when a subcommand is given).

--wallet
    Specify the wallet file to use, allowing management of multiple wallets.

--testnet
    Connect to the Bitcoin testnet for development and testing purposes.

--mainnet
    Connect to the Bitcoin mainnet (the default and real Bitcoin network).

daemon
    Subcommand to start or manage the Electrum background service.
daemon start: Starts the Electrum daemon in the background.
daemon stop: Stops the running daemon instance.
daemon status: Shows the status of the daemon.

commands
    List all available CLI commands with a brief description.

listaddresses
    List all addresses within the current wallet, showing their type and associated labels.

getbalance
    Display the wallet's total, confirmed, and unconfirmed Bitcoin balance.

history
    Show the chronological transaction history for the entire wallet.

getaddresshistory


    Show the transaction history for a specific Bitcoin address.

createnewaddress
    Generate and display a new receiving address for the wallet.

payto
[feerate]
    Create, sign, and optionally broadcast a transaction to send a specified amount of Bitcoin to an address. An optional feerate can be provided.

broadcast
    Broadcast a raw, signed Bitcoin transaction string to the network.

restore
    Restore a wallet using its 12-word seed phrase.

getaddressunspent

    List all unspent transaction outputs (UTXOs) for a given address.

DESCRIPTION

Electrum is a popular, open-source, and lightweight Bitcoin wallet. It uses Simplified Payment Verification (SPV), meaning it doesn't download the entire blockchain, which makes it fast and resource-efficient. Key features include strong security (cold storage, multi-signature capabilities, hardware wallet integration), enhanced privacy, ease of use, and a robust command-line interface (CLI). The CLI is particularly powerful, allowing for advanced scripting, automation of transactions, comprehensive wallet management, and seamless interaction with the Electrum daemon. This makes it an ideal tool for developers, system administrators, and power users seeking programmatic control over their Bitcoin funds. Electrum supports various Bitcoin networks, including mainnet, testnet, and regtest, offering flexibility for different use cases and development environments.

CAVEATS

When using the CLI, sensitive information such as seed phrases or private keys can be exposed to terminal history or scripts if not handled with extreme care. Always verify command parameters, especially addresses and amounts, before executing financial transactions. Electrum's SPV model relies on trusting Electrum's servers for initial block header validation, although security is enhanced by chaining to a full node or verifying block headers. Many real-time wallet operations via the CLI require the Electrum daemon to be running in the background.

GUI VS. CLI

Electrum offers both an intuitive graphical user interface (GUI) and a powerful command-line interface (CLI). The GUI is ideal for everyday users, while the CLI provides advanced capabilities for scripting, automation, and server environments without a display.

DAEMON MODE

For persistent background operation and API interactions, Electrum can be run as a daemon. This allows other applications or scripts to seamlessly communicate with the wallet without repeatedly launching the main Electrum application.

HISTORY

Electrum was first released in 2011 by Thomas Voegtlin, making it one of the pioneering and most enduring Bitcoin wallets. Its immediate popularity stemmed from its innovative focus on speed, light-client functionality (Simplified Payment Verification - SPV), and robust security features like hardware wallet support and multi-signature capabilities. Over the years, it has continuously evolved, integrating advanced features such as Lightning Network support and developing a comprehensive command-line interface, cementing its position as a cornerstone in the Bitcoin ecosystem.

SEE ALSO

bitcoin-cli(1), lncli(1)

Copied to clipboard