I want to get ethereum blocks as binary data and parse them manually to get raw ethereum transactions. Are there any good manuals how to do it?
UPDATE: how ethereum genesis block (at height #0) looks like in binary (hex) form?
I want to get ethereum blocks as binary data and parse them manually to get raw ethereum transactions. Are there any good manuals how to do it?
UPDATE: how ethereum genesis block (at height #0) looks like in binary (hex) form?
Run the following commands (with Geth 1.10.18-stable):
rm -fR /tmp/foo; geth --syncmode full --datadir /tmp/foo
...
... Imported new chain segment blocks=2
Press Ctrl-C when there are some blocks being downloaded.
rm /tmp/block0; geth --datadir /tmp/foo export /tmp/block0 0 0
ls -l /tmp/block0
The size of the file should be 540 bytes.
% hexdump -C /tmp/block0
00000000 f9 02 19 f9 02 14 a0 00 00 00 00 00 00 00 00 00 |................|
00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000020 00 00 00 00 00 00 00 a0 1d cc 4d e8 de c7 5d 7a |..........M...]z|
00000030 ab 85 b5 67 b6 cc d4 1a d3 12 45 1b 94 8a 74 13 |...g......E...t.|
00000040 f0 a1 42 fd 40 d4 93 47 94 00 00 00 00 00 00 00 |..B.@..G........|
00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 a0 d7 f8 |................|
00000060 97 4f b5 ac 78 d9 ac 09 9b 9a d5 01 8b ed c2 ce |.O..x...........|
00000070 0a 72 da d1 82 7a 17 09 da 30 58 0f 05 44 a0 56 |.r...z...0X..D.V|
00000080 e8 1f 17 1b cc 55 a6 ff 83 45 e6 92 c0 f8 6e 5b |.....U...E....n[|
00000090 48 e0 1b 99 6c ad c0 01 62 2f b5 e3 63 b4 21 a0 |H...l...b/..c.!.|
000000a0 56 e8 1f 17 1b cc 55 a6 ff 83 45 e6 92 c0 f8 6e |V.....U...E....n|
000000b0 5b 48 e0 1b 99 6c ad c0 01 62 2f b5 e3 63 b4 21 |[H...l...b/..c.!|
000000c0 b9 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000000d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000001c0 00 00 00 85 04 00 00 00 00 80 82 13 88 80 80 a0 |................|
000001d0 11 bb e8 db 4e 34 7b 4e 8c 93 7c 1c 83 70 e4 b5 |....N4{N..|..p..|
000001e0 ed 33 ad b3 db 69 cb db 7a 38 e1 e5 0b 1b 82 fa |.3...i..z8......|
000001f0 a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000210 00 88 00 00 00 00 00 00 00 42 c0 c0 |.........B..|
0000021c
.ldbfiles you'd need to write a tool that understood the database's schema, and was able to decode the RLP encodings . (I can't remember if something like that already exists - I can't immediately see anything.) If you want to roll your own, I could point you to the Go code in Geth that creates the files? – Richard Horrocks Apr 09 '17 at 19:11