Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: redPanda on November 18, 2015, 04:50:16 PM



Title: pubkeyhash vs scripthash with createrawtransaction
Post by: redPanda on November 18, 2015, 04:50:16 PM
I want to create a new wallet without using the bitcoind wallet.
I have created a testnet wallet on blocktrail.com so I use
pubkeys from blocktrail and from bitcore package (node.js).

pubkey generated by bitcore:    n2eTmd37KTGhRZNJsf9tfVdCG1YejciETu
pubkey generated by blocktrail: 2NCo1Y7JJgLabJ5AQjBpgavyX1JLWJxGPYK

my transaction: from n2e... to 2NC... change back to n2e...

When I do a createrawtransaction I have two different types of scriptPubKey:

n2eTmd37KTGhRZNJsf9tfVdCG1YejciETu:     pubkeyhash  (bitcore)
2NCo1Y7JJgLabJ5AQjBpgavyX1JLWJxGPYK:  scripthash     (blocktrail)

My question: why I have a scripthash from blocktrail ?

What I think the answer is:
quote from blocktrail: "The BlockTrail Payment API is built using Multi-Signature HD Wallets, this means that there are 3 keys in total, 2 of which are necessary to get access to your Bitcoin!" (primary key, backup key and blocktrail key)
so instead of paying to a single pubkey, I must pay to a scripthash representing 2 out of 3 signatures.

Is it correct ? or there is another reason ?


Title: Re: pubkeyhash vs scripthash with createrawtransaction
Post by: achow101 on November 18, 2015, 08:18:55 PM
That is correct. In order to spend the coins, you need the redeem script which is the script which is hashed to create the address. It is also what the signatures are validated against in order to spend the Bitcoin at that address.