예제 #1
0
def signpsbt_handler(args):
    multisig = MultiSig.open(args.filename)
    client, device = get_client_and_device(args, multisig)
    psbt = multisig.psbt
    raw_signed_psbt = client.sign_tx(multisig.psbt)['psbt']
    new_psbt = serializations.PSBT()
    new_psbt.deserialize(raw_signed_psbt)
    multisig.psbt = new_psbt
    multisig.save()
예제 #2
0
def createpsbt_handler(args):
    multisig = MultiSig.open(args.filename)
    if multisig.psbt:
        user_input = input(
            "You already have a PSBT. Would you like to erase it and start a new one? (y/n)"
        )
        if user_input == 'y':
            multisig.remove_psbt()
        else:
            print("Cancelled")
            return
    multisig.create_psbt(args.recipient, args.amount)
    print(f"Your PSBT for wallet \"{multisig.name}\" has been created")
    print("View it with \"python cli.py decodepsbt\"")
예제 #3
0
def addsigner_handler(args):
    multisig = MultiSig.open(args.filename)
    client, device = get_client_and_device(args, multisig)

    # Create and add a "signer" to the wallet
    master_xpub = client.get_pubkey_at_path('m/0h')['xpub']
    origin_path = "m/44h/1h/0h"
    base_key = client.get_pubkey_at_path(origin_path)['xpub']
    multisig.add_signer(args.name, device['fingerprint'], base_key,
                        origin_path)
    print(
        f"Signer \"{args.name}\" has been added to your \"{multisig.name}\" wallet"
    )

    # Print messages depending on whether the setup is complete or not
    if multisig.ready():
        print(
            f"Wallet \"{multisig.name}\" is ready to use. Your first receiving address:"
        )
        print(multisig.address())
    else:
        signers_missing = multisig.n - len(multisig.signers)
        print(f"Add {signers_missing} more signers to start using it")
예제 #4
0
def listwallets_handler(args):
    for filename in glob.glob("*.json"):
        multisig = MultiSig.open(filename)
        display_wallet(multisig)
        print()
예제 #5
0
def describewallet_handler(args):
    multisig = MultiSig.open(args.filename)
    display_wallet(multisig)
예제 #6
0
def broadcast_handler(args):
    multisig = MultiSig.open(args.filename)
    txid = multisig.broadcast()
    print("Transaction ID:", txid)
예제 #7
0
def decodepsbt_handler(args):
    multisig = MultiSig.open(args.filename)
    pprint(multisig.decode_psbt())
예제 #8
0
def createwallet_handler(args):
    multisig = MultiSig.create(args.name, args.m, args.n)
    print(
        f"Your new {multisig.m}/{multisig.n} wallet has been saved to \"{multisig.filename()}\""
    )
예제 #9
0
def address_handler(args):
    multisig = MultiSig.open(args.filename)
    print(multisig.address())