Usage example for MultiSig-core accounts

Create an account and a spending transaction


In [2]:
from multisigcore.hierarchy import *
from pycoin.key.BIP32Node import BIP32Node
from pycoin.services import insight
from pycoin.scripts.tx import dump_tx
from pycoin.tx.script.tools import *

secrets = [b'aaa2', b'bbb2']
keys = [BIP32Node.from_master_secret(x, netcode='XTN') for x in secrets]
a = SimpleAccount(keys[0])
a.set_lookahead(1)
a._provider = insight.InsightService('https://test-insight.bitpay.com/')
print(a.current_address())
tx = a.tx([('mvccWwntgfQaj7TVYEw2C2avymxHwjixDz', 1000)])
dump_tx(tx, netcode='XTN')
a.sign_tx(tx)
dump_tx(tx, netcode='XTN')
print(tx.as_hex())


mrwTaLGEyikp3cum5CELD5sCzrwnDqMyRN
Version:  1  tx hash c2bc74c0a7438231c16ee621f8b7e343cea752ce7e15aa4ad0c6c863a3b29aee  119 bytes   
TxIn count: 1; TxOut count: 2
Lock time: 0 (valid anytime)
Input:
  0: mrwTaLGEyikp3cum5CELD5sCzrwnDqMyRN from a35ad7e294ac07e1b4e848ec8f0c9a15b4dcd6e4516072186686159be7649535:0      1.00000 mBTC  BAD SIG
Outputs:
  0: mvccWwntgfQaj7TVYEw2C2avymxHwjixDz receives      0.01000 mBTC
  1: mxQTvWWBLv6f1LScNcFHrdpMTijKGHQmmz receives      0.98000 mBTC
Total input       1.00000 mBTC
Total output      0.99000 mBTC
Total fees        0.01000 mBTC
Version:  1  tx hash 834a6a104c10cbf9e23d1f05d75001be5206b1119c6e9ae983e4173368ca128c  225 bytes   
TxIn count: 1; TxOut count: 2
Lock time: 0 (valid anytime)
Input:
  0: mrwTaLGEyikp3cum5CELD5sCzrwnDqMyRN from a35ad7e294ac07e1b4e848ec8f0c9a15b4dcd6e4516072186686159be7649535:0      1.00000 mBTC  sig ok
Outputs:
  0: mvccWwntgfQaj7TVYEw2C2avymxHwjixDz receives      0.01000 mBTC
  1: mxQTvWWBLv6f1LScNcFHrdpMTijKGHQmmz receives      0.98000 mBTC
Total input       1.00000 mBTC
Total output      0.99000 mBTC
Total fees        0.01000 mBTC
0100000001359564e79b15866618726051e4d6dcb4159a0c8fec48e8b4e107ac94e2d75aa3000000006a47304402206320a277970b6ebe7accc3f6c21df8150660be9c0a522acb158f83bcd9112cad022011db78355ad42b8c69e128fe0604e4c7ee0b7bd8aa30d029d575f54ac11e343301210317e1b4c1018b1cd550d8bc902807af3deae5c0e4b2574039e886862151b5e97fffffffff02e8030000000000001976a914a59bdf76d718523f5776454954d187b24f7b2c3588acd07e0100000000001976a914b93ff591a34cff3e4540b9fee08269ccce3c54ec88ac00000000