[ad_1]
Given an tackle as follows:
> spend_address=$(btc-cli getnewaddress '' legacy)
> btc-cli getaddressinfo $spend_address
spend_address data {
"tackle": "moHaAMoTLRZ7dCyP4SunTBRvSfdFxUNrCe",
"scriptPubKey": "76a91455391f93c7409df890be2804aa3cf85b22a903c188ac",
"isscript": false,
"iswitness": false,
"pubkey": "03a6a9b25d8cd811af3162222d5e6ddaf876f915ae37ccb4b4b3f2ba56c39e26d2",
"iscompressed": true,
...<stuff not wanted for instance elided>...
}
So now we have pubkey
= 03a6a9b25d8cd811af3162222d5e6ddaf876f915ae37ccb4b4b3f2ba56c39e26d2
.
And if we decode the ScriptPubKey
we discover the HASH160
embedded in it: 55391f93c7409df890be2804aa3cf85b22a903c1
Drawback is I can not get from pubkey
to HASH160(pubkey)
. Someplace I am baffled by endianness. (I decided that by taking a look at intermediate leads to the pockets’s getaddressinfo
handler.)
I’ve tried:
(ripemd160 (sha256 spend_address_pubkey))
(ripemd160 (sha256 (reversebytes spend_address_pubkey)))
(ripemd160 (reversebytes (sha256 spend_address_pubkey)))
(reversebytes (ripemd160 (sha256 spend_address_pubkey)))
(ripemd160 (reversebytes (sha256 (reversebytes spend_address_pubkey))))
and none of these (or their byte reverses!) match the transactions HASH160(pubkey)
within the vout[0].scriptPubKey.asm
area. Assist me discover which finish to work from please!
(I do know methods to get the HASH160
straight from the tackle by stripping off the checksum. However I need to know methods to get it from the pubkey, given the usual methods by which keys and hashes are displayed w.r.t. endianness.)
[ad_2]