Introduce a package of mastercoin related tools.

The intention is to help finalizing the spec, and enable easy further coding.
It is based on https://github.com/spesmilo/sx with minor fixes on
https://github.com/grazcoin/sx

For finalizing the spec, a list of address and mastercoins is generated.

To get all mastercoins sells during exodus bootstrap in csv format:
python msc_bootstrap.py > outputs/bootstrap.log

To get total amount of mastercoins for each address:
python bootstrap_msc_per_address.py > outputs/msc_per_address.csv

To get the whole bootstrap story (for fun and debug), check:
python msc_bootstrap.py story > outputs/bootstrap_story.log

The outputs of those scripts are available under outputs directory.
mastercoin purchased during bootstap go to the most paying address

change the mastercoins distribution algorithm:
the highest paying address in bootstrap tx gets all mastercoins
update msc per address file with highest paying address gets all

outputs/msc_per_address.csv updated with the modified mastercoin
distributing algo
introduce basic mastercoin tx parser

The parser goes on all 1EXoDus tx, and outputs:
tx_hash,from,to,amount,currency,tx_type
currently only simple send is supported

usage:
python msc_parse.py > outputs/tx_parse.csv

license updated with the content of agpl-3
add msc_send and simple multisig support

simple multisig:
output 1: dust to 1EXoDus
output 2: all the change to BIP11 1-of-2:
          pubkey1 is the one of the sender
          pubkey2 is recipientHex+dataHex+padding

Examples:
https://blockchain.info/tx/298a6af50089184f7b434c700f83f390d5dfdd5dac10b39b95f99036a5c66df7
https://blockchain.info/tx/aa64fd6088532156a37670e6cbd175c74bb101f1406517613a1a0ae6bc02fb02

msc_send.py can send mastercoins directly (not "Advisor")
$ python msc_send.py -h
Usage: msc_send.py [options]

Options:
    -h, --help            show this help message and exit
    -m TX_METHOD, --transaction-method=TX_METHOD
                          basic or multisig
    -c CURRENCY_ID, --currency-id=CURRENCY_ID
                          1 for Mastercoin, 2 for Test Mastercoin
    -a AMOUNT, --amount=AMOUNT
                          amount of coins
    -x FEE, --fee=FEE     fee for transaction
    -r RECIPIENT_ADDRESS, --recipient=RECIPIENT_ADDRESS
                          recipient address
    -f FROM_ADDRESS, --from=FROM_ADDRESS
                          from address or pubkey
    -p PRIV_KEY, --private-key=PRIV_KEY
                          private key for signing the tx (overrides from
                          address)
    -k, --key-prompt      prompt for hidden private key for signing the tx
                          (overrides from address)
    -s HOST_PORT, --send-tx=HOST_PORT
                          transmit tx to specific bitcoin node HOST:PORT
    -b, --broadcast-tx    broadcast tx to bitcoin network
    -d, --debug           turn debug mode on

