2018-10-30 16:23:12 +00:00
|
|
|
#!/usr/bin/env python3
|
2017-10-31 08:57:05 +03:00
|
|
|
#
|
|
|
|
|
# mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution
|
2019-02-12 18:35:12 +00:00
|
|
|
# Copyright (C)2013-2019 The MMGen Project <mmgen@tuta.io>
|
2017-10-31 08:57:05 +03:00
|
|
|
#
|
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
# (at your option) any later version.
|
|
|
|
|
#
|
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
#
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
tx-btc2bch: Convert MMGen transaction files from BTC to BCH format
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
from mmgen.common import *
|
|
|
|
|
|
2019-03-26 12:59:30 +00:00
|
|
|
opts_data = {
|
|
|
|
|
'text': {
|
|
|
|
|
'desc': """Convert {pnm} transaction files from BTC to BCH format""".format(pnm=g.proj_name),
|
|
|
|
|
'usage':'[opts] [mmgen transaction file]',
|
|
|
|
|
'options': """
|
2017-10-31 08:57:05 +03:00
|
|
|
-h, --help Print this help message
|
|
|
|
|
--, --longhelp Print help message for long options (common options)
|
|
|
|
|
-v, --verbose Produce more verbose output
|
|
|
|
|
"""
|
2019-03-26 12:59:30 +00:00
|
|
|
}
|
2017-10-31 08:57:05 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cmd_args = opts.init(opts_data)
|
|
|
|
|
|
|
|
|
|
if g.coin != 'BTC':
|
|
|
|
|
die(1,"This program must be run with --coin set to 'BTC'")
|
|
|
|
|
|
|
|
|
|
if len(cmd_args) != 1: opts.usage()
|
|
|
|
|
|
|
|
|
|
import mmgen.tx
|
|
|
|
|
tx = mmgen.tx.MMGenTX(cmd_args[0])
|
|
|
|
|
|
|
|
|
|
if opt.verbose:
|
|
|
|
|
gmsg('Original transaction is in {} format'.format(g.coin))
|
|
|
|
|
|
Key/address generation support for 144 altcoins
Support for these coins is EXPERIMENTAL, use at your own risk
EXAMPLE: generate 10 Dogecoin key/address pairs with your default wallet:
`mmgen-keygen --coin=doge 1-10`
Keys for different coins are distinct, so users needn't worry about key reuse.
Supported alts: 2give,42,611,ac,acoin,alf,anc,apex,arco,arg,aur,b2x,bcf,bch,blk,bmc,bqc,bsty,btcd,btq,bucks,cann,cash,cat,cbx,ccn,cdn,chc,clam,con,cpc,crps,csh,dash,dcr,dfc,dgb,dgc,doge,doged,dope,dvc,efl,emc,emd,enrg,esp,etc,eth,fai,fc2,fibre,fjc,flo,flt,fst,ftc,gcr,good,grc,gun,ham,html5,hyp,icash,infx,inpay,ipc,jbs,judge,lana,lat,ldoge,lmc,ltc,mars,mcar,mec,mint,mobi,mona,moon,mrs,mue,mxt,myr,myriad,mzc,neos,neva,nka,nlg,nmc,nto,nvc,ok,omc,omni,onion,onx,part,pink,pivx,pkb,pnd,pot,ppc,ptc,pxc,qrk,rain,rbt,rby,rdd,ric,sdc,sib,smly,song,spr,start,sys,taj,tit,tpc,trc,ttc,tx,uno,via,vpn,vtc,wash,wdc,wisc,wkc,wsx,xcn,xgb,xmg,xpm,xpoke,xred,xst,xvc,zec,zet,zlq,zoom,zrc
Test the new functionality with `scripts/test-release.sh -Pn master alts`
B2X support disabled pending further testing
2017-12-24 15:26:23 +03:00
|
|
|
from mmgen.protocol import init_coin
|
|
|
|
|
init_coin('BCH')
|
2017-10-31 08:57:05 +03:00
|
|
|
|
|
|
|
|
if opt.verbose:
|
|
|
|
|
gmsg('Converting transaction to {} format'.format(g.coin))
|
|
|
|
|
|
|
|
|
|
tx.inputs.convert_coin(verbose=opt.verbose)
|
|
|
|
|
tx.outputs.convert_coin(verbose=opt.verbose)
|
|
|
|
|
|
|
|
|
|
tx.desc = 'converted transaction'
|
|
|
|
|
tx.write_to_file(ask_write=False,ask_overwrite=False)
|