Author

Topic: block raw decode (Read 966 times)

legendary
Activity: 1260
Merit: 1019
January 15, 2015, 02:59:06 AM
#4
Quote
f9beb4d9 - mainnet
1d010000 - lenght (varint)
01000000 - versao

block length is not varint
full member
Activity: 217
Merit: 238
January 14, 2015, 04:03:14 PM
#3
have a easy way to get the raw of each tx?
i miss a byte like "tx lengh" after the tx count...

You have to parse the transaction.

my dificult is because the script count maybe 1 or 2 bytes...

the script length is a varint.  You got the parsing a wrong in the second script.

43 is the length of the script. The script is 4104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4ce f38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac, the first opcode (0x41) pushes the next 0x41 bytes (public key), the second opcode is 0xac (OP_CHECKSIG)

hero member
Activity: 836
Merit: 1021
bits of proof
January 14, 2015, 02:45:58 PM
#2
No need for tx length. Parse transactions starting afte rthe block header following https://en.bitcoin.it/wiki/Protocol_specification#tx
sr. member
Activity: 375
Merit: 254
January 14, 2015, 02:39:09 PM
#1
get the raw of block 0
Code:
f9beb4d9 - mainnet
1d010000 - lenght (varint)
01000000 - versao
0000000000000000000000000000000000000000000000000000000000000000 - hash
3ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a - merkle
29ab5f49 - time
ffff001d - bits
1dac2b7c - nonce
01 - tx count
   01000000 - tx version
   01 - in count
      0000000000000000000000000000000000000000000000000000000000000000 - prev_hash
      ffffffff - vout
      4d - script count (77)
      04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73 - script sig
      ffffffff - sequence
   01 - out count
      00f2052a01000000 - value
      4341 - script count
      04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac - script key
   00000000 - lock time
have a easy way to get the raw of each tx?
i miss a byte like "tx lengh" after the tx count...
my dificult is because the script count maybe 1 or 2 bytes...
Jump to: