简体   繁体   中英

How does Bitcoin transaction validation work with scriptSig and sciptPubKey?

I'm working through this example from https://en.bitcoin.it/wiki/Transaction

Input:
Previous tx: f5d8ee39a430901c91a5917b9f2dc19d6d1a0e9cea205b009ca73dd04470b9a6
Index: 0
scriptSig: 304502206e21798a42fae0e854281abd38bacd1aeed3ee3738d9e1446618c4571d10
90db022100e2ac980643b0b82c0e88ffdfec6b64e3e6ba35e7ba5fdd7d5d6cc8d25c6b241501

Output:
Value: 5000000000
scriptPubKey: OP_DUP OP_HASH160 404371705fa9bd789a2fcd52d2c580b65d35549d
OP_EQUALVERIFY OP_CHECKSIG

So basically:

Sig = 304502206e21798a42fae0e854281abd38bacd1aeed3ee3738d9e1446618c4571d10
Pub Key = 90db022100e2ac980643b0b82c0e88ffdfec6b64e3e6ba35e7ba5fdd7d5d6cc8d25c6b241501

OP_DUP, then OP_HASH160

When I HASH160 (ie RIPEMD160(SHA256()) the Pub Key, I get 6f6c7697c8f93d72d3d8286195dd2c261bdef075 and not 404371705fa9bd789a2fcd52d2c580b65d35549d .

Using https://md5calc.com , I get the following:

SHA256 (90db022100e2ac980643b0b82c0e88ffdfec6b64e3e6ba35e7ba5fdd7d5d6cc8d25c6b241501) = 9fb78bdfd748eefc1ab6ff9dd16611f9fc86be5bf12483da612c34887501f195

RIPEME160 (9fb78bdfd748eefc1ab6ff9dd16611f9fc86be5bf12483da612c34887501f195) = 6f6c7697c8f93d72d3d8286195dd2c261bdef075

I must be missing a few steps in there?

Thanks!

You encoded the hexadecimal representation of the binary data, not the binary data itself. You need to sha256() and ripemd160() the actual binary data.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM