Documentation changes

This commit is contained in:
philemon 2014-04-03 13:50:12 +04:00
commit ffb17f3d8c
11 changed files with 1061 additions and 0 deletions

View file

@ -0,0 +1,145 @@
MMGen = Multi-Mode GENerator
============================
##### a Bitcoin cold storage solution for the command line
Build Bitcoind on Microsoft Windows
-----------------------------------
##### Note: If during the compilation process you get "Missing Disk" pop-up error messages and have a card reader installed, you should temporarily disconnect your card reader.
##### Note: The following instructions assume you'll be unpacking all archives to `C:\`, the root directory on most Windows installations. If you choose to unpack to another location, the `cd` commands must be adjusted accordingly.
#### 1. Build OpenSSL
Note: Skip this step if you already built OpenSSL in Step 2 of [**Install MMGen
and Its Dependencies**][07].
Grab the [latest tarball][06] from the [openssl.org download page][05] and unpack
it. At the MSYS prompt, run:
$ cd /c/openssl-1.0.1f
$ ./config --openssldir=/usr
$ make
$ make install
#### 2. Build the Berkeley Database (v5.0):
Grab the [v5.0 tarball][01], or browse the [download page][02] for other
versions (avoid v4.8, which has issues with Windows; versions newer than 5.0
may work, but they're untested by the author). Unpack the archive and run
the following at the MSYS prompt:
$ cd /c/db-5.0.32/build_unix
$ ../dist/configure --enable-mingw --enable-cxx --disable-replication --prefix=/usr
Edit the source file `db.h` in the `build_unix` directory, move to line 116 and
change:
typedef pthread_t db_threadid_t;
to:
typedef u_int32_t db_threadid_t;
**Note:** since `db.h` is created by `configure`, this must be done **after**
`configure` is run.
Now run `make` and `make install`.
#### 3. Install the MASM assembler (optional but recommended):
Get the file [MASMsetup.exe][03] from the Microsoft website. With a tool
like 7zip, open the cab file inside and the file inside it, which begins with
`FL_ml_exe*`. Copy this file to your path, renaming it to `ml.exe`.
#### 4. Build the Boost libraries:
Get the boost [tarball][04] from sourceforge and unpack it. At the DOS prompt,
run:
cd \boost_1_55_0
boostrap.bat
bjam toolset=gcc link=static threading=single --build-type=minimal stage --with-system --with-filesystem --with-program_options --with-chrono --with-test
bjam toolset=gcc link=static threading=multi --build-type=minimal stage --with-thread
These commands build just the few libraries you need, saving you from the
time-consuming process of compiling the whole boost package.
#### 5. Build Bitcoind:
Download Sipa's watchonly bitcoind [zip archive][05] (commit a13f1e8 [[check][]])
from GitHub and unpack it. At the MSYS prompt, run:
$ cd /c/bitcoin-watchonly
Make the following edits to `src/leveldb/Makefile`:
> After the the statement `include build_config.mk`, add the following line:
SOURCES=$(shell echo db/*.cc util/*.cc table/*.cc)
> Change the line:
LIBOBJECTS = $(SOURCES:.cc=.o)
> to read:
LIBOBJECTS = $(SOURCES:.cc=.o) port/port_win.o
> Change the line:
all: $(SHARED) $(LIBRARY)
> to read:
all: $(LIBRARY)
Edit the following files,
src/rpcdump.cpp
src/rpcnet.cpp
src/rpcwallet.cpp
src/wallet.cpp
src/walletdb.cpp
adding the statement `#include <winsock2.h>` near the top of each file, above
the first `#include` statement.
At the MSYS prompt, run the following file-copying commands (this needs to be
done just once):
$ cp /mingw/bin/autoreconf-2.68 /mingw/bin/autoreconf
$ cp /mingw/bin/autoconf-2.68 /mingw/bin/autoconf
$ cp /mingw/bin/automake-1.11 /mingw/bin/automake
$ cp /mingw/bin/aclocal-1.11 /mingw/bin/aclocal
$ cp /bin/true.exe /bin/hexdump.exe
Generate the `configure` script:
$ sh autogen.sh
Edit the just-created `configure` script, adding the line:
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
after the line:
LIBS="$LIBS $BOOST_LIBS $BOOST_CHRONO_LIB"
From the prompt, run `configure` and `make` with the provided arguments:
$ ./configure --without-qt --with-incompatible-bdb CPPFLAGS=-I/usr/include LDFLAGS="-static -L/usr/lib -Wl,--allow-multiple-definition" BOOST_ROOT=/c/boost_1_55_0
$ make src/bitcoind.exe
Strip the executable (`strip src/bitcoind.exe`), copy it to your path and test
by running `bitcoind`. You may need to supply an argument to the `-datadir`
option so the daemon can find your wallet and configuration file.
[01]: http://download.oracle.com/berkeley-db/db-5.0.32.tar.gz
[02]: http://www.oracle.com/technetwork/database/database-technologies/berkeleydb/downloads/index-082944.html
[03]: http://www.microsoft.com/en-gb/download/details.aspx?id=12654
[04]: http://sourceforge.net/projects/boost/files/boost/1.55.0/boost_1_55_0.tar.gz/download
[05]: https://codeload.github.com/sipa/bitcoin/zip/watchonly
[06]: http://www.boost.org/users/download/
[check]: https://github.com/sipa/bitcoin/tree/watchonly
[07]: MMGenInstallDependenciesMSWin.md

16
doc/MMGenEditPathMSWin.md Normal file
View file

@ -0,0 +1,16 @@
MMGen = Multi-Mode GENerator
============================
##### a Bitcoin cold storage solution for the command line
### Editing the user path in Windows:
1. Right-click on your "My Computer" icon and select "Properties".
2. Click on the "Advanced" tab, then on the "Environment Variables" button.
3. A dialogue window will pop up. Edit the path variable in the **top** text
box, adding your entry (`c:\mingw\bin`, for example) to the end. If there
is no PATH variable listed there, create it. Path entries are separated
by semicolons in Windows, so if the PATH variable already exists and has
entries, you must separate your entry from the preceding one with a
semicolon. As a guide for the format, you may examine the **system** PATH
variable in the **bottom** text box. **Do not** edit the system PATH,
however, as this can lead to unintended consequences for your computer.

View file

@ -0,0 +1,47 @@
MMGen = Multi-Mode GENerator
============================
##### a Bitcoin cold storage solution for the command line
### Required MSYS Archives:
* [msysCORE-bin][]
* [msysCORE-doc][]
* [msysCORE-ext][]
* [libtermcap-dll][]
* [bash-bin][]
* [libiconv-dll][]
* [less-bin][]
* [make-bin][]
* [tar-bin][]
* [libregex-dll][]
* [coreutils-bin][]
* [sed-bin][]
* [grep-bin][]
* [gzip-bin][]
* [termcap-bin][]
* [gawk-bin][]
* [perl-bin][]
* [m4-bin][]
* [libcrypt-dll][]
* [libintl-dll][]
[msysCORE-bin]: http://sourceforge.net/projects/mingw/files/MSYS/Base/msys-core/msys-1.0.18-1/msysCORE-1.0.18-1-msys-1.0.18-bin.tar.lzma
[msysCORE-doc]: http://sourceforge.net/projects/mingw/files/MSYS/Base/msys-core/msys-1.0.18-1/msysCORE-1.0.18-1-msys-1.0.18-doc.tar.lzma
[msysCORE-ext]: http://sourceforge.net/projects/mingw/files/MSYS/Base/msys-core/msys-1.0.18-1/msysCORE-1.0.18-1-msys-1.0.18-ext.tar.lzma
[libtermcap-dll]: http://sourceforge.net/projects/mingw/files/MSYS/Base/termcap/termcap-0.20050421_1-2/libtermcap-0.20050421_1-2-msys-1.0.13-dll-0.tar.lzma
[bash-bin]: http://sourceforge.net/projects/mingw/files/MSYS/Base/bash/bash-3.1.17-4/bash-3.1.17-4-msys-1.0.16-bin.tar.lzma
[libiconv-dll]: http://sourceforge.net/projects/mingw/files/MSYS/Base/libiconv/libiconv-1.14-1/libiconv-1.14-1-msys-1.0.17-dll-2.tar.lzma
[less-bin]: http://sourceforge.net/projects/mingw/files/MSYS/Base/less/less-436-2/less-436-2-msys-1.0.13-bin.tar.lzma
[make-bin]: http://sourceforge.net/projects/mingw/files/MSYS/Base/make/make-3.81-3/make-3.81-3-msys-1.0.13-bin.tar.lzma
[tar-bin]: http://sourceforge.net/projects/mingw/files/MSYS/Base/tar/tar-1.23-1/tar-1.23-1-msys-1.0.13-bin.tar.lzma
[libregex-dll]: http://sourceforge.net/projects/mingw/files/MSYS/Base/regex/regex-1.20090805-2/libregex-1.20090805-2-msys-1.0.13-dll-1.tar.lzma
[coreutils-bin]: http://sourceforge.net/projects/mingw/files/MSYS/Base/coreutils/coreutils-5.97-3/coreutils-5.97-3-msys-1.0.13-bin.tar.lzma
[sed-bin]: http://sourceforge.net/projects/mingw/files/MSYS/Base/sed/sed-4.2.1-2/sed-4.2.1-2-msys-1.0.13-bin.tar.lzma
[grep-bin]: http://sourceforge.net/projects/mingw/files/MSYS/Base/grep/grep-2.5.4-2/grep-2.5.4-2-msys-1.0.13-bin.tar.lzma
[gzip-bin]: http://sourceforge.net/projects/mingw/files/MSYS/Base/gzip/gzip-1.3.12-2/gzip-1.3.12-2-msys-1.0.13-bin.tar.lzma
[termcap-bin]: http://sourceforge.net/projects/mingw/files/MSYS/Base/termcap/termcap-0.20050421_1-2/termcap-0.20050421_1-2-msys-1.0.13-bin.tar.lzma
[gawk-bin]: http://sourceforge.net/projects/mingw/files/MSYS/Base/gawk/gawk-3.1.7-2/gawk-3.1.7-2-msys-1.0.13-bin.tar.lzma
[perl-bin]: http://sourceforge.net/projects/mingw/files/MSYS/Extension/perl/perl-5.8.8-1/perl-5.8.8-1-msys-1.0.17-bin.tar.lzma
[m4-bin]: http://sourceforge.net/projects/mingw/files/MSYS/Extension/m4/m4-1.4.16-2/m4-1.4.16-2-msys-1.0.17-bin.tar.lzma
[libcrypt-dll]: http://sourceforge.net/projects/mingw/files/MSYS/Extension/crypt/crypt-1.1_1-3/libcrypt-1.1_1-3-msys-1.0.13-dll-0.tar.lzma
[libintl-dll]: http://sourceforge.net/projects/mingw/files/MSYS/Base/gettext/gettext-0.18.1.1-1/libintl-0.18.1.1-1-msys-1.0.17-dll-8.tar.lzma

View file

@ -0,0 +1,67 @@
MMGen = Multi-Mode GENerator
============================
##### a Bitcoin cold storage solution for the command line
### Required MinGW Archives:
* [bsdtar][]
* [gcc-core-bin][]
* [gcc-core-dev][]
* [gcc-core-dll][]
* [gcc-c++-bin][]
* [gcc-c++-dev][]
* [gcc-c++-dll][]
* [binutils-bin][]
* [binutils-dev][]
* [gettext-dev][]
* [gettext-dll][]
* [libintl-dll][]
* [gmp-dev][]
* [gmp-dll][]
* [libiconv-dev][]
* [libiconv-dll][]
* [mingwrt-dev][]
* [mingwrt-dll][]
* [mpc-dev][]
* [mpc-dll][]
* [mpfr-dev][]
* [mpfr-dll][]
* [pthreads-w32-dev][]
* [pthreads-w32-dll][]
* [w32api-dev][]
* [zlib-dev][]
* [zlib-dll][]
* [gettext-bin][]
* [autoconf2.5-bin][]
* [automake1.11-bin][]
[bsdtar]: http://sourceforge.net/projects/mingw/files/MinGW/Extension/bsdtar/basic-bsdtar-2.8.3-1/basic-bsdtar-2.8.3-1-mingw32-bin.zip
[gcc-core-bin]: http://sourceforge.net/projects/mingw/files/MinGW/Base/gcc/Version4/gcc-4.8.1-4/gcc-core-4.8.1-4-mingw32-bin.tar.lzma
[gcc-core-dev]: http://sourceforge.net/projects/mingw/files/MinGW/Base/gcc/Version4/gcc-4.8.1-4/gcc-core-4.8.1-4-mingw32-dev.tar.lzma
[gcc-core-dll]: http://sourceforge.net/projects/mingw/files/MinGW/Base/gcc/Version4/gcc-4.8.1-4/gcc-core-4.8.1-4-mingw32-dll.tar.lzma
[gcc-c++-bin]: http://sourceforge.net/projects/mingw/files/MinGW/Base/gcc/Version4/gcc-4.8.1-4/gcc-c++-4.8.1-4-mingw32-bin.tar.lzma
[gcc-c++-dev]: http://sourceforge.net/projects/mingw/files/MinGW/Base/gcc/Version4/gcc-4.8.1-4/gcc-c++-4.8.1-4-mingw32-dev.tar.lzma
[gcc-c++-dll]: http://sourceforge.net/projects/mingw/files/MinGW/Base/gcc/Version4/gcc-4.8.1-4/gcc-c++-4.8.1-4-mingw32-dll.tar.lzma
[binutils-bin]: http://sourceforge.net/projects/mingw/files/MinGW/Base/binutils/binutils-2.24/binutils-2.24-1-mingw32-bin.tar.xz
[binutils-dev]: http://sourceforge.net/projects/mingw/files/MinGW/Base/binutils/binutils-2.24/binutils-2.24-1-mingw32-dev.tar.xz
[gettext-dev]: http://sourceforge.net/projects/mingw/files/MinGW/Base/gettext/gettext-0.18.3.1-1/gettext-0.18.3.1-1-mingw32-dev.tar.lzma
[gettext-dll]: http://sourceforge.net/projects/mingw/files/MinGW/Base/gettext/gettext-0.18.3.1-1/gettext-0.18.3.1-1-mingw32-dll.tar.lzma
[libintl-dll]: http://sourceforge.net/projects/mingw/files/MinGW/Base/gettext/gettext-0.18.1.1-2/libintl-0.18.1.1-2-mingw32-dll-8.tar.lzma
[gmp-dev]: http://sourceforge.net/projects/mingw/files/MinGW/Base/gmp/gmp-5.1.2/gmp-5.1.2-1-mingw32-dev.tar.lzma
[gmp-dll]: http://sourceforge.net/projects/mingw/files/MinGW/Base/gmp/gmp-5.1.2/gmp-5.1.2-1-mingw32-dll.tar.lzma
[libiconv-dev]: http://sourceforge.net/projects/mingw/files/MinGW/Base/libiconv/libiconv-1.14-3/libiconv-1.14-3-mingw32-dev.tar.lzma
[libiconv-dll]: http://sourceforge.net/projects/mingw/files/MinGW/Base/libiconv/libiconv-1.14-3/libiconv-1.14-3-mingw32-dll.tar.lzma
[mingwrt-dev]: http://sourceforge.net/projects/mingw/files/MinGW/Base/mingw-rt/mingwrt-4.0.3/mingwrt-4.0.3-1-mingw32-dev.tar.lzma
[mingwrt-dll]: http://sourceforge.net/projects/mingw/files/MinGW/Base/mingw-rt/mingwrt-4.0.3/mingwrt-4.0.3-1-mingw32-dll.tar.lzma
[mpc-dev]: http://sourceforge.net/projects/mingw/files/MinGW/Base/mpc/mpc-1.0.1-2/mpc-1.0.1-2-mingw32-dev.tar.lzma
[mpc-dll]: http://sourceforge.net/projects/mingw/files/MinGW/Base/mpc/mpc-1.0.1-2/mpc-1.0.1-2-mingw32-dll.tar.lzma
[mpfr-dev]: http://sourceforge.net/projects/mingw/files/MinGW/Base/mpfr/mpfr-3.1.2-2/mpfr-3.1.2-2-mingw32-dev.tar.lzma
[mpfr-dll]: http://sourceforge.net/projects/mingw/files/MinGW/Base/mpfr/mpfr-3.1.2-2/mpfr-3.1.2-2-mingw32-dll.tar.lzma
[pthreads-w32-dev]: http://sourceforge.net/projects/mingw/files/MinGW/Base/pthreads-w32/pthreads-w32-2.9.1/pthreads-w32-2.9.1-1-mingw32-dev.tar.lzma
[pthreads-w32-dll]: http://sourceforge.net/projects/mingw/files/MinGW/Base/pthreads-w32/pthreads-w32-2.9.1/pthreads-w32-2.9.1-1-mingw32-dll.tar.lzma
[w32api-dev]: http://sourceforge.net/projects/mingw/files/MinGW/Base/w32api/w32api-4.0.3/w32api-4.0.3-1-mingw32-dev.tar.lzma
[zlib-dev]: http://sourceforge.net/projects/mingw/files/MinGW/Base/zlib/zlib-1.2.8/zlib-1.2.8-1-mingw32-dev.tar.lzma
[zlib-dll]: http://sourceforge.net/projects/mingw/files/MinGW/Base/zlib/zlib-1.2.8/zlib-1.2.8-1-mingw32-dll.tar.lzma
[gettext-bin]: http://sourceforge.net/projects/mingw/files/MinGW/Base/gettext/gettext-0.18.3.1-1/gettext-0.18.3.1-1-mingw32-bin.tar.lzma
[autoconf2.5-bin]: http://sourceforge.net/projects/mingw/files/MinGW/Extension/autoconf/autoconf2.5/autoconf2.5-2.68-1/autoconf2.5-2.68-1-mingw32-bin.tar.lzma
[automake1.11-bin]: http://sourceforge.net/projects/mingw/files/MinGW/Extension/automake/automake1.11/automake1.11-1.11.1-1/automake1.11-1.11.1-1-mingw32-bin.tar.lzma

395
doc/MMGenGettingStarted.md Normal file
View file

@ -0,0 +1,395 @@
MMGen = Multi-Mode GENerator
============================
##### a Bitcoin cold storage solution for the command line
Getting Started with MMGen
--------------------------
#### 1. Generate a wallet (offline computer):
On your offline computer, generate a wallet with a random seed:
$ mmgen-walletgen
...
Wallet saved to file '89ABCDEF-76543210[256,3].mmdat'
"89ABCDEF" is the Seed ID; "76543210" is the Key ID. These are randomly
generated, so your IDs will of course be different than the fictitious ones used
here.
The Seed ID never changes and will be used to identify all keys/addresses
generated by this seed. The Key ID changes when the wallet's password or hash
preset are changed.
"256" is the seed length; "3" is the scrypt hash preset. These values are
configurable: type `mmgen-walletgen --help` for details.
#### 2. Generate addresses (offline computer):
Now generate ten addresses with your just-created wallet:
$ mmgen-addrgen 89ABCDEF-76543210[256,3].mmdat 1-10
...
Address data saved to file '89ABCDEF[1-10].addrs'
$ cat '89ABCDEF[1-10].addrs'
89ABCDEF {
1 16bNmyYISiptuvJG3X7MPwiiS4HYvD7ksE
2 1AmkUxrfy5dMrfmeYwTxLxfIswUCcpeysc
3 1HgYCsfqYzIg7LVVfDTp7gYJocJEiDAy6N
4 14Tu3z1tiexXDonNsFIkvzqutE5E3pTK8s
5 1PeI55vtp2bX2uKDkAAR2c6ekHNYe4Hcq7
6 1FEqfEsSILwXPfMvVvVuUovzTaaST62Mnf
7 1LTTzuhMqPLwQ4IGCwwugny6ZMtUQJSJ1
8 1F9495H8EJLb54wirgZkVgI47SP7M2RQWv
9 1JbrCyt7BdxRE9GX1N7GiEct8UnIjPmpYd
10 1H7vVTk4ejUbQXw45I6g5qvPBSe9bsjDqh
}
Note that the address range, "1-10", is reflected in the resulting filename.
MMGen addresses are identified by their seed ID and index number, separated by a
colon. In this example, "89ABCDEF:1" is the MMGen equivalent of Bitcoin address
16bNmyYISiptuvJG3X7MPwiiS4HYvD7ksE, "89ABCDEF:2" the equivalent of
1AmkUxrfy5dMrfmeYwTxLxfIswUCcpeysc, and so forth.
Let's say you've decided to transfer some BTC into the first four addresses
above. Your first step, then, will be to import these addresses into the
tracking wallet on your online machine so their balances will be visible.
For convenient identification, you've chosen to provide the addresses with the
labels "Donations", "Storage 1", "Storage 2" and "Storage 3".
Make a copy of the file:
$ cp '89ABCDEF[1-10].addrs' my_addrs
and edit the copy using your favorite text editor to look like this:
$ cat my_addrs
# My first MMGen addresses
89ABCDEF {
1 16bNmyYISiptuvJG3X7MPwiiS4HYvD7ksE Donations
2 1AmkUxrfy5dMrfmeYwTxLxfIswUCcpeysc Storage 1
3 1HgYCsfqYzIg7LVVfDTp7gYJocJEiDAy6N Storage 2
4 14Tu3z1tiexXDonNsFIkvzqutE5E3pTK8s Storage 3
}
Note the comment beginning with a '#' symbol. Comments may be placed at the
ends of lines as well. Note also that rows in the list may be arranged in any
order: addresses need not be consecutive.
Copy this file onto a USB stick and transfer it to your online computer.
#### 3. Import addresses (online computer):
On your online computer, start bitcoind and import the addresses into the
tracking wallet with the command:
$ mmgen-addrimport my_addrs
These addresses will now be tracked by bitcoind. Any BTC transferred to them
will show up in your listing of unspent outputs.
If you have any existing addresses with balances, you'll want to track them too.
Make a plain list of these addresses, one address per line, and import the list
into the tracking wallet using `mmgen-addrimport -l`.
$ mmgen-addrimport -l my_existing_addrs_with_balances
Since the importing process is slow, you may want to do it in stages, a few
addresses at a time.
Continue in this fashion until you've imported all addresses with balances into
your tracking wallet.
#### 4. Create a transaction (online computer):
Now that your existing addresses are imported, you're ready to create a test
transaction using the `mmgen-txcreate` command. Note that transactions are
harmless until they're signed and broadcast to the network, so feel free to
experiment with different transactions using different combinations of inputs
and outputs.
First of all you'll want to examine your balances:
$ mmgen-txcreate -i
A list of all your unspent outputs will appear, along with a menu allowing you
to sort the outputs by four criteria: transaction ID, address, amount and
transaction age. Your overall balance in BTC appears at the top of the screen.
The list may be viewed in a pager or printed to file. If you have ten unspent
outputs, your display will look something like this:
UNSPENT OUTPUTS (sort order: reverse amount) Total BTC: 39.72
Num TX id Vout Address Amount (BTC) Age(days)
1) 04f97185... 2 1F93Znz8PI5Pnvv8ZAJsb74EzKpmRMLFbk 10 320
2) dd900544... 1 194Fceqx86jqIWumphUmfVyFMjAAbMLcSE 9.9287435 7
3) 7ec81a8f... 0 1FhIkRabPSZhhUsA6qvukmfK4T4PZLbC4M 7.26 17
4) 64094b55... 0 16JSUJdGMbxUBEQatAR5sGE89tbSIsLHqg 3.15 140
5) fd687c65... 1 1QKAtU66aUntCBx9m6TfEIf3gQuCNWCVDY 3.15 140
6) 9a8f20e2... 1 1FMNDFz1yUywjJSprjvYY9t1yxkE8GGIwT 3.15 140
7) 03a7c51a... 3 1svxnSdKVIcMs6qWYA7qLzA29orXbzXUm 1.6382466 54
8) 9955f06c... 2 18nWPLQGUzI7X1Rcm4zmVV6Z3xhokdYx9G 1.2 27
9) 8a4ab4f5... 0 13S9HNu7PQn1aJ4qILfhqRSakXwvSTnbwJ 0.23033 3
10) 5bfe5621... 1 1FV1Lhs6Dnc9gMxjJTo6h4nTeIjJbQ1PgV 0.01 42
Sort options: [t]xid, [a]mount, a[d]dress, [A]ge, [r]everse, [M]mgen addr
View options: [g]roup, show [m]mgen addr
(Type 'q' to quit sorting, 'p' to print to file, 'v' to view in pager):
Now let's actually create a transaction. Let's say you've decided to gradually
begin moving your 39.72 BTC balance into your shiny new MMGen wallet with seed
ID 89ABCDEF.
Before moving any funds into your MMGen wallet, you should back it up in several
places and possibly on several media too: paper, flash memory or CD-ROM, for
example. Of course the wallet should have a passphrase. Otherwise, anyone who
gains physical access to one of your backups can easily steal your coins.
Recall that there's no limit to the number of addresses you can generate with
your seed. You've wisely determined that having many addresses with relatively
small balances is a Good Idea. So you've decided to begin by breaking up the
address with the largest balance, 10 BTC, into three roughly equal parts,
sending it to the addresses labeled "Storage 1", "Storage 2" and "Storage 3"
(89ABCDEF:2, 89ABCDEF:3 and 89ABCDEF:4).
To refresh your memory, here are the three addresses in question:
$ cat my_addrs
# My first MMGen addresses
89ABCDEF {
1 16bNmyYISiptuvJG3X7MPwiiS4HYvD7ksE Donations
2 1AmkUxrfy5dMrfmeYwTxLxfIswUCcpeysc Storage 1
3 1HgYCsfqYzIg7LVVfDTp7gYJocJEiDAy6N Storage 2
4 14Tu3z1tiexXDonNsFIkvzqutE5E3pTK8s Storage 3
}
The following command will send 3.3 BTC to the first two addresses and the
remainder of the transaction's 10 BTC input to the third, subtracting a default
transaction fee of 0.001 BTC:
$ mmgen-txcreate 1AmkUxrfy5dMrfmeYwTxLxfIswUCcpeysc,3.3 1HgYCsfqYzIg7LVVfDTp7gYJocJEiDAy6N,3.3 14Tu3z1tiexXDonNsFIkvzqutE5E3pTK8s
The bare address with no amount is the **change address**. MMGen will compute
the change amount (3.399 BTC in this case) automatically.
Alternatively, and more conveniently, you can list your three addresses in MMGen
format:
$ mmgen-txcreate -a my_addrs 89ABCDEF:2,3.3 89ABCDEF:3,3.3 89ABCDEF:4
Note that an MMGen address file containing the requested output addresses must
be provided on the command line. In this example, the extra address in the file
is ignored.
Now hit ENTER, choose the transaction's input from the list (10 BTC, address
1F9495H8EJL..., txid 04f97185...,2), and confirm. If all goes well,
`mmgen-txcreate` will exit with the message:
Transaction data saved to file 'tx_1EDCBA[6.6].raw'
Note that the transaction has a unique ID, and the non-change output amount, 6.6
BTC, is conveniently included in the filename.
#### 5. Sign the transaction (offline computer):
Now copy the raw transaction you've just created to a USB stick and transfer it
to your offline computer for signing. You need to find the key for your
transaction's one input address, 1F9495H8EJL.... If the key in question is in a
bitcoin 'wallet.dat', there's an included command (a modified version of the
well-known pywallet utility) that will conveniently extract it for you:
$ mmgen-pywallet -k wallet.dat
...
wallet.dat secret keys saved to file wd_EDBC983A[102].keys
You've in fact extracted a list of all of the wallet's 102 keys here, but that's
not a problem, since the unused keys will be ignored. Now go ahead and sign the
transaction using this list of keys.
$ mmgen-txsign -k wd_EDBC983A[102].keys tx_1EDCBA[6.6].raw
...
Signed transaction saved to file tx_1EDCBA[6.6].sig
Note that mmgen-pywallet's output is just a flat list of keys. So if you have
several Bitcoin wallets with balances, you can just dump all their keys and
merge them into a single file which you can use to sign all future transactions
with wallet.dat inputs:
$ mmgen-pywallet -k wallet1.dat
$ mmgen-pywallet -k wallet2.dat
$ mmgen-pywallet -k wallet3.dat
$ cat wd_*.keys > all_keys
For your future transactions with MMGen address inputs, you'll list the MMGen
seed source (wallet, mnemonic or seed file) on the command line after the
transaction file, and the required keys will be generated automatically:
$ mmgen-txsign tx_9D2C3A[1.23].raw B73B58EA-125FB230[256,3].mmdat
Transactions may contain a mixture of MMGen and non-MMGen inputs as well as
inputs with more than one MMGen seed ID. Just provide a seed source for each
seed ID on the command line.
Eventually, when you've placed all your BTC under MMGen control, you'll never
have deal with keys directly again, because MMGen generates all keys on the fly
using the seed.
#### 6. Send the transaction (online computer):
Now you're ready for the final step: broadcasting the transaction to the network.
Copy the `*.sig` file to your online computer, start bitcoind, if it's not
running, and execute the command:
$ mmgen-txsend tx_1EDCBA[6.6].sig
Like all mmgen commands, `mmgen-txsend` is interactive, so you'll be asked for
confirmation before the transaction is actually sent.
Once the transaction's confirmed by the network, your three new MMGen addresses
will appear on the listing of `mmgen-txcreate -i`. Type 'm' at the menu to
see them displayed in MMGen format.
Congratulations! You've performed your first MMGen transaction.
### Additional Features
#### Using the mnemonic and seed features:
Continuing our example above, generate a mnemonic from the wallet:
$ mmgen-walletchk -m '89ABCDEF-76543210[256,3].mmdat'
...
Mnemonic data saved to file '89ABCDEF.mmwords'
$ cat 89ABCDEF.mmwords
pleasure tumble spider laughter many stumble secret bother after search
float absent path strong curtain savior worst suspend bright touch away
dirty measure thorn
Note: a 128- or 192-bit seed will generate a shorter mnemonic of 12 or 18
words. You may generate a wallet with a these seed lengths using the `'-l'`
option to `mmgen-walletgen`.
Though some consider 128 bits of entropy to provide adequate security for the
foreseeable future, you should stick to the default 256-bit seed length if
you're not planning to use the mnemonic feature.
NOTE: MMGen mnemonics are generated from the Electrum wordlist, only using
ordinary base conversion instead of Electrum's more complicated algorithm.
Generate addresses 1-11 using the mnemonic instead of the wallet:
$ mmgen-addrgen 89ABCDEF.mmwords 1-11
...
Address data saved to file '89ABCDEF[1-11].addrs'
Compare the first ten addresses with those earlier generated by the wallet.
You'll see they're the same.
Recover a lost wallet using the mnemonic:
$ mmgen-walletgen 89ABCDEF.mmwords
...
Wallet saved to file '89ABCDEF-01234567[256,3].mmdat'
Note that the regenerated wallet has a different Key ID but of course the same
Seed ID.
Seed files bear the extension `*.mmseed` and are listed on the command line the
same way mnemonic files are.
A seed file for a 256-bit seed looks like this:
$ cat 8B7392ED.mmseed
f4c84b C5ZT wWpT Jsoi wRVw 2dm9 Aftd WLb8 FggQ eC8h Szjd da9L
And for a 128-bit seed:
$ cat 8E0DFB78.mmseed
0fe02f XnyC NfPH piuW dQ2d nM47 VU
As you can see, the latter file is short enough to be memorized. From the unix
command line, you can test your memory using the seed's checksum ("0fe02f" in
this example) as follows:
$ echo -n XnyCNfPHpiuWdQ2dnM47VU | sha256sum | cut -c 1-6
0fe02f
#### Mnemonics and seeds — additional information:
With the `'-m'` or `'-s'` option, MMGen commands that take mnemonic and seed
data may receive the data from a prompt instead of a file.
MMGen commands that produce mnemonic and seed data may be forced to print it to
standard output instead of file with the `'-S'` option. This feature has
intentionally been made optional to safeguard against looking-over-the-shoulder,
Van Eyck phreaking and other side-channel attacks. MMGen commands never print
private data to the screen unless explicitly asked to.
The output file of any MMGen command may be written to a directory of your
choice using the `'-d'` option. For example, on a Linux system you could use
`'-d /dev/shm'` to write key and seed data to volatile memory instead of disk.
This also has obvious security benefits, ensuring that no sensitive data
remains on disk after your computer's been powered down.
### Test suite:
The test suite can be run from within the MMGen source directory. You might
find the following tests to be of interest:
#### Bitcoin module:
> Show available tests:
mmgen/tests/bitcoin.py
> Compare 10 addresses generated by 'keyconv' with mmgen's internally-generated
> ones:
mmgen/tests/bitcoin.py keyconv_compare_randloop 10
> Convert a string to base 58 and back:
mmgen/tests/bitcoin.py strtob58 'a string'
> Convert a hex number to base 58 and back:
mmgen/tests/bitcoin.py hextob58 deadbeef
> Perform 1000 hex -> base58 -> hex conversions, comparing results stringwise:
mmgen/tests/bitcoin.py hextob58_pad_randloop 1000
#### Mnemonic module:
> Show available tests:
mmgen/tests/mnemonic.py
> Generate a 12-word mnemonic from a random 128-bit seed:
mmgen/tests/mnemonic.py random128
>> or an 18-word mnemonic from a random 192-bit seed:
mmgen/tests/mnemonic.py random192
>> or a 24-word mnemonic from a random 256-bit seed:
mmgen/tests/mnemonic.py random256
> Show statistics for the Electrum wordlist:
mmgen/tests/mnemonic.py electrum
> Print the Electrum wordlist:
mmgen/tests/mnemonic.py electrum_print
> Show statistics for the Tirosh wordlist:
mmgen/tests/mnemonic.py tirosh
> Print the Tirosh wordlist:
mmgen/tests/mnemonic.py tirosh_print

View file

@ -0,0 +1,116 @@
MMGen = Multi-Mode GENerator
============================
##### a Bitcoin cold storage solution for the command line
Install MMGen and Its Dependencies on Microsoft Windows
-------------------------------------------------------
##### Note: The following instructions assume you'll be unpacking all archives to `C:\`, the root directory on most Windows installations. If you choose to unpack to another location, the `cd` commands must be adjusted accordingly.
#### 1. Install the Python interpreter:
Grab the [Windows 32-bit installer][09] and run it, accepting the defaults.
Add the Python base and Scripts directories to your [path][08], e.g.
`C:\Python27;C:\Python27\Scripts`.
#### 2. Build OpenSSL:
Grab the [latest tarball][06] from the [openssl.org download page][05] and unpack
it. At the MSYS prompt, run:
$ cd /c/openssl-1.0.1f
$ ./config --openssldir=/usr
$ make
$ make install
#### 3. Build the Scrypt Python module:
Grab the [latest tarball][07] from python.org and unpack it. At the MSYS prompt,
run:
$ cd /c/scrypt-0.6.1
Open `setup.py` in your text editor and make the following changes:
> Change the line:
library_dirs = ['c:\OpenSSL-Win32\lib\MinGW']
> to read:
library_dirs = ['c:\msys\lib','c:\WINDOWS\system32']
> Change the line:
includes = ['c:\OpenSSL-Win32\include']
> to read:
includes = ['c:\msys\include']
Save the file. At the MSYS prompt, run:
$ python setup.py build --compiler=mingw32
Ignore the warning messages at the end and run:
$ python setup.py install
#### 4. Install the Pycrypto Python module:
Source code is available from the [Pycrypto home page][00], but it appears to
build only with MS Visual Studio, not MinGW. Until this situation is fixed,
you can install the precompiled binaries available from [Voidspace][01].
Download and run the [Windows installer][02], accepting the defaults.
#### 5. Install the ecdsa Python module:
Grab the [tarball][03] and unpack it. At the MSYS prompt, run:
$ cd /c/ecdsa-0.11
$ python setup.py install
#### 6. Install the bitcoin-python Python module:
Grab the [tarball][04] and unpack it. At the MSYS prompt, run:
$ cd /c/bitcoin-python-0.3
$ cp -a src/bitcoinrpc /c/Python27/Lib/site-packages
This is a workaround for a dependency issue with the package's setup script.
If your Python is installed in a different location, you'll have to adjust the
destination path accordingly.
#### 7. Install MMGen:
Get the [zip archive][10] from GitHub and unpack it. At the MSYS prompt, run:
$ cd /c/mmgen-master
$ sudo ./setup.py install
Type:
$ echo $PATH
The `C:\Python27;C:\Python27\Scripts` you added to your path in Step 1 of this
page should be included in your PATH variable. If not, then exit MSYS and open
a new MSYS window to update your path.
The MMGen commands beginning with `mmgen-` will now be available (type
`mmgen-<TAB>` to test) and you may begin experimenting with MMGen as described
in the first two steps of [Getting Started with MMGen][13].
[00]: https://www.dlitz.net/software/pycrypto/
[01]: http://www.voidspace.org.uk/python/modules.shtml#pycrypto
[02]: http://www.voidspace.org.uk/downloads/pycrypto26/pycrypto-2.6.win32-py2.7.exe)
[03]: https://pypi.python.org/pypi/ecdsa
[04]: https://pypi.python.org/pypi/bitcoin-python/0.3
[09]: https://www.python.org/ftp/python/2.7.6/python-2.7.6.msi
[08]: MMGenEditPathMSWin.md
[07]: https://pypi.python.org/pypi/scrypt/
[06]: http://www.openssl.org/source/openssl-1.0.1f.tar.gz
[05]: http://www.openssl.org/source/
[10]: https://github.com/mmgen/mmgen/archive/master.zip
[11]: http://slproweb.com/download/Win32OpenSSL-1_0_1f.exe
[12]: http://www.openssl.org/related/binaries.html
[13]: MMGenGettingStarted.md

79
doc/MMGenInstallLinux.md Normal file
View file

@ -0,0 +1,79 @@
MMGen = Multi-Mode GENerator
============================
##### a Bitcoin cold storage solution for the command line
Install MMGen on Debian/Ubuntu Linux
------------------------------------
**Perform the following steps on both your online and offline computers:**
Install the pip Python installer:
$ sudo apt-get install python-pip
Install required Python modules:
$ sudo pip install ecdsa scrypt pycrypto bitcoin-python
Install MMGen:
$ git clone https://github.com/mmgen/mmgen.git
$ cd mmgen; sudo ./setup.py install
Install vanitygen (optional but recommended):
$ git clone https://github.com/samr7/vanitygen.git
(build and put the "keyconv" executable in your path)
At this point you can begin trying out MMgen, creating a test wallet and
generating keys as described in **Using MMGen** below. To be able to track
addresses and create and sign transactions, however, you'll need to have
bitcoin daemons installed on your online and offline machines.
#### Install the offline bitcoind:
Instructions [here][01].
#### Install the online bitcoind:
The bitcoin daemon on the **online machine**, a.k.a. the "watch-only" bitcoind,
is used for tracking addresses and requires the full blockchain. For this, a
more powerful computer is desirable. In particular, importing addresses is
especially CPU-intensive. You'll also need plenty of free disk space for the
rapidly-growing blockchain (~20GB at the time of writing).
The standard bitcoin daemon at present lacks the watch-only address support we
need, so you'll have to get and compile a patched version by Bitcoin core
developer Pieter Wuille, aka Sipa. Fortunately, it builds out of the box
when the proper dependencies are installed.
The boost development packages are the dependencies you're most likely to be
missing. Check that the following are on your system (package names may vary;
the version should be 1.48 or greater):
libboost-system-dev
libboost-filesystem-dev
libboost-program-options-dev
libboost-chrono-dev
libboost-test-dev
libboost-thread-dev
Download the bitcoin-watchonly [zip archive][00] (commit a13f1e8 [[check][]])
from GitHub, configure, and build:
$ unzip watchonly.zip
$ cd bitcoin-watchonly
$ ./autogen.sh
$ ./configure (add --with-incompatible-bdb if libdb version > 4.8)
$ make -j4 src/bitcoind
With your online machine connected to the Internet, start the freshly compiled
daemon and let it synchronize the blockchain, taking care to **move any
existing wallet.dat out of harm's way** beforehand. You'll use the new wallet
created by the daemon upon startup as your **tracking wallet**.
Congratulations! Your MMGen installation is now complete.
[00]: https://codeload.github.com/sipa/bitcoin/zip/watchonly
[01]: MMGenInstallOfflineBitcoind.md
[check]: https://github.com/sipa/bitcoin/tree/watchonly

57
doc/MMGenInstallMSWin.md Normal file
View file

@ -0,0 +1,57 @@
MMGen = Multi-Mode GENerator
============================
##### a Bitcoin cold storage solution for the command line
Install on Microsoft Windows
----------------------------
Installing MMGen on Windows can be divided into four steps:
1. [Install MinGW and MSYS][01], if you haven't already;
2. [Install MMGen's dependencies (excluding the bitcoin daemons) and
MMGen itself][02];
3. [Install the offline bitcoin daemon (bitcoind)][07]; and
4. [Build the online "watch-only" bitcoin daemon][03].
Steps 1 and 2 are somewhat lengthy but straightforward. You may proceed
directly to them by following the links above and then returning to this page.
If you've finished step 2, then you may pause the installation process if you
wish and begin exploring some of MMGen's features as described in [**Getting
Started with MMGen**][08]. To be able to track addresses and create
transactions, however, you must install the bitcoin daemons on your online and
offline machines as described in steps 3 and 4.
The bitcoind on the **offline machine** is used solely to sign transactions and
runs without a blockchain. Therefore, it will run just fine even on a
low-powered computer such as a netbook. Installing it is easy. Just follow the
link on item 3 above.
The **online machine** uses a custom "watch-only" bitcoin daemon to import and
track addresses and maintain the complete blockchain. These are CPU-intensive
tasks which require a more powerful computer. You'll also need plenty of free
disk space for the rapidly growing blockchain (~20GB at the time of writing).
The watch-only bitcoind is still new and hasn't yet been included in the stock
Bitcoin distribution. Therefore, it must be compiled from source code. On
Windows, this process involves some additional work: compiling and installing
libraries on which bitcoind depends and making some simple edits to source code
and configuration files.
Detailed, step-by-step instructions for installing and building each component
and dependency have been provided to make this process go as smoothly as
possible. The instructions have been thoroughly tested on the author's build
machine running 32-bit Windows XP. The target computer is not required to have
an Internet connection.
Be advised that compiling bitcoind on Windows requires some time and patience.
If you're ready to proceed, first read [**A word on text editors**][09] and
install a text editor if you haven't yet done so; then follow the link on item 4
above to begin the build process.
[01]: MMGenInstallMinGW_MSYS.md
[02]: MMGenInstallDependenciesMSWin.md
[03]: MMGenBuildBitcoindMSWin.md
[07]: MMGenInstallOfflineBitcoind.md
[08]: MMGenGettingStarted.md
[09]: MMGenTextEditors.md

View file

@ -0,0 +1,89 @@
MMGen = Multi-Mode GENerator
============================
##### a Bitcoin cold storage solution for the command line
Install MinGW and MSYS on Microsoft Windows
-------------------------------------------
MinGW (Minimal GNU for Windows) provides the gcc compiler and related tools for
compiling source code into Windows binaries. MSYS provides a Unix-like
environment with basic Unix shell commands. MinGW and MSYS are part of the
same project and are designed to be used together.
Complete hypertexed lists of the required MinGW and MSYS archive files are
provided below for convenient downloading. Save the archives into two separate
temporary directories (`mingw` and `msys`, for example).
* [MinGW archive list][02]
* [MSYS archive list][03]
##### Note: these lists were up to date at the time of writing (April 2014). More recent versions may be available in the [MinGW repository][01] as you read this, but hunting for them isn't likely to be worth your time.
Unpack the basic-bsdtar archive (in the MinGW archives) and copy the executable
`basic-bsdtar.exe` to your path (e.g. `C:\WINDOWS\system32`).
From the DOS prompt, run `mkdir C:\mingw` to create the directory `C:\mingw`.
Run `cd C:\mingw` to move to the directory. Unpack each of the MinGW archives
(except for `basic-bsdtar`) as follows:
basic-bsdtar -xf <path to archive>
Create a `C:\msys` directory the same way, move to it and repeat the above
unpacking procedure with the MSYS archives.
Add `C:\mingw\bin` to your user path. Consult [this page][05] for instructions
on editing your user path.
Close the command prompt window and open a new one. Launch the MSYS shell with
the command `C:\msys\bin\bash.exe --login`. You'll now be in the home
directory of your MSYS environment.
If you want be able to launch MSYS from an icon instead of typing the above
command all the time, then do the following: Make a copy of the "Command Line"
icon on your desktop and rename it to "MSYS". Right click on the icon, select
"Properties" and change the highlighted command path to `C:\msys\bin\bash.exe
--login`. You may also want to change the "Home Folder" field to your MSYS home
directory, `C:\msys\home\Admin` for the Admin user.
Note: At this point you're advised to read [**A word on text editors**][00]
before proceeding further with your installation.
Run the command `mount c:/mingw /mingw` to include your MinGW installation in
the MSYS tree. So you won't have to run this command every time you log in to
MSYS, open the file `/etc/fstab` in your text editor and add the line `c:/mingw
/mingw` (if it's not already there).
#### Unix commands and environment:
If you're new to Unix, you should learn a few key commands:
* `ls` - view directory contents (`ls -l` for a long view)
* `rm` - remove files (`rm -r` to remove entire directory trees)
* `rmdir` - remove an empty directory
* `cp` - copy a file (`cp -a` to copy directory trees)
* `mv` - move a file or directory
* `cat` - output a file to screen
* `less` - view a file page-by-page, with scrollback
Command help texts can be accessed with the `--help` switch. The MSYS root
directory is `/`. Drive letter `C:` can be accessed as `/c/`.
Environmental variables may be viewed with the `env` command. Individual
variables may be displayed like this:
$ echo $PATH
and set like this:
$ set PATH=$PATH:/home/Admin/bin
Sometimes variables must be exported to be visible to called programs:
$ export PATH
[00]: MMGenTextEditors.md
[01]: http://sourceforge.net/projects/mingw/files/
[02]: MMGenGetMinGW_Archives.md
[03]: MMGenGetMSYS_Archives.md
[05]: MMGenEditPathMSWin.md

View file

@ -0,0 +1,22 @@
MMGen = Multi-Mode GENerator
============================
##### a Bitcoin cold storage solution for the command line
### Install the offline bitcoind:
The bitcoin daemon on the **offline machine** is used solely for signing
transactions and is therefore run without a blockchain. The version bundled
with the prebuilt Bitcoin-QT is just fine for this purpose. Windows and Linux
binaries can be obtained [here][00].
After installation, locate the bitcoind executable, place it on your execution
path and start it with the command:
$ bitcoind -daemon -maxconnections=0
Note that in the absence of a blockchain the daemon starts very quickly and
uses practically no CPU once running. Thus a low-powered computer such as a
netbook will serve quite nicely as an offline machine for signing transactions.
[00]: https://bitcoin.org/en/download

28
doc/MMGenTextEditors.md Normal file
View file

@ -0,0 +1,28 @@
MMGen = Multi-Mode GENerator
============================
##### a Bitcoin cold storage solution for the command line
#### A word on text editors:
The text file editors that come with Windows, "edit" and "notepad", are
unsuitable for editing source code for many reasons, but above all because they
don't handle the line endings in Unix text files properly. Therefore, you'll
need to install a Unix-capable text editor such as nano or Vim.
[Nano][00] is an easy-to-use editor designed for less experienced users. It's
available [here][04] as a precompiled Windows binary. Just extract `nano.exe`
from the archive and copy it to your path.
For advanced users with some knowledge of vi commands, [Vim][01], a full-featured
editor with advanced text highlighting capabilities, will be a better choice.
Grab the Windows installer [here][05] and run it, accepting the defaults.
After installing Vim, you should add its executable directory `C:\Program
Files\Vim\vim74` (your version number may be different) to your user path.
Editing user paths is explained [here][06].
[06]: MMGenEditPathMSWin.md
[04]: http://mingw-and-ndk.googlecode.com/files/win-mingw-nano.7z
[05]: http://www.vim.org/download.php
[00]: http://www.nano-editor.org/
[01]: http://www.vim.org/