Bitcoin Forum
May 05, 2024, 12:01:09 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Doubts about scriptPubKey  (Read 161 times)
fabbit (OP)
Newbie
*
Offline Offline

Activity: 29
Merit: 6


View Profile
January 24, 2020, 07: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 ?
1714867269
Hero Member
*
Offline Offline

Posts: 1714867269

View Profile Personal Message (Offline)

Ignore
1714867269
Reply with quote  #2

1714867269
Report to moderator
"The nature of Bitcoin is such that once version 0.1 was released, the core design was set in stone for the rest of its lifetime." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714867269
Hero Member
*
Offline Offline

Posts: 1714867269

View Profile Personal Message (Offline)

Ignore
1714867269
Reply with quote  #2

1714867269
Report to moderator
DannyHamilton
Legendary
*
Offline Offline

Activity: 3388
Merit: 4616



View Profile
January 24, 2020, 08:09:32 PM
Merited by ABCbits (1), nc50lc (1), Heisenberg_Hunter (1)
 #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
nc50lc
Legendary
*
Offline Offline

Activity: 2408
Merit: 5588


Self-proclaimed Genius


View Profile
January 25, 2020, 04:04:03 AM
 #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.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
pooya87
Legendary
*
Offline Offline

Activity: 3444
Merit: 10546



View Profile
January 25, 2020, 04:22:26 AM
 #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.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
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!