Bitcoin Forum

Bitcoin => Wallet software => Topic started by: adorno on January 07, 2015, 01:42:14 AM



Title: TermWallet - Lightweight Command-Line Wallet
Post by: adorno on January 07, 2015, 01:42:14 AM
I'm excited to release a project I've been working on the past few months, which has reached a point of usability and stability I'm finally satisfied with.  It uses the latest bitcoinj version, currently 0.12.2.

TermWallet

TermWallet is a bitcoinj-based wallet tailor-made for the command line.  It does not download the whole blockchain, and as a result the blockchain data only take up about a megabyte of space.  Small servers with limited HDD space are thus the ideal use-case for TermWallet.  Generated addresses are deterministic (HD) by default, using the BIP32 specification, but external private keys can also be imported into the wallet.

TermWallet can make transactions using only one address's outputs by including a novel adaption of bitcoinj's CoinSelector method, IndividualCoinSelector.  Previously, bitcoinj (and subsequently bitcoinj-based wallets such as Multibit) has not been able to select outputs from only one address.  IndividualCoinSelector provides this capability. Use the "-f (--from)" option while using the "send" command to designate the address to send from.

An encryption function is included, currently only encrypting private keys. Further, TermWallet provides a 'panic' command that can send all the BTC's in the wallet to an external address and, optionally, delete the wallet (including all files). This should be used if the computer is compromised or at risk.  No private keys will be easily recoverable.

An experimental function is provided to connect to the blockchain through Tor.  Use "-t" or "--tor" to use it.

To view the full usage menu, use "termwallet --help"

Install Instructions

Full Source Code: https://github.com/grayleonard/termwallet (https://github.com/grayleonard/termwallet)

Requirements:
OSX or Linux
Java 1.6 (bitcoinj requirement)

Quick Install:
Code:
wget -O - https://raw.githubusercontent.com/grayleonard/termwallet/master/install.sh | sh
You may need to run
Code:
wget -O - https://raw.githubusercontent.com/grayleonard/termwallet/master/install.sh | sudo sh
if permission is denied (note the 'sudo')

If you want to build from source:
Code:
git clone https://github.com/grayleonard/termwallet.git
cd termWallet
./build.sh
(Maven2 is required to build the project)

Get started by running 'termwallet new'. It creates a new address. Examples below.

Contributions and bug reports are welcomed, just make a pull request or open an issue.

"Screenshots"
Code:
[term@wallet]$ termwallet status
Connecting to and downloading blockchain...
Finished downloading blockchain...

Your addresses and their balances:
Deterministic Keys:
157tPz2zUc7Q843bRXhbN2PgNRJwFP3tBi      Balance: BTC 0.00
1QECpf8AjyZMCEV54uhKccRd6ueYiUHhik      Balance: BTC 0.00
18PcKRUNkq26JN3sXx9VGmch5Guj2JX9q8      Balance: BTC 0.00
1pXcUE8PJy8VdP4dPfttr3FyUCBwmStfH       Balance: BTC 0.00

Confirmed: BTC 0.00
Unconfirmed: BTC 0.00

Code:
[term@wallet]$ termwallet import
Connecting to and downloading blockchain...
Finished downloading blockchain...

Private key: correct horse battery staple
Creating ECKey ECKey{pub=047e225fa4260a6b6ce741170396462629115f52fe5305830df1c2acce10250f11a16e5a2a0816c677c4506db3a4b8f73f3ea97d538488674f84e20d40956751fc, isEncrypted=false}...
Added new ECKey, address 1EnngHuGmcjz781rYV5KXw4FAcwXi5o4ei to wallet...

Code:
[term@wallet]$ termwallet new
Connecting to and downloading blockchain...
Finished downloading blockchain...

New Address 1L54YBPbPQAhMnxCmQedNeSuXp63RHCKdG with purpose RECEIVE_FUNDS

Donation address: 1L54YBPbPQAhMnxCmQedNeSuXp63RHCKdG  ;)


Title: Re: TermWallet - Lightweight Command-Line Wallet using bitcoinj
Post by: jim618 on January 07, 2015, 10:44:25 AM
Very nice !

:-)


Title: Re: TermWallet - Lightweight Command-Line Wallet using bitcoinj
Post by: Mike Hearn on January 08, 2015, 03:09:37 PM
Cool! Tip sent :)

You might want to look at this project:

https://code.google.com/p/lanterna/

It could be used to create a pseudo-graphical updating list of transactions, like if you want to have your wallet running inside a screen rather than pure command line based.

If you made an installation procedure that didn't involve catting random shell scripts to a root shell, perhaps you could get it listed on bitcoin.org :)



Title: Re: TermWallet - Lightweight Command-Line Wallet using bitcoinj
Post by: Muhammed Zakir on January 09, 2015, 09:52:04 AM
Nice project! Would be good if you add GUI to it! :)

   ~~MZ~~


Title: Re: TermWallet - Lightweight Command-Line Wallet using bitcoinj
Post by: Enzyme on January 09, 2015, 10:45:14 AM
Nice! ;)

I'll try and use it on a free VPS for absolutely no reason. :D


Title: Re: TermWallet - Lightweight Command-Line Wallet using bitcoinj
Post by: adorno on January 10, 2015, 05:16:36 PM
Thanks all, I appreciate the support :-*

Cool! Tip sent :)

You might want to look at this project:

https://code.google.com/p/lanterna/

It could be used to create a pseudo-graphical updating list of transactions, like if you want to have your wallet running inside a screen rather than pure command line based.

If you made an installation procedure that didn't involve catting random shell scripts to a root shell, perhaps you could get it listed on bitcoin.org :)



Hi Mike, thanks for the tip.

I've experimented with a curses-like GUI for TermWallet before, but couldn't find an easy-to-use library for it.  Lanterna looks good though, I'll play around with it.  I've also been looking at Charva, seems interesting: http://www.pitman.co.za/projects/charva/index.html

And yes, the current installation procedure isn't the most trustworthy; currently planning to refactor some code, perhaps add a GUI, and then find a more stable release platform.  Updates to follow.


Title: Re: TermWallet - Lightweight Command-Line Wallet using bitcoinj
Post by: mistercoin on January 10, 2015, 07:07:06 PM
This is amazing. Geek heaven ;D

Any plans for expansion?


Title: Re: TermWallet - Lightweight Command-Line Wallet using bitcoinj
Post by: siameze on January 10, 2015, 07:09:10 PM
I love command-line wallets and things of that nature for bitcoin. I can't wait to check it out.  :)


EDIT: Installation was smooth, it is really nice. I love that "panic" feature.


Title: Re: TermWallet - Lightweight Command-Line Wallet using bitcoinj
Post by: adorno on January 11, 2015, 01:17:46 PM

This is amazing. Geek heaven ;D

Any plans for expansion?

:) Thanks. In the short term, I plan on cleaning up the code and adding the ability to give labels to addresses.   I am also weighing the merits of adding a command-line GUI - I don't want to get bogged down with GUI code but it looks like it's wanted.

I love command-line wallets and things of that nature for bitcoin. I can't wait to check it out.  :)


EDIT: Installation was smooth, it is really nice. I love that "panic" feature.

Good to hear installation worked. And yes, I was surprised pretty much all other wallets don't have a panic feature - hopefully more implement them.  I'm planning to focus on security and privacy in TermWallet, and any suggestions to make it better are welcome :) 

A little tip: I use the panic feature to clean up my wallet - you can send your BTCs to an address in your own wallet (just make sure you don't also delete it!)


Title: Re: TermWallet - Lightweight Command-Line Wallet using bitcoinj
Post by: siameze on January 11, 2015, 07:34:22 PM

This is amazing. Geek heaven ;D

Any plans for expansion?

:) Thanks. In the short term, I plan on cleaning up the code and adding the ability to give labels to addresses.   I am also weighing the merits of adding a command-line GUI - I don't want to get bogged down with GUI code but it looks like it's wanted.

I love command-line wallets and things of that nature for bitcoin. I can't wait to check it out.  :)


EDIT: Installation was smooth, it is really nice. I love that "panic" feature.

Good to hear installation worked. And yes, I was surprised pretty much all other wallets don't have a panic feature - hopefully more implement them.  I'm planning to focus on security and privacy in TermWallet, and any suggestions to make it better are welcome :) 

