Author

Topic: Doubts about scriptPubKey (Read 189 times)

legendary
Activity: 3472
Merit: 10611
January 24, 2020, 11:22:26 PM
#4
This is new to me, I though it will add '0' in front of 007d7 to be valid because it's odd-digit; instead, it resulted to 'G....'

all the values here are fake, so something like foo and bar should have been used instead!
by the way 0 is the "address version byte" that is added to the hash to get version 1 (P2PKH) addresses.
legendary
Activity: 2534
Merit: 6080
Self-proclaimed Genius
January 24, 2020, 11:04:03 PM
#3
2. Calculate a checksum (the first 4 bytes of: SHA-256(SHA-256(007d7))
3. Add the 4 byte checksum to the end of the 007d7, resulting in 007d7GGGGGGGG
This is new to me, I though it will add '0' in front of 007d7 to be valid because it's odd-digit; instead, it resulted to 'G....'
7d7
If you want to put a random value, it should be 20 byte HEX or 40 (1-0, a-f) characters.
legendary
Activity: 3472
Merit: 4801
January 24, 2020, 03:09:32 PM
#2
Code:
"asm" : "OP_DUP OP_HASH160 7d7 OP_EQUALVERIFY OP_CHECKSIG",
 "addresses" : [ "d8d" ]
hash(7d7)==d8d ?

That depends on what you mean by hash()

7d7 should already be the result of RIPEMD-160(SHA-256(public key))

To get from that hash value to the associated P2PKH address, you need to:

1. Add a version byte to the front of 7d7, resulting in 007d7

2. Calculate a checksum (the first 4 bytes of: SHA-256(SHA-256(007d7))

3. Add the 4 byte checksum to the end of the 007d7, resulting in 007d7GGGGGGGG (where GGGGGGGG is the 4 byte checksum from step 2)

4. Convert the result from a byte string into a base58 string using Base58Check encoding.

The result of that would be d8d

More information here:
https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses#How_to_create_Bitcoin_Address
newbie
Activity: 29
Merit: 6
January 24, 2020, 02:42:22 PM
#1
A scriptPubKey is (invented):
Code:
"scriptPubKey" : {
 "asm" : "OP_DUP OP_HASH160 7d7\
 OP_EQUALVERIFY OP_CHECKSIG",
 "hex" : "fg8ad8a",
 "reqSigs" : 1,
 "type" : "pubkeyhash",
 "addresses" : [
 "d8d"
 ]
hash(7d7)==d8d ?
Jump to: