Bitcoin Forum
May 28, 2024, 02:48:30 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: OP_CHECKSIG algorithm?  (Read 805 times)
rfisher1968 (OP)
Sr. Member
****
Offline Offline

Activity: 319
Merit: 250


View Profile
April 22, 2016, 07:45:31 PM
Last edit: April 22, 2016, 08:21:28 PM by rfisher1968
 #1

As expressed in Script, the scriptSig is:

PUSHDATA
signature data and SIGHASH_ALL
PUSHDATA
public key data

The scriptPubKey is: OP_DUP
OP_HASH160
PUSHDATA
Bitcoin address (public key hash)
OP_EQUALVERIFY
OP_CHECKSIG

When this code executes, PUSHDATA first pushes the signature to the stack. The next PUSHDATA pushes the public key to the stack. Next, OP_DUP duplicates the public key on the stack. OP_HASH160 computes the 160-bit hash of the public key. PUSHDATA pushes the required Bitcoin address. Then OP_EQUALVERIFY verifies the top two stack values are equal - that the public key hash from the new transaction matches the address in the old address. This proves that the public key is valid. Next, OP_CHECKSIG checks that the signature of the transaction matches the public key and signature on the stack. This proves that the signature is valid.

Sorry, found it.

https://en.bitcoin.it/wiki/OP_CHECKSIG
rfisher1968 (OP)
Sr. Member
****
Offline Offline

Activity: 319
Merit: 250


View Profile
April 23, 2016, 11:44:32 AM
 #2

Just so I know I'm on the right path, is this the function that checks that the signature is valid?

secp256k1_ecdsa_sig_verify
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!