0

We have example in the wiki:

[...]
Output 1:
 40 4B 4C 00 00 00 00 00                           - 0.05 BTC (5000000)
 19                                                - pk_script is 25 bytes long

 76 A9 14 1A A0 CD 1C BE  A6 E7 45 8A 7A BA D5 12  - pk_script
 A9 D9 EA 1A FB 22 5E 88  AC
[...]

What is the pk_script? Is it possible to translate it to bitcoin address being offline (not synced with network)? How to do this?

EDIT:

OK, I understand more right now:

 pk_script
 76 (OP_DUP)
 A9 (OP_HASH160)
 14 (Bytes to push)
 1A A0 CD 1C BE  A6 E7 45 8A 7A BA D5 12 A9 D9 EA 1A FB 22 5E (Data to push)
 88 (OP_EQUALVERIFY)
 AC (OP_CHECKSIG)

A I understand I should use b58encode_check on "data to push" to get bitcoin address. I have found python library which implements b58encode_check (https://pypi.python.org/pypi/base58) and did try with it:

for byte in (0x1A, 0xA0, 0xCD, 0x1C, 0xBE,  0xA6, 0xE7, 0x45, 0x8A, 0x7A, 0xBA, 0xD5, 0x12, 0xA9, 0xD9, 0xEA, 0x1A, 0xFB, 0x22, 0x5E):
    buffer += chr(byte)
print b58encode_check(buffer)

But I got 3RoCeq4K8ddPW6ugcheFoXK4GC2Ajo7ZF which don't look like bitcoin address. What I'm doing wrong?

  • did you find any answer to translate the script to the address? – Erhard Dinhobl May 25 '16 at 13:31
1

See the wiki. Basically you have to extract the 20 byte pubKeyHash (shown as bytes to push) from the scriptPubKey and convert it to Base58 (which is also described in the wiki. There is no need to be online to perform this operation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.