Last active
January 29, 2016 21:31
-
-
Save JimmyMow/2235a791205dcfae7fdd to your computer and use it in GitHub Desktop.
Getting error trying to sign transaction 21BC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from two1.lib.wallet import Wallet, exceptions | |
from two1.lib.bitcoin.crypto import PublicKey | |
from two1.lib.bitcoin.script import Script | |
from two1.lib.bitcoin.txn import Transaction | |
SRV_ACCT = 'signing' | |
wallet = Wallet() | |
try: | |
print("attempting to create account 'signing'") | |
wallet.create_account(SRV_ACCT) | |
except exceptions.AccountCreationError: | |
print("already have account signing created") | |
pass | |
next_idx = 1 | |
server_hd_pubkey = wallet.get_message_signing_public_key(SRV_ACCT, next_idx) | |
server_pubkey = server_hd_pubkey.compressed_bytes | |
owner_pubkey = PublicKey.from_bytes("040D3711FB353EDF77A13D1A3A33CFC7E04EEE626C9738EECC23754C06083DB8058C4F6DDFFE3445C1ADD3B1D121F70FE3B56EADD260AD43ED517C25B10FFBC3D0").compressed_bytes | |
other_pubkey = PublicKey.from_bytes("045AC8DD1042E3C7210324720F2520ED5B42CDBDC31610E3936E4925C67D37CDB3A0E1661B8BDAC2A090BD3425CDA715DFE131E591A27E7DF6A5CCC66383AE8E16").compressed_bytes | |
multi_script = Script.build_multisig_redeem(2, [owner_pubkey, server_pubkey, other_pubkey]) | |
address = multi_script.address() | |
pbkey = wallet.get_payout_public_key(SRV_ACCT) | |
prkey = wallet.get_private_for_public(pbkey) | |
tx = wallet.send_to(address, 5000) | |
tx_object = tx[0]['txn'] | |
idx = 0 | |
for ip in tx_object.inputs: | |
signed = tx_object.sign_input(idx, Transaction.SIG_HASH_ALL, prkey, multi_script) | |
if not signed: | |
print("Trouble signing input %d." % idx) | |
abort(400) | |
idx += 1 | |
return true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment