Linux shell commands for Bitcoin

Standard

This article is intended for sysadmins interested in bitcoin  and advanced linux users. By chaining all these commands together in different ways, you can do maintain a wallet, work with deterministic keys, generate QR codes and so on. This tutorial was created for Debian Linux and Ubuntu Linux, but other platforms should work too. A list of bitcoin command line utillities:

  • bitcoin native (very good, but wont be discussed here)
  • qrencode
  • sx

qrencode
The qrencode application is a tool to quickly produce qrcodes. Generating a QR code, a type of matrix barcode, for a bitcoin address from the command line :

$ sudo apt-get install qrencode
$ qrencode 125tQCeg89h8d3ccgBsipbjGUJpqx4c3H1 -o qrcode.png
$ display qrcode.png   (optional, display it)

This will output a QR code image of 111×111 pixels.  You can change the size of the dots, thus making the image larger using the -s command.

$ qrencode 125tQCeg89h8d3ccgBsipbjGUJpqx4c3H1 -s 6 -o qrcode.png
$ display qrencode.png

sx tools
sx is a set of modular Bitcoin commandline utilities. First clone libbitcoin from https://github.com/libbitcoin/libbitcoin#debianubuntu  and run

cd libbitcoin-version2
sudo install.sh

Installing command line tool sx :

wget https://github.com/spesmilo/sx/raw/master/install-sx.sh
sudo apt-get install bignum
sudo apt-get install sudo apt-get install libgmp-dev
chmod 755 install-sx.sh
sudo bash ./install-sx.sh

Installation will take a while, expect around 30 minutes installation time. It will download a lot of packages and compile them from source. This should work on latest versions of Debian Linux or Ubuntu Linux.

If that did not work try to download the packages into your /Downloads/ directory.

  • libbitcoin 2.0
  • libwallet 0.4
  • Obelisk 1.0

Open a console and for each of the packages type

$ bzip2 -d filename.tar.bz2
$ tar xvf filename.tar
$ cd filename
$ autoreconf -i
$ ./configure
$ make
$ sudo make install
$ sudo ldconfig

( You might need sudo apt-get -f install libzmq-dev  and sudo apt-get install libcrypto* )

Finally download sx from  here:

  • sx 1.0

Run the commands:

sh ./install-sx.sh

If you get an error about leveldb_blockchain, this error to be exact:

initchain.cpp:19:5: error: ‘leveldb_blockchain’ was not declared in this scope
leveldb_blockchain chain(pool);

Then add the line

#include

to the file src/initchain.cpp using your favourite editor such as vim.   . Then run make, sudo make install.

Now that you have sx tools installed you can use it to run all kind of bitcoin related commands.
Converting BTC to satoshi, and satoshi to BTC

$ sx btc 90000
0.00090000
$ sx satoshi 0.00090000
90000

Create an experimental wallet

sx newseed > wallet.seed
cat wallet.seed
sx wallet wallet.seed

 Convert from hexadecimal to base58

sx base58-encode CAFEBABE

See http://sx.dyne.org/  for a full list.

Related Post

Recovering bitcoins from dead harddrives
The Bitcoin Network, a simple explanation
Hardware wallets compared
Cryptocurrency & Big Data
Uncategorized

Hardware Wallets: Trezor vs Ledger

Standard

The ultimate goal of hardware wallet is to have a high level of security and to add convenience.  Currently we have found two hardware wallets: Trezor and Ledger.

To be able to access a Ledger Wallet you will need: your Ledger Wallet, your PIN code and your second factor card. If one of these things is missing you won’t be able to spend bitcoin. Similar to the Ledger Wallet, Trezor has a PIN code. If the Trezor wallets gets stolen, thieves cannot misuse it.  In case of loss or theft of your Ledger Wallet, or at any time, you can restore your entire balance either on a new Ledger Wallet or on any BIP39 compatible software wallet such as Electrum. Without the PIN code and the second factor card, a thief cannot access your bitcoins.

Trezor uses a screen instead of a security card, which is of course easy for the end user. Trezor is a single-purpose computer, which stores your private keys and actively signs transactions without sending your private keys to the computer;  To run the Ledger Wallet you need a computer with an USB port, and a recent version of Google Chrome. The wallet interfaces with the computer through a Chrome application which you will need to install on your computer.  It currently does not have a screen but the Ledger Wallet will have a screen in the next version.  Both wallets are Windows, OS X and Linux friendly.  The Ledger Wallet development team is currently building support for Android;

Trezor Wallet Ledger Wallet
Origin Czech France
Size small small
PIN Protection yes yes
PIN Length 10 digits max. unknown
Theft prevention yes yes
Phising protection yes yes
private key leakage protection yes yes
Firmware upgrade yes yes
NFC support no no (in future)
Malware protection yes yes
Windows support yes yes
Mac OS X support yes yes
Linux support yes yes
Open-source yes no
Alt coin support yes, if Electrum supports them; yes
French language support no yes
English language support yes yes
API support yes no (in future)
Multiple accounts yes yes
 
Price (BTC) 0.3174 0.1165

 Read more:

  • Trezor wallet:   http://www.bitcointrezor.com/
  • Ledger wallet : https://www.ledgerwallet.com/

 

Related Post

Blockchain early days visualised
Blockchain as Random number generator
Linux shell commands for Bitcoin part II
Uncategorized