Bitcoin Forum
September 27, 2018, 11:11:30 PM *
News: ♦♦ New info! Bitcoin Core users absolutely must upgrade to previously-announced 0.16.3 [Torrent]. All Bitcoin users should temporarily trust confirmations slightly less. More info.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: How does signrawtransaction know which private key to use?  (Read 519 times)
ned.ryerson
Full Member
***
Offline Offline

Activity: 146
Merit: 100



View Profile
June 03, 2014, 03:27:30 PM
 #1

It only has a previous output (hash and vout index) but nothing to tell it which address that output was for, so how can it choose the correct private key to sign the transaction?

⋅⦁•●⚫ AllSporter ⚫●•⦁⋅
First decentralised p2p marketplace, for sports enthusiasts
Facebook      Telegram   █████    allsportercoin.io    █████   Twitter      Instagram
1538089890
Hero Member
*
Offline Offline

Posts: 1538089890

View Profile Personal Message (Offline)

Ignore
1538089890
Reply with quote  #2

1538089890
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1538089890
Hero Member
*
Offline Offline

Posts: 1538089890

View Profile Personal Message (Offline)

Ignore
1538089890
Reply with quote  #2

1538089890
Report to moderator
piotr_n
Legendary
*
Offline Offline

Activity: 1932
Merit: 1018


aka tonikt


View Profile WWW
June 03, 2014, 03:39:48 PM
 #2

hash and vout index refer to a UTXO record containing a spend script. the spend script refers to a public address, upon which a private key can be matched.

Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.
PGP fingerprint: AB9E A551 E262 A87A 13BB  9059 1BE7 B545 CDF3 FD0E
ned.ryerson
Full Member
***
Offline Offline

Activity: 146
Merit: 100



View Profile
June 03, 2014, 03:43:14 PM
 #3

hash and vout index refer to a UTXO record containing a spend script. the spend script refers to a public address, upon which a private key can be matched.
But if you're offline (and no blockchain access), how can it get the UTXO?

⋅⦁•●⚫ AllSporter ⚫●•⦁⋅
First decentralised p2p marketplace, for sports enthusiasts
Facebook      Telegram   █████    allsportercoin.io    █████   Twitter      Instagram
gmaxwell
Moderator
Legendary
*
qt
Offline Offline

Activity: 2520
Merit: 1514



View Profile
June 03, 2014, 03:48:57 PM
 #4

But if you're offline (and no blockchain access), how can it get the UTXO?
It can't in that case, thats why it has an optional scriptpubkey argument.

Bitcoin will not be compromised
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!