Bitcoin Forum
April 26, 2024, 09:03:19 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: block raw decode  (Read 963 times)
FabioCarpi (OP)
Sr. Member
****
Offline Offline

Activity: 375
Merit: 254



View Profile
January 14, 2015, 07: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...
1714165399
Hero Member
*
Offline Offline

Posts: 1714165399

View Profile Personal Message (Offline)

Ignore
1714165399
Reply with quote  #2

1714165399
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714165399
Hero Member
*
Offline Offline

Posts: 1714165399

View Profile Personal Message (Offline)

Ignore
1714165399
Reply with quote  #2

1714165399
Report to moderator
1714165399
Hero Member
*
Offline Offline

Posts: 1714165399

View Profile Personal Message (Offline)

Ignore
1714165399
Reply with quote  #2

1714165399
Report to moderator
grau
Hero Member
*****
Offline Offline

Activity: 836
Merit: 1021


bits of proof


View Profile WWW
January 14, 2015, 07: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
johoe
Full Member
***
Offline Offline

Activity: 217
Merit: 238


View Profile
January 14, 2015, 09: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)


Donations to 1CF62UFWXiKqFUmgQMUby9DpEW5LXjypU3
amaclin
Legendary
*
Offline Offline

Activity: 1260
Merit: 1019


View Profile
January 15, 2015, 07:59:06 AM
 #4

Quote
f9beb4d9 - mainnet
1d010000 - lenght (varint)
01000000 - versao

block length is not varint
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!