### Setup

sudo apt-get install python-pip

sudo pip install bitcoin

sudo pip install ccrypt

### To create a new keypair

pybtctool random_key > privkey.txt

cat privkey.txt | pybtctool -s privtopub > pubkey.txt

ccencrypt privkey.txt

Use:

* `cat pubkey.txt` to print out your public key

* `ccat privkey.txt` to print out your private key (this requires the password you set from ccencrypt)

Note that all other commands in this document should be run from the same directory where you have the `pubkey.txt` and `privkey.txt.cpt` files stored.

### To create a new address

Let pub1 ... pubn be the public keys that you want contained in the multisig, and k be the threshold (eg. for a 2-of-3 you would have pub1, pub2, pub3, k=2).

pybtctool mk_multisig_script <pub1> <pub2> ... <pubn> k > script.txt

cat script.txt | pybtctool -s scriptaddr > address.txt

### To create a new transaction

Value and fee are in satoshis, destination is an address:

pybtctool preparetx `cat address.txt` <destination> <value> <fee> | pybtctool -s setup_coinvault_tx `cat script.txt`

For example:

pybtctool preparetx `cat address.txt` 1L2ZTS5xU9kc4WDbnHkxcZwiP4SCG71SJr 10000000000 20000 | pybtctool -s setup_coinvault_tx `cat script.txt`

To create a transaction with multiple outputs:

pybtctool preparemultitx `cat address.txt` <dest1>:<value1> <dest2>:<value2> ... <destn>:<valuen> <fee> | pybtctool -s setup_coinvault_tx `cat script.txt`

For example:

pybtctool preparemultitx `cat address.txt` 1L2ZTS5xU9kc4WDbnHkxcZwiP4SCG71SJr:10000000000 1etfpu6qQDTBjx5et4LjQAyjXWjwaWtHm:2500000000 20000 | pybtctool -s setup_coinvault_tx `cat script.txt`

### To inspect what a transaction does (recommended everyone do this before signing)

pybtctool inspect <tx>

### To sign a transaction

pybtctool sign_coinvault_tx <tx> `ccat privkey.txt.cpt`

### To push a transaction