Bitcoin Forum
May 26, 2024, 11:33:12 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: pubkeyhash vs scripthash with createrawtransaction  (Read 395 times)
redPanda (OP)
Member
**
Offline Offline

Activity: 65
Merit: 16


View Profile
November 18, 2015, 04:50:16 PM
 #1

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 ?
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3402
Merit: 6659


Just writing some code


View Profile WWW
November 18, 2015, 08:18:55 PM
 #2

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.

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!