Offline wallets with dcraddrgen

Dcraddrgen is an application written in Go that generates offline addresses (private key, seed) without having to run the wallet itself (Decrediton or dcrwallet).

Offline wallets with dcraddrgen
Offline wallets with dcraddrgen

By Marcelo Martins - January 10, 2020

Dcraddrgen is an application written in Go that generates offline addresses (private key, seed) without having to run the wallet itself (Decrediton or dcrwallet).

The creation of an offline wallet prevents your private key (or seed) from unauthorized access over the Internet. It’s a secure way to generate a wallet that is completely disconnected from your existing wallets. This way the user does not have to type the seed of a wallet with spendable resources.

The tool provides only the first public address. Creating additional addresses would cause the wallet application (dcrwallet and Decrediton) to have to check N derived addresses for deposits (check the article One seed, one wallet).

Go version 1.8 or 1.9 must be installed. To install, see Installing Go (golang).

The following steps were performed on a Debian 9 64-bit.

a) Clone dcraddrgen repository:

$ sudo git clone https://github.com/decred/dcraddrgen $HOME/go/src/github.com/decred/dcraddrgen

If you do not have git installed:

$ sudo apt-get install git

b) Enter the directory you just created, run Dep to check the dependencies and compile.

$ cd $HOME/go/src/github.com/decred/dcraddrgen

$ dep ensure
or
$ /usr/local/go/bin/dep ensure

$ go build
or
$ /usr/local/go/bin/go build

c) If no error occurred, a dcraddrgen file with executable attribute must have been created.

References: https://github.com/decred/dcraddrgen, https://github.com/golang/go/wiki/SettingGOPATH

a) To see the list of commands type:

$ ./dcraddrgen --help

Usage: dcraddrgen [-testnet] [-simnet] [-noseed] [-verify] [-h] filename
Generate a Decred private and public key or wallet seed. 
These are output to the file 'filename'.

  -h         Print this message
  -testnet     Generate a testnet key instead of mainnet
  -simnet     Generate a simnet key instead of mainnet
  -noseed     Generate a single keypair instead of a seed
  -verify     Verify a seed by generating the first address

b) Running dcraddrgen without options generates a private key and its seed on the screen. If you intend to use this key, this is your only chance to write it down. The master public key and the first public address will be stored in the file keys.txt:

$ ./dcraddrgen

WRITE DOWN THE SEED GIVEN BELOW. YOU WILL NOT BE GIVEN ANOTHER CHANCE TO.

Your wallet generation seed is:

prowler insincere aimless Galveston accrue fascinate 
commence revenue choking hurricane peachy butterfat 
chatter paperweight Oakland confidence revenge Jupiter 
cranky retrieval allow fortitude wayside finicky 
dwelling cellulose adult voyager obtuse souvenir 
soybean hideaway pheasant 

Hex: 997d0863025c3dca3473902031a58a34a98441c80a60fc5e532805f78bd4c771
IMPORTANT: Keep the seed in a safe place as you
will NOT be able to restore your wallet without it.
Please keep in mind that anyone who has access
to the seed can also restore your wallet thereby
giving them access to all your funds, so it is
imperative that you keep it in a secure location.

Once you have stored the seed in a safe 
and secure location, enter OK here to erase the 
seed and all derived keys from memory. Derived 
public keys and an address will be stored in the 
file specified (default: keys.txt):
Warning! This seed, used here as an example, should not be used anywhere else.

c) To verify the seed is correct and generate the first public address, type:

$ ./dcraddrgen --verify

Then you will be prompted to type (or copy and paste) the entire seed.

Enter existing wallet seed: prowler insincere aimless Galveston accrue fascinate commence revenue choking hurricane peachy butterfat chatter paperweight Oakland confidence revenge Jupiter cranky retrieval allow fortitude wayside finicky dwelling cellulose adult voyager obtuse souvenir soybean hideaway pheasant
First derived address of given seed: 
DsaZek8XQ2p3nBKSvAqUq9f8BcTqoHeNpJp