How to Use the Command 'electrum' (with examples)
Electrum is an ergonomic Bitcoin wallet that’s designed for ease of use while maintaining robust private key management capabilities. Highly regarded for its lightweight architecture, Electrum enables users to manage Bitcoin transactions with enhanced security through the use of private keys. This decentralized wallet provides a myriad of functionalities, making it a powerful tool for both novice and experienced users in the crypto space. More information can be found at Electrum’s official website .
Use case 1: Create a New Wallet
Code:
electrum -w new_wallet.dat create
Motivation: Creating a new wallet is a fundamental step for anyone beginning to use Electrum or any other cryptocurrency wallet. A wallet provides a secure storage space for Bitcoin, enabling transactions and safeguarding funds.
Explanation:
electrum
: This is the base command initiating the Electrum wallet application.-w new_wallet.dat
: This specifies the wallet file to create.new_wallet.dat
is the filename for the newly created wallet where its data will be stored.create
: This command initiates the creation of a new wallet.
Example Output:
New wallet has been created successfully.
Wallet file location: /path/to/new_wallet.dat
Use case 2: Restore an Existing Wallet from Seed Offline
Code:
electrum -w recovery_wallet.dat restore -o
Motivation: Restoring a wallet from a seed is crucial if you want to recover access to your Bitcoin funds after losing access to a wallet file, or if you want to set up your wallet on a new device. Doing this offline enhances security by reducing exposure to online threats.
Explanation:
electrum
: The command line tool being used.-w recovery_wallet.dat
: Specifies the wallet file to which you are restoring the data. In this case, it’s namedrecovery_wallet.dat
.restore
: This operation sets the function to restoring a wallet, which will prompt the user to input the seed.-o
: This indicates that the operation should be conducted offline, providing an added layer of security during the restoration process.
Example Output:
Please input your 12-word seed phrase.
Wallet restored successfully from seed.
Use case 3: Create a Signed Transaction Offline
Code:
electrum mktx recipient amount -f 0.0000001 -F from -o
Motivation: Creating a signed transaction offline is a tactic used to enhance security, particularly useful for cold wallet storage. By constructing the transaction offline, users reduce the risk of exposure to malicious software on the internet.
Explanation:
electrum
: Initiates the Electrum tool.mktx recipient
: Commands Electrum to make a new transaction directed torecipient
.amount
: The amount of Bitcoin to be included in the transaction.-f 0.0000001
: Sets the transaction fee for the transfer.-F from
: Specifies the sending address or wallet.-o
: Conducts the transaction creation offline, ensuring it remains secure from any possible online threats.
Example Output:
Transaction created successfully. Transaction ID: abc123xyz456
The transaction is signed and ready for broadcasting.
Use case 4: Display All Wallet Receiving Addresses
Code:
electrum listaddresses -a
Motivation: Viewing all receiving addresses of a wallet is essential for transaction audits, tracking funds, or providing addresses for new incoming Bitcoin transactions.
Explanation:
electrum
: Starts the Electrum software.listaddresses
: This function lists all associated addresses within the specified wallet.-a
: This option shows only the receiving addresses.
Example Output:
1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa
3Htr7ngCrrjg1mu9uSLbRfN6oxZ4NfFNod
bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwfnhz
Use case 5: Sign a Message
Code:
electrum signmessage address message
Motivation: Signing a message with a Bitcoin address is a powerful way to prove ownership of said address. It is often used in identity verification, ensuring authenticity of communications.
Explanation:
electrum
: The base command for the wallet functionality.signmessage
: This function is used to sign a message cryptographically.address
: The Bitcoin address from which you are signing the message.message
: The message content to be signed.
Example Output:
Message signed successfully.
Signature: H6vrtdKGxp7Vy3N...
Use case 6: Verify a Message
Code:
electrum verifymessage address signature message
Motivation: Verifying a message is useful when receiving signed communications to ensure that they come from the claimed sender without any alterations. It is a critical component of maintaining trust in transactions and communications.
Explanation:
electrum
: Launches the Electrum command tool.verifymessage
: This function checks the validity of the message’s signature.address
: Specifies the Bitcoin address that purportedly signed the message.signature
: The cryptographic signature that needs to be verified.message
: The original message content associated with the signature.
Example Output:
The message signature is valid.
Use case 7: Connect Only to a Specific Electrum-Server Instance
Code:
electrum -p socks5:127.0.0.1:9050 -s 56ckl5obj37gypcu.onion:50001:t -1
Motivation: Connecting to a specific Electrum server enhances privacy and security, offering users a way to bypass unreliable servers or potential spying nodes. Especially useful for users who require an additional layer of anonymity by routing through Tor.
Explanation:
electrum
: This starts the Electrum application.-p socks5:127.0.0.1:9050
: Sets up a proxy connection using SOCKS5 at the local address, usually indicative of routing through Tor.-s 56ckl5obj37gypcu.onion:50001:t
: Specifies the Electrum server to connect to. In this case, it’s a .onion address, accessible only via Tor.-1
: Instructs Electrum to only use the specified server rather than connecting to multiple servers.
Example Output:
Connected securely to the specified Electrum server via Tor.
Conclusion:
Electrum provides a diverse range of functionalities for Bitcoin wallets, each catering towards a specific use case from creating and restoring wallets to ensuring secure transactions and communications. This guide offers insights into these practical commands, empowering users with both robust security and ease of use.