$ python msc_send.py --transaction-method=multisig --currency-id=2 --amount=0.00000003 --recipient=17RVTF3vJzsuaGh7a94DFkg4msJ7FcBYgX --key-prompt --fee=0.005000000
[I] main: Using settings: {'broadcast': False, 'recipient_address': '17RVTF3vJzsuaGh7a94DFkg4msJ7FcBYgX', 'fee': '0.005000000', 'from_address': 'UNKNOWN', 'key_prompt': True, 'host_port': None, 'currency_id': 2, 'amount': '0.00000003', 'debug_mode': False, 'priv_key': None, 'tx_method': 'multisig'}
Enter your private key:
[I] main: Private key was entered
Added input ca234cf9e041a942d8a56bb3449f15f1176beb3291af60a35392b72b2080fe1f:7
Added output sending 6000 Satoshis to 1EXoDusjGwvnjZUyKkxZ4UHEf77z6A5S4P.
Added output sending 4494000 Satoshis to 1 [ 041f204911ec19cb5b7b10dd87ccf6a52552466d14356212e881288512eeff8e2084ddff9997fdfb22fae6b09a255e3937a7890491ab5106ce7912bc253e430887 ] [ 0046727d1b3d6847f9ed344561a315f54b801edf637cad93d000450000000000000002000000000000000300000000000000000000000000000000000000000000 ] 2 checkmultisig.
[I] sign: signing tx
[I] main: validating tx: Status: Success
[I] main: SIGNED tx (multisig) of 0.00000003 Test Mastercoin to 17RVTF3vJzsuaGh7a94DFkg4msJ7FcBYgX signed by 182osbPxCo88oaSX4ReJwUr9uAcchmJVaL
01000000011ffe80202bb79253a360af9132eb6b17f1159f44b36ba5d842a941e0f94c23ca070000008b48304502200102474d29d78835c905e7c0246ed69b826eb93337d289632edb03e715c5d683022100d0c42776df0b753afa3f2e572a9c06889305e623ebc231ee206d8e28b9926ac50141041f204911ec19cb5b7b10dd87ccf6a52552466d14356212e881288512eeff8e2084ddff9997fdfb22fae6b09a255e3937a7890491ab5106ce7912bc253e430887ffffffff0270170000000000001976a914946cb2e08075bcbaf157e47bcb67eb2b2339d24288acb092440000000000875141041f204911ec19cb5b7b10dd87ccf6a52552466d14356212e881288512eeff8e2084ddff9997fdfb22fae6b09a255e3937a7890491ab5106ce7912bc253e430887410046727d1b3d6847f9ed344561a315f54b801edf637cad93d00045000000000000000200000000000000030000000000000000000000000000000000000000000052ae00000000
[I] parse_multisig_simple: 1 [ 041f204911ec19cb5b7b10dd87ccf6a52552466d14356212e881288512eeff8e2084ddff9997fdfb22fae6b09a255e3937a7890491ab5106ce7912bc253e430887 ] [ 0046727d1b3d6847f9ed344561a315f54b801edf637cad93d000450000000000000002000000000000000300000000000000000000000000000000000000000000 ] 2 checkmultisig
[I] parse_test: {'currency_type_str': 'Test Mastercoin', 'transaction_type_str': 'Simple send', 'currencyId': '00000002', 'transaction_method_str': 'multisig_simple', 'recipientAddress': '17RVTF3vJzsuaGh7a94DFkg4msJ7FcBYgX', 'padding': '000000', 'amount': '0000000000000003', 'changeAddress': '182osbPxCo88oaSX4ReJwUr9uAcchmJVaL', 'formatted_amount': '0.00000003', 'baseCoin': '00', 'dataSequenceNum': '45', 'transactionType': '00000000'}
[I] main: please send using "sx broadcast-tx signed_tx.tx"

msc_parse.py parses simple multisig and basic simple send.
$ python msc_parse.py -h
Usage: msc_parse.py [options]

Options:
  -h, --help            show this help message and exit
  -d, --debug           turn debug mode on
  -t SINGLE_TX, --transaction=SINGLE_TX
                        hash of a specific tx to parse

$ python msc_parse.py -t 298a6af50089184f7b434c700f83f390d5dfdd5dac10b39b95f99036a5c66df7
[I] main: {'currency_type_str': 'Test Mastercoin', 'transaction_type_str': 'Simple send', 'currencyId': '00000002', 'transaction_method_str': 'multisig_simple', 'recipientAddress': '17RVTF3vJzsuaGh7a94DFkg4msJ7FcBYgX', 'padding': '000000', 'amount': '0000000000000003', 'changeAddress': '182osbPxCo88oaSX4ReJwUr9uAcchmJVaL', 'formatted_amount': '0.00000003', 'baseCoin': '00', 'dataSequenceNum': '45', 'transactionType': '00000000'}
$