A little tip: I use the panic feature to clean up my wallet - you can send your BTCs to an address in your own wallet (just make sure you don't also delete it!)

I don't know a lot about bitcoinj but is there chance for multisig support in the future?


Title: Re: TermWallet - Lightweight Command-Line Wallet using bitcoinj
Post by: adorno on January 12, 2015, 11:41:41 PM
Just pushed an update, here's whats changed:
  • Wallet deletion in the 'panic' command is more secure; the wallet files are overwritten with random bytes before deletion.
  • Wallet decryption for transactions is handled better:  transactions now take the decryption key directly, so now the whole wallet is not decrypted and then encrypted again when a transaction is made.
  • Small usability change, if you enter a password incorrectly TermWallet doesn't exit anymore, and you can try again.

Update TermWallet by running the same command used to install, which is located in the original post.

I don't know a lot about bitcoinj but is there chance for multisig support in the future?

Yes, there is, thanks for reminding me.  I'm looking into it, hopefully I'll add basic multisig functionality soon.


Title: Re: TermWallet - Lightweight Command-Line Wallet using bitcoinj
Post by: siameze on January 13, 2015, 01:24:33 AM
Yes, there is, thanks for reminding me.  I'm looking into it, hopefully I'll add basic multisig functionality soon.

Wonderful. This is such a nice lightweight implementation. I daresay this would run on smaller platforms.


Title: Re: TermWallet - Lightweight Command-Line Wallet using bitcoinj
Post by: iphonecoins on January 14, 2015, 02:52:57 PM
Yes, there is, thanks for reminding me.  I'm looking into it, hopefully I'll add basic multisig functionality soon.

Wonderful. This is such a nice lightweight implementation. I daresay this would run on smaller platforms.


Look really nice and light. It's only for OSX or Linux?! How can I make it run on Windows?


Title: Re: TermWallet - Lightweight Command-Line Wallet
Post by: Muhammed Zakir on January 14, 2015, 03:53:34 PM
Look really nice and light. It's only for OSX or Linux?! How can I make it run on Windows?

AFAIK You will have to install dependencies for BitcoinJ and look the guide[1] for running install.sh in windows.

[1] http://stackoverflow.com/questions/16772202/how-to-run-script-sh-in-windows-git-shell

   ~~MZ~~


Title: Re: TermWallet - Lightweight Command-Line Wallet using bitcoinj
Post by: adorno on January 14, 2015, 04:31:17 PM
Yes, there is, thanks for reminding me.  I'm looking into it, hopefully I'll add basic multisig functionality soon.

Wonderful. This is such a nice lightweight implementation. I daresay this would run on smaller platforms.


Look really nice and light. It's only for OSX or Linux?! How can I make it run on Windows?

The only reason why there is no installation script currently for it is because I don't have a Windows machine. 

However, it already has the capability to run right away with the caveat that there will be no short alias for it. If you unzip 'termwallet.zip' (which you can get on the github page, link at OP), you will see 'termwallet.bat' in the folder 'termwallet-repo/bin/'.  If you run this in the windows command prompt it should run (untested by me, of course).  Let me know the results!


Title: Re: TermWallet - Lightweight Command-Line Wallet
Post by: adorno on January 18, 2015, 02:48:42 AM
Pushed a new update today. You can now restore a HD wallet with its BIP-39 mnemonic code, here is how to use it:

Code:
restore      Create a wallet based on a BIP-39 mnemonic seed
      Usage: restore [options]
        Options:
          -t, --time
             Replay blockchain starting from this time (UNIX epoch time)
             Default: 1421548754

Example:
$ termwallet restore -t 1409478661
Seed: yard impulse luxury drive today throw farm pepper survey wreck glass federal

Once run, it will prompt you for the 12-word mnemonic code and automatically restore the wallet.  The blockchain is replayed from the time parameter, which defaults to the current time.  It is in the format of UNIX Epoch time (converter here: http://www.epochconverter.com/ (http://www.epochconverter.com/)).  If addresses in the wallet have past transactions, set the time to the first transaction (or, to be safe, a little bit before).


Title: Re: TermWallet - Lightweight Command-Line Wallet
Post by: siameze on January 18, 2015, 04:02:22 AM
Pushed a new update today. You can now restore a HD wallet with its BIP-39 mnemonic code, here is how to use it:

Code:
restore      Create a wallet based on a BIP-39 mnemonic seed
      Usage: restore [options]
        Options:
          -t, --time
             Replay blockchain starting from this time (UNIX epoch time)
             Default: 1421548754

Example:
$ termwallet restore -t 1409478661
Seed: yard impulse luxury drive today throw farm pepper survey wreck glass federal

Once run, it will prompt you for the 12-word mnemonic code and automatically restore the wallet.  The blockchain is replayed from the time parameter, which defaults to the current time.  It is in the format of UNIX Epoch time (converter here: http://www.epochconverter.com/ (http://www.epochconverter.com/)).  If addresses in the wallet have past transactions, set the time to the first transaction (or, to be safe, a little bit before).

THIS IS AWESOME!!!  I love the ability to do this straight CLI. I deleted the wallet.dat and restored from seed quickly.


Title: Re: TermWallet - Lightweight Command-Line Wallet
Post by: Muhammed Zakir on January 18, 2015, 06:33:12 AM
Code:
Usage: restore [options]
        Options:
          -t, --time
             Replay blockchain starting from this time (UNIX epoch time)
             Default: 1421548754

The blockchain is replayed from the time parameter, which defaults to the current time.  It is in the format of UNIX Epoch time (converter here: http://www.epochconverter.com/ (http://www.epochconverter.com/)).  If addresses in the wallet have past transactions, set the time to the first transaction (or, to be safe, a little bit before).

Thanks! I was looking for this feature so long! Is this option also available when restoring address(es)?

   ~~MZ~~


Title: Re: TermWallet - Lightweight Command-Line Wallet
Post by: adorno on January 18, 2015, 05:54:39 PM
No new features, but just made headway in refactoring the termWallet codebase.  It is now a lot quicker to develop.  See the source code on the github page (https://github.com/grayleonard/termwallet (https://github.com/grayleonard/termwallet)).  My next planned update is adding address labels.

Thanks! I was looking for this feature so long! Is this option also available when restoring address(es)?

   ~~MZ~~

Yes, but it will be a bit more complicated to add.  However, it is an important feature, and something I've planned on adding. I will let you know how it's progressing.