I do a quick parsing of blockchain file and there was a question on definition of a address for an input transaction.
How from the specified sriptSig calculate the address correctly?
So, scriptSig is hex:
len: 107
scriptSig: 483045022100fffc98a7bcbe7fc6d6716775794f59551e335914683fd1ed6fcdae40c68918310220763ceeb8b9bf168f75b98e4a1dd774072e8816fec384a6228b1ecbfbcbf8239d012102d939f9164fc61e89eaf18841cc13f08721ce9ef671f3751a1536a10af752881f
or
PUSHDATA[72] 3045022100fffc98a7bcbe7fc6d6716775794f59551e335914683fd1ed6fcdae40c68918310220763ceeb8b9bf168f75b98e4a1dd774072e8816fec384a6228b1ecbfbcbf8239d01
PUSHDATA[33] 02d939f9164fc61e89eaf18841cc13f08721ce9ef671f3751a1536a10af752881f
Is correctly that to calculate the address we first need to get from compressed key (pushdata [33]) - uncompressed by the method
https://en.bitcoin.it/wiki/Secp256k1 ?
I tried this method using OpenSSL
EC_KEY* key=EC_KEY_new_by_curve_name(NID_secp256k1);
if (key)
{
EC_KEY* r=o2i_ECPublicKey(&key, &keypart, 33);
if (r)
{
EC_KEY_set_conv_form(key, POINT_CONVERSION_UNCOMPRESSED);
char key_result[65];
int size=i2o_ECPublicKey(key, &key_result);
}
EC_KEY_free(key);
}
openssl specifies that
key_result [65] = 04d939f9164fc61e89eaf18841cc13f08721ce9ef671f3751a1536a10af752881f42a2f60dd229dca9adbc86f16104a0114f8d1458fda83d4a747476d137e0fd18
-
From which I then determine the address (according to the algorithm described in
https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses)
but unfortunately I get the wrong
1LzATNQX57AEZ1qXKbHemS1gRxMayito1nthat is, instead of 1KqydgzrzK28T6rdPVoLaASp3i4BZ5CGTb I get another.
