4
3
As everyone is aware, I'm a huge proponent of Vitalik Buterin's pybitcointools Python 2.7/3.x library. I am having a some trouble understanding the BIP32 concepts, which are coded in the deterministic/composite modules.
In particular, this code:
# BIP32 hierarchical deterministic multisig script
def bip32_hdm_script(*args):
if len(args) == 3:
keys, req, path = args
else:
i, keys, path = 0, [], []
while len(args[i]) > 40:
keys.append(args[i])
i += 1
req = int(args[i])
path = map(int, args[i+1:])
pubs = sorted(map(lambda x: bip32_descend(x, path), keys)) #
return mk_multisig_script(pubs, req) # (req = required sigs) ... returns redeemScript hex
# BIP32 hierarchical deterministic multisig address
def bip32_hdm_addr(*args):
return scriptaddr(bip32_hdm_script(*args)) # returns P2SH address
I've had issues signing 2-of-2 P2SH/HD Txs with Electrum which I could only successfully sign using createrawtransaction \ signrawtransaction in Bitcoin-CLI.
How exactly is P2SH in combination with HD wallets implemented (preferably in terms of the aforementioned Python code)?
Are you having trouble with creating these outputs, or signing a transaction spending them once you've created them? – Nick ODell – 2015-04-15T02:11:06.403
@NickODell I'd like to be able to sign using the Python code. I don't want to confuse things too much, but Electrum 2.0.4 partially signs, returning this JSON data: https://gist.github.com/d6397e62bdb78f905cfa ... It makes no sense because it's substituted the extended public key in the script. (NB the data is safe to share, no worries about stolen keys or whatever)
– Wizard Of Ozzie – 2015-04-15T02:16:24.407I'd be also interested to know how multisig can be implemented with the HD wallet. Does it automatically generates multisig addresses? – abeikverdi – 2015-04-15T16:06:28.860