unknown output script in a sample bitcoin pcap file

1

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:

410498361908359fec5adaa624428484e7d117f36f811c7c471f4f1c7dd8184c20b32f0e2590c8d70906ebd585da2ae14ea942e4088891139379b434a26173754750ac

and no op_code is present with 0x41 value.

can anyone explain this matter?

Saeed

Posted 2018-04-28T14:31:00.003

Reputation: 115

further to Rhagav's answer, description of opcodes can be found here: https://en.bitcoin.it/wiki/Script

pebwindkraft 2018-04-28T21:30:03.263

Answers

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)

Raghav Sood

Posted 2018-04-28T14:31:00.003

Reputation: 10 897

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:

https://bitcoin.stackexchange.com/questions/74501/extract-output-address-from-raw-script-in-bitcoin-protocol

Saeed 2018-04-29T08:26:25.910