Bitcoin Forum
November 11, 2024, 09:56:52 PM *
News: Check out the artwork 1Dq created to commemorate this forum's 15th anniversary
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Updating createTxFromAddrList  (Read 848 times)
helgabutters (OP)
Newbie
*
Offline Offline

Activity: 43
Merit: 0


View Profile
June 27, 2014, 07:36:24 PM
 #1

I've been doing some poking around and have been updating createTxFromAddrList from the extra directory to start learning more about Armory. The new createFromTxOutSelection is where I am stuck and not sure what more I need to do. The code and comments are below:

Code:
# ACR:  To support P2SH in general, had to change createFromTxOutSelection
#       to take full scripts, not just hash160 values.  Convert the list
#       before passing it in
scrPairs = [[hash160_to_p2pkhash_script(r), v] for r,v in recip160List]
txdp = UnsignedTransaction().createFromTxOutSelection(selectedUtxoList, scrPairs)

This is what I get when running:

Code:
KeyDataError: Must give pubkey map for singlesig USTXI!

Which makes sense given:

Code:
def createFromTxOutSelection(self, utxoSelection, scriptValuePairs, pubKeyMap=None, txMap=None, p2shMap=None)

Anyone able to point me in the right direction on where I should be looking? Not sure what to do for creating the pubkey map.
goatpig
Moderator
Legendary
*
Offline Offline

Activity: 3752
Merit: 1364

Armory Developer


View Profile
June 27, 2014, 07:55:49 PM
 #2

I havent worked with this part of the code, however you're obviously not providing enough data for your intended operation. You can't go from hash160 to pubkey, you have to provide the pubkeys as well, as TxIns need the pubkey to verify the signature.

Also, what branch did you pull?

etotheipi
Legendary
*
Offline Offline

Activity: 1428
Merit: 1093


Core Armory Developer


View Profile WWW
June 27, 2014, 07:58:54 PM
 #3

I'll take a glance at it tonight.  Admittedly, those scripts have not been maintained as well as they should be.  I believe the public key map is just scrAddr->rawPubKey.    The signing device will need to know the public key to put into the sigscript, and it was simpler to have it passed through the data structure like this.

I think it's something like

Code:
pubKeyMap = dict([[SCRADDR_P2PKH_BYTE+hash160(pk), pk] for pk in pubKeyList])

Founder and CEO of Armory Technologies, Inc.
Armory Bitcoin Wallet: Bringing cold storage to the average user!
Only use Armory software signed by the Armory Offline Signing Key (0x98832223)

Please donate to the Armory project by clicking here!    (or donate directly via 1QBDLYTDFHHZAABYSKGKPWKLSXZWCCJQBX -- yes, it's a real address!)
helgabutters (OP)
Newbie
*
Offline Offline

Activity: 43
Merit: 0


View Profile
June 27, 2014, 09:16:16 PM
 #4

Also, what branch did you pull?

I pulled from 0.91-dev


I'll take a glance at it tonight.  Admittedly, those scripts have not been maintained as well as they should be.  I believe the public key map is just scrAddr->rawPubKey.    The signing device will need to know the public key to put into the sigscript, and it was simpler to have it passed through the data structure like this.

I think it's something like

Code:
pubKeyMap = dict([[SCRADDR_P2PKH_BYTE+hash160(pk), pk] for pk in pubKeyList])


Awesome, I'll see what I can do with that. Not promising I won't be back with more questions but it's a start. Thanks! Smiley
etotheipi
Legendary
*
Offline Offline

Activity: 1428
Merit: 1093


Core Armory Developer


View Profile WWW
June 27, 2014, 09:18:23 PM
 #5

Also, what branch did you pull?

I pulled from 0.91-dev


I'll take a glance at it tonight.  Admittedly, those scripts have not been maintained as well as they should be.  I believe the public key map is just scrAddr->rawPubKey.    The signing device will need to know the public key to put into the sigscript, and it was simpler to have it passed through the data structure like this.

I think it's something like

Code:
pubKeyMap = dict([[SCRADDR_P2PKH_BYTE+hash160(pk), pk] for pk in pubKeyList])


Awesome, I'll see what I can do with that. Not promising I won't be back with more questions but it's a start. Thanks! Smiley

Please work on the devel branch ,which will shortly be merged into master (maybe 1-2 weeks).  If you figure out how it needs to be updated to work, you'll be saving us some time!  Smiley   But I'm not sure what I posted above will work.  I forgot how 0.91 handles things...

Founder and CEO of Armory Technologies, Inc.
Armory Bitcoin Wallet: Bringing cold storage to the average user!
Only use Armory software signed by the Armory Offline Signing Key (0x98832223)

Please donate to the Armory project by clicking here!    (or donate directly via 1QBDLYTDFHHZAABYSKGKPWKLSXZWCCJQBX -- yes, it's a real address!)
helgabutters (OP)
Newbie
*
Offline Offline

Activity: 43
Merit: 0


View Profile
June 27, 2014, 09:25:10 PM
 #6

Please work on the devel branch ,which will shortly be merged into master (maybe 1-2 weeks).  If you figure out how it needs to be updated to work, you'll be saving us some time!  Smiley   But I'm not sure what I posted above will work.  I forgot how 0.91 handles things...

Will do, my original intention was to create a script that will break up an amount of bitcoins into random smaller chucks distributed across multiple keys based on what amount you have in any single address to help keep the amount of bitcoins you hold from being revealed by change. Still a little bit away from that goal but getting closer.
doug_armory
Sr. Member
****
Offline Offline

Activity: 255
Merit: 250

Senior Developer - Armory


View Profile WWW
June 27, 2014, 10:53:44 PM
 #7

I've been doing some poking around and have been updating createTxFromAddrList from the extra directory to start learning more about Armory.

Fair warning: As other team members have said, not all those scripts are necessarily up to date. If you're really curious, check out armoryd on the devel branch. I've actually taken some code from the other scripts and placed them in armoryd after updating them. Perhaps the day will come when somebody has time to update the other scripts, but until then, armoryd is your best bet.

Senior Developer -  Armory Technologies, Inc.
CircusPeanut
Full Member
***
Offline Offline

Activity: 123
Merit: 100


View Profile
June 30, 2014, 03:54:01 PM
 #8

The extras directory has quite a bit of stale code. It does not routinely get updated.

If you encounter some bad code in that directory, you can either revert your local version of the repo to the last version of the file you are looking at.

Or, you can modify it to work with the latest version of the repo.

       
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!