I start working on bitcoin protocol to extract output addresses from scripts in tx structures. Now in can produce some valid bitcoin address but some scripts are not familiar in op_code lists introduced in bitcoin wiki(script).

for example, the hex stream value of output script in first tx structure of my sample pcap is like this:


and no op_code is present with 0x41 value.

can anyone explain this matter?


1 Answer 1


0x01 to 0x4b are the "push" opcodes. That is to say, whichever opcode you use, that many bytes are pushed to stack. This makes your script:

PUSH(0x41) 0498361908359fec5adaa624428484e7d117f36f811c7c471f4f1c7dd8184c20b32f0e2590c8d70906ebd585da2ae14ea942e4088891139379b434a26173754750 ac

0x41 is 65 in decimal, which is the length of an uncompressed public key. The last byte, 0xAC, is the OP_CHECKSIG

In short, this is a Pay-to-pubkey (p2pk) script, which were common in the early days of Bitcoin. Indeed, it leads to 1MeeajrKNiF8WtD24S4DmVwEPQYJxeh7Ef, which contains the coinbase Bitcoin from block 93641

Bitcoin also has a decodescript method which you can use via the RPC or bitcoin-cli to decode these scripts into opcodes and the addresses (if an address exists for that script)

  • Thank you. exactly i want to extract raw script to gain output address. but with this script, the generated address isn't true. my new question which is related to this question is here: bitcoin.stackexchange.com/questions/74501/…
    – Saeed
    Apr 29, 2018 at 8:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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