1

I'm attempting to download the entire blockchain and then run some analysis of wealth distribution at various points in time and in response to specific events. A website like blockchain.com's block explorer is similar to what I would like, but scrolling through hundreds of pages for thousands of blocks isn't exactly feasible

I've already downloaded bitcoin core and disabled pruned storage, but have noticed that the 'blocks' folder contains blk files only up to ~3000, and there are these rev files up to the same number. I'm confused, because this is obviously nowhere near the actual current block height, but as far as I can tell, I should have everything.

1
  • The first blocks are so little in size, so many of them fit into a large blocks file.
    – Mercedes
    Nov 3, 2022 at 1:09

1 Answer 1

3

the 'blocks' folder contains blk files only up to ~3000, and there are these rev files up to the same number. I'm confused, because this is obviously nowhere near the actual current block height,

That is because each block file contains many blocks, not just one per file.

Each block file is about 128 MB. The earliest files will contain nearly 120,000 blocks each. Recent files will contain about 100 blocks each.


What follows is rather lengthy and may be of no interest to most readers - if you are not OP, you should probably skip it.

We can see how many blocks were in the earliest block file:

C> blockchain -file blk00000.dat -longstats

Statistics for blk00000.dat (2009-01-03 to 2011-04-25)

119967 blocks
435199 transactions (3.6 per block)
     0 Segwit tx    (0.0%)
623168 inputs       (mean 1.4, max 965 per transaction)
653813 outputs      (mean 1.5, max 100 per transaction)

We can compare that with the number of blocks in a more recent block file:

C> blockchain -file blk02400.dat -longstats

Statistics for blk02400.dat (2021-01-09 to 2021-01-10)

   105 blocks
236980 transactions (2257.0 per block)
112027 Segwit tx    (47.3%)
642768 inputs       (mean 2.7, max 1033 per transaction)
710364 outputs      (mean 3.0, max 4107 per transaction)

The exact contents of each block file will vary from computer to computer but these sort of statistics probably won't vary very much.

We can list the blocks in a block file:

C> blockchain -file blk02400.dat -blocks
   No.|Date and Time   |   Txs|Target  |Id
------|----------------|------|--------|----
     1|2021-01-09 20:25|  3391|170DA8A1|00000000000000000005F03FFA1CE2A9E9D0CE2277C41485F34023472C1356B7
     2|2021-01-09 14:10|  1306|170F2217|00000000000000000004D6301FB493DE076F1668542CFF5092291C5FF668C80A
     3|2021-01-09 20:38|  3100|170DA8A1|00000000000000000008093D43CEB62AC2722189506B7A10B5446FC00E7320C0
     4|2021-01-09 14:16|  2821|170F2217|000000000000000000034F3F40D021B75ED2C059C9FACAD18E6C3B23E5AB87EF
     5|2021-01-09 15:01|  3314|170F2217|00000000000000000006E955A5F5543A9E3DBD5FD6F098BF9A3B376432C682F7
     6|2021-01-09 15:05|  2485|170F2217|00000000000000000003A919868B680476494C6EEDE8CFEFF44AB3EF2D6CEE65
     7|2021-01-09 15:09|  2854|170F2217|0000000000000000000809B96117D2C6C958977AA5B7EE41E1BFC8CDEC6FD78F
     8|2021-01-09 15:18|  2143|170F2217|0000000000000000000EA5ABC8D23CE15F85AFBDF574DA6C82C67BEF5DF0D752
     9|2021-01-09 16:25|  2510|170DA8A1|00000000000000000008063A0A93F2480FC1AAA838459B0CE5C1F483AA79DF18
    10|2021-01-09 16:35|  2731|170DA8A1|000000000000000000002F9BDAE5CF1DE5F886A8DB38CDED6B612A1CEF918CAC
    11|2021-01-09 16:42|  2892|170DA8A1|000000000000000000082B6D302C835B7D4BBC328D9E4B9E8A50BBE3782E0903
    12|2021-01-09 17:12|  3110|170DA8A1|0000000000000000000C1AC5FED21866D539379AB6FDF1A59FCF9B7685D10F71
    13|2021-01-09 17:44|  3125|170DA8A1|000000000000000000065E39F6F57DAF0EA29F64B3D610A94A2024E9C889E9A7
    14|2021-01-09 17:48|  2787|170DA8A1|0000000000000000000D67AE7AC5BF50715EB23B5B86E22998D12769C91AFC71
    15|2021-01-09 17:52|  3083|170DA8A1|000000000000000000082F723B665098596F00FCD6EAF0A363580686DA70C713
    16|2021-01-09 18:07|  2246|170DA8A1|0000000000000000000790E48A8F98EE34D9A16D6153258ED9CF6607ED25FE6B
    17|2021-01-09 18:08|  1774|170DA8A1|0000000000000000000779F3123A2F1FF5B94589B598E160E288AFA33EB8F4EF
    18|2021-01-09 18:28|  2968|170DA8A1|00000000000000000007E224F729A414BCCBE799917453BE54DA9E36C1CC668C
    19|2021-01-09 18:35|  3223|170DA8A1|0000000000000000000402C3D1AE9D7A6BFAB7302EA0C53991397F492C7EBA83
    20|2021-01-09 18:43|  2950|170DA8A1|00000000000000000001F53E1B3F61713D33C0EF13F9A7FEED760C33317632AB
    21|2021-01-09 18:47|  2502|170DA8A1|00000000000000000008FACFF8297CC0E610023F7B73D46E641DA355D9B8A521
    22|2021-01-09 18:54|  2860|170DA8A1|000000000000000000045206A88D6265417AA4E61E517F16FEC65F7831F7A3BC
    23|2021-01-09 19:25|  3288|170DA8A1|0000000000000000000BB38AA4D289F78EC84DD2953D47C52DF427C3CB6EB06B
    24|2021-01-09 19:52|  3081|170DA8A1|00000000000000000001E66AD20E29AC4675D3EF0AB166BD402C01F26A5CC562
    25|2021-01-09 20:38|     1|170DA8A1|00000000000000000005BACEFC27B5960FDD85E1590C75B82454F6C14558975F
    26|2021-01-09 20:51|  2790|170DA8A1|0000000000000000000B9E1C8531CA827A4AFE5B98F57FFEC34BCFCFE797BE47
    27|2021-01-09 21:07|  2689|170DA8A1|0000000000000000000ABB087C2C1598264C3F05CCD2CCDD792A690DA65D8459
    28|2021-01-09 21:24|  2998|170DA8A1|0000000000000000000970E063C43C2A92CB9CF33500A0FE6A2F1A4DD6162530
    29|2021-01-09 21:28|  3288|170DA8A1|00000000000000000006D4021E0ED2F8F08720E826E5260563A6BEA24156E10E
    30|2021-01-09 21:30|  2382|170DA8A1|00000000000000000001EB0DC4D4263AB5E78710D3F6953E64CAEABECBB09B3D
    31|2021-01-09 21:51|  3015|170DA8A1|000000000000000000023A99AD2C797E17B3637D3F33C4591CFF3847F85E8494
    32|2021-01-09 22:00|  2838|170DA8A1|0000000000000000000D5DE02C30786604A52E1888A9536D04C6A9635D161C1F
    33|2021-01-09 21:59|  3004|170DA8A1|000000000000000000019988DB5E710916F7FD8CBAE11C969E6A035569780D18
    34|2021-01-09 22:04|  1142|170DA8A1|0000000000000000000B50CB3CF533334B50A62CB4A936A510A92E5D93B57125
    35|2021-01-09 22:08|  2409|170DA8A1|00000000000000000007FC98B36B1F5A07BA3C89CB584460B9343B4D26322014
    36|2021-01-09 22:23|  3090|170DA8A1|00000000000000000000E7F692996D702284AA4C13E84CA4977E7EEC7E0ABB1F
    37|2021-01-09 22:28|  3012|170DA8A1|0000000000000000000B6CE97DC6F3F7133C0763162D5F3CB14F995C2390A2E8
    38|2021-01-10 00:37|  2394|170DA8A1|0000000000000000000320A02F11EC2D73EFE1573668841528C36B0BB435F3AD
    39|2021-01-10 00:45|  2139|170DA8A1|00000000000000000009570ED0935D992B9B7BB6EB3CF101AA5E0377EE2AEF77
    40|2021-01-10 01:02|  2572|170DA8A1|00000000000000000001D10CB8EDEED36BAA9FC4378DB1963B8D74BC5CB111BC
    41|2021-01-09 22:44|  2655|170DA8A1|00000000000000000002F03956DDA2F7A3F382A2664411BE524527A16EC21812
    42|2021-01-10 01:48|  3223|170DA8A1|00000000000000000006D0758FB720F5B51E4A371BAAA3FF6BF3B76B954B7B43
    43|2021-01-10 01:52|  2546|170DA8A1|0000000000000000000B6FE4B5B3EAE044A9DBA9E6004A0F9A67B9DE82D069A8
    44|2021-01-09 22:45|  2938|170DA8A1|00000000000000000009617534D22D9D32E7E72EC73CB6812200490823CE22A4
    45|2021-01-10 01:54|  2989|170DA8A1|0000000000000000000A94CE6F96F4949F777CFD6F2DCC7E3FFC8F1734E49337
    46|2021-01-09 22:59|  2681|170DA8A1|000000000000000000017A1EA207A0B13EB1891EC20A687E4ED95A5B5DF9332E
    47|2021-01-10 01:55|  1068|170DA8A1|00000000000000000006EAFC816EBD106DB34B2A06818CAA5AF5C1814C10DF4F
    48|2021-01-09 23:07|  2357|170DA8A1|000000000000000000067F8C48BAC6335D70815C719E82871CB9978D8307FB95
    49|2021-01-09 23:19|  2725|170DA8A1|00000000000000000008AA5D1D8C3F5153A22924ECE549223BCF1B2AFB957439
    50|2021-01-10 01:57|  1028|170DA8A1|00000000000000000005D44140FAE05F0EDE3F9E120896379BBE59E93EB0D0B2
    51|2021-01-09 23:44|  2971|170DA8A1|00000000000000000006B229DE520567FA6484555DE3856FCD118E18E4DC8BE3
    52|2021-01-10 02:03|   917|170DA8A1|000000000000000000046ABC7E5ABE57F5E7AE3AF246BF4443D2C8B423B479C5
    53|2021-01-10 00:00|  2320|170DA8A1|00000000000000000006BC39AFAF382CA492D2026DD067FDE4E52BCDBE8EAD07
    54|2021-01-10 00:04|  2449|170DA8A1|00000000000000000005C205D5E55CE8ED68299F99D4A9DDB77D980F2B7A7702
    55|2021-01-10 02:40|  2974|170DA8A1|00000000000000000008BC4F146D04E8109381E62E82CF1AE1C2637DDF0B897F
    56|2021-01-10 00:04|  1779|170DA8A1|0000000000000000000363078973EC40F7B487B47D11009DAAC1AB9D7BE84E81
    57|2021-01-10 02:57|  2199|170DA8A1|0000000000000000000B353F8218E01BB241FAC0CDD161D26CA3874403BBF39C
    58|2021-01-10 00:21|  2337|170DA8A1|00000000000000000005E540A870558B5C9F35E387623C121A5CB8313F18136B
    59|2021-01-10 03:16|  2524|170DA8A1|00000000000000000000C65854E22F72448001E42410D7C3EFD11C98F6C3D667
    60|2021-01-10 03:18|  1807|170DA8A1|00000000000000000000187015798F996931DEB860CBB1C6C685EAA877EB9101
    61|2021-01-10 03:26|  2387|170DA8A1|000000000000000000057D10C92F02C85301358E10F339D5F9752A0873BACA17
    62|2021-01-10 03:28|  1869|170DA8A1|000000000000000000016A6CE5807975CFF07EB74E0B4EB79ACF451490ECF059
    63|2021-01-10 00:21|   893|170DA8A1|000000000000000000012A969245697ECEB07BE3D3ACDE233FA73271D6F5BECA
    64|2021-01-10 00:24|  2086|170DA8A1|00000000000000000008B33D07FC50EDA338425126F04123C7F69431956BFA86
    65|2021-01-10 03:30|  1450|170DA8A1|000000000000000000054F2BA4109E5F3CE8B66EEBC3DC5F6F178468DC9365E3
    66|2021-01-10 07:14|   263|170DA8A1|0000000000000000000D44DC06A741E3439BC6EBE2A112F295AE1C840B2A6FC6
    67|2021-01-10 04:29|  1781|170DA8A1|000000000000000000058277A6AD6B20E7C0E40039CC127013B9EC78C3CF38F8
    68|2021-01-10 07:36|  2448|170DA8A1|00000000000000000002C46C92D4411C7A91E4D3EAA656CD9E40A6C7F2526AA1
    69|2021-01-10 03:34|  2009|170DA8A1|00000000000000000006833F3DB67898D0BEAB11F8DE110490AB1AD134BA0930
    70|2021-01-10 10:02|  1181|170DA8A1|00000000000000000008E23F0ACAE31EC0806578D9C0F082A3B4A203984B9859
    71|2021-01-10 10:12|  2293|170DA8A1|0000000000000000000B8F65405332FD550208E9A9593CB69E21934F69688846
    72|2021-01-10 07:39|  2044|170DA8A1|00000000000000000004A6ED454C9621E4E007DACC7149A83945D5F09A89DBD2
    73|2021-01-10 04:30|  1881|170DA8A1|00000000000000000004478B792B36E692A93D61B8A298DA32ADEC7FFE96F0EF
    74|2021-01-10 03:49|  2317|170DA8A1|00000000000000000001B1F1D934D0CC4D936E47292574FCF030E2BB364F13F3
    75|2021-01-10 10:24|  2818|170DA8A1|0000000000000000000B5A5054E5F45A223921EB750FB24A0ADEDC1D4E7EF41D
    76|2021-01-10 04:40|  1807|170DA8A1|000000000000000000010B2CF32CDCC2F7669B6F587541DD430F4C99C9DDDDF1
    77|2021-01-10 04:01|  2090|170DA8A1|00000000000000000000DE313796DF16EF4789FC6B7704E2A7E667225DC77B42
    78|2021-01-10 07:41|   318|170DA8A1|000000000000000000036461F9B3BFF8CDB0D0B4D8C757B1A626DE8687CBDB62
    79|2021-01-10 07:50|  1849|170DA8A1|0000000000000000000383C9E6C3547E7B47A949320A9ADF9C97575383D32CAF
    80|2021-01-10 10:32|  2378|170DA8A1|000000000000000000000103B3CE7C49083C6A2532E0725DFA3F332F4D474FEC
    81|2021-01-10 04:57|  1015|170DA8A1|0000000000000000000C1EB6DA67CF140E21C29ECB760FCB4F61781E3A7D8AEA
    82|2021-01-10 05:01|  1156|170DA8A1|0000000000000000000B0E5EEC04D784347EF564B3DDB939ECA019A66C9CEDBE
    83|2021-01-10 10:39|  2529|170DA8A1|0000000000000000000D8C72FFEEBE65B9C655B02B52F1941EA009505FCE083A
    84|2021-01-10 07:55|  1295|170DA8A1|0000000000000000000AB5EC32EC090CCEF7F8EE3D7546CEF18A1C0B93472108
    85|2021-01-10 04:25|  2201|170DA8A1|00000000000000000009A2A303DC09CF54FDC5F61767CA3A5E28F87FAC4094D2
    86|2021-01-10 07:58|   749|170DA8A1|00000000000000000006BE3C3D4FCAC8CC2227AF410DB11E36ED8F07C2E5E96B
    87|2021-01-10 04:56|  2312|170DA8A1|00000000000000000008EBCA9E4D528F653D8226CA83DDBDCB41F93272A522C9
    88|2021-01-10 05:07|  1501|170DA8A1|0000000000000000000097E9159B5CF374DB6E8E11F6C5F451AB86390D58C824
    89|2021-01-10 05:10|  1540|170DA8A1|00000000000000000001C49986FC8AA30FE1F06F468A56FB2AF3F29C5AF1B175
    90|2021-01-10 16:26|  1542|170DA8A1|0000000000000000000A6295DEF22EC0FFCBB70AA5A34A14567214AC9550FCA0
    91|2021-01-10 05:49|  2861|170DA8A1|0000000000000000000541A910624C40CEC96C823D78F0C3D49E68D2C8DF1752
    92|2021-01-10 08:10|  1104|170DA8A1|0000000000000000000CB4F5452A21ECB1819427D10914DF21217DCA9CCA7B69
    93|2021-01-10 05:27|  2502|170DA8A1|00000000000000000009475315532F65460EEAF7D7F7E9FAD998C3996FD7A0CB
    94|2021-01-10 10:40|  1619|170DA8A1|0000000000000000000B11842312A15FB02D7CDEFEAF3A68932D43F3229FB40D
    95|2021-01-10 10:53|  2453|170DA8A1|00000000000000000006D1189E451EFAB7E4492E8CD4984E526B7EDC3BC3F7D5
    96|2021-01-10 08:29|  2378|170DA8A1|0000000000000000000793AA8C982AB702B932C7316500E586A2C52CA2C1E863
    97|2021-01-10 16:39|  2808|170DA8A1|0000000000000000000022131D35DDE7409AD4C022521A2E32C3819DAF0B4347
    98|2021-01-10 06:05|  1831|170DA8A1|0000000000000000000267AF6B6E9CDEB5C89A2672086E7D73171FB26068357A
    99|2021-01-10 17:09|  2958|170DA8A1|00000000000000000002FE8AD94D018446BBEB804B375E1285AD3D490C630367
   100|2021-01-10 06:05|  1678|170DA8A1|00000000000000000007CC6F90325D941B9957E185B17E8E8384707090DB17EF
   101|2021-01-10 08:31|  2452|170DA8A1|000000000000000000067EDE91AE7F27BB9A7276FA65D86C59DA871BAB262925
   102|2021-01-10 10:59|  1584|170DA8A1|00000000000000000000E102B9C2A2376F719A4B4BC01547F4F43F71D35F4CBA
   103|2021-01-10 17:13|  2410|170DA8A1|000000000000000000022EE80DFD3BDAB9496AD70834D061604BCDC661080A45
   104|2021-01-10 06:17|  2080|170DA8A1|000000000000000000038BE25434EEB0A039570832D1072FE92F369AD75DCE4D
   105|2021-01-10 11:06|  1466|170DA8A1|00000000000000000002843A3630C957361D1408F26C34FAC7CD02B39E3F6D97

We can list all the transactions in one of those blocks

C> blockchain -file blk02400.dat -block 52

Summary of transactions in block 000000000000000000046ABC7E5ABE57F5E7AE3AF246BF4443D2C8B423B479C5
---

 No.|V|Type  | Ins|Outs|Lock  |B  Satoshi |Id
----|-|------|----|----|------|-----------|---
   1|1|Segwit|   1|   4|2008-09-28 03:27|  721158157|DB1EEB1CF856BE1B38BAE46C2C5A2B29F2E619F8034D2DABA19DB1F91B8FB19F
   2|2|Segwit|   1|   4|665346| 2368483760|50B15923336D75D30CA20646A8118E78B8EEBB98015634F53935367650B59C18
   3|1|Segwit|   1|   2|     0|    1641325|416AB808A3DE945971B0D6FCC182B70E3B75FF5577D456C723B1AC5D97FB2453
   4|1|Legacy|   1|   3|     0|      30913|DC672971AC8708FC8180D7E274CDAB581281CDCEAAE39FF00B52C9EDAD12E6B5
   5|2|Legacy|   2|   3|     0|   22538288|56120BFFA44B7F69040DB578D556E786C8E1D629468A6ACDC6EAE1E11E98D375
   6|1|Segwit|   1|   1|     0|    1258946|E2D8F22094842D4042C557699D7EC6BD4604AA90A503C5C1EFDF844119E25E47
   7|1|Segwit|   1|   2|     0|   28916308|1CE48F8C0F0F72AF64E1E50D59911C5988369D1CC2B17F65CE62D10DA8B9B451
   8|1|Segwit|   1|   2|     0|  266778494|0C6FEA9B49ED3C213515422066FEFD8B7AF33B0DFA56738B66EDA3BF215E8956
   9|2|Segwit|   1|   3|     0| 4559557687|374A9D3F692C4CF790513829F9C2E92B5835DE2393994FC09A516B2412A35FB5
  10|2|Segwit|   1|   2|665346|   23873450|DB3C282C7AAF1CB616CD28DA69D44E07CFC3224852B07863B43DBF2DB1FC84E3
  11|2|Segwit|   1|   2|665346|   23629326|76F2BBA4E7A677B3CAF90FBBD2A5CBFDD35421FF8B57375BEF393B1CEA6E4877
  12|2|Segwit|   1|  10|665346| 1272773474|03CE4A39D72720FDB080E5F70167528CFCB1548ED59DF1A06BDE4AE8ABA2E581
  13|2|Segwit|   1|   2|665346|   21573654|9011B154E9CC3F9EBA2AB9403658D43EEDABA8DEA21191474B6ECB11CAC964F3
  14|2|Segwit|   1|   2|     0|  170071125|534672155360AD914EC9103609F238F36757CEA280A585ECDB9933ED1177E45F
  15|2|Segwit|   2|   2|     0|  651807440|E45F67A948B7A078CC32F7C859BE65DEF8F403C01D8B62121DF13123413154F5
  16|1|Segwit|   1|   3|     0|   36707310|83453CEA55D387C52AD9C828475FA31E85E79224C52E97F20BB70A5FFFBB5F77
  17|1|Segwit|   1|   2|     0|   84156628|A3337D6986E33AD73C8A5734864678B7904C23646BA215A2A990146A43A8EF0B
  18|1|Segwit|   1|   2|     0|   83776167|328ECBE080CDCE1CF23CC30099ABDAA4491096575A77C1319B0208C78AF20295
  19|1|Segwit|   1|   2|     0|   80934141|08D77F850C783C544BE9B868106885DB86D6D5B8FCB07ACE6EF191D8BD606AA2
[...]
 895|2|Segwit|   2|   2|665346|    1123442|45D7FE4FB4D1E83DFC194E8446A9BCA2B3EABC8E0B635E1C1CD35C1711134780
 896|2|Segwit|   1|   2|     0|    1120741|8D2656BF376646F8681E109C1FD188E54DBED8211C6951AE77AB726B7C123B2C
 897|2|Segwit|   1|   2|     0|    1269934|B57740E0960DCA911CFF075A409E79402E7C4588C7BA1BB27A90ABF2D792E171
 898|2|Segwit|   1|   2|     0|    1261686|9D79E4B68352AF3AC6F2E45267886346CAFBDE63A1D07ACD189E9CDD9A83DFB5
 899|2|Segwit|   2|   2|     0|    2100882|52D8EBD3AE147FA5532E9460D969161188A34E1D7030A535E33C898836B795A5
 900|2|Segwit|   2|   2|     0|     376227|C44E060847E801ACBD4828E9746637D05E7C8ABF231993389CAFB960C5DBD477
 901|2|Legacy|   1|   2|665346|    4487935|7E45C209782CFC1AFAAD693E709237DCFF362F97E12B3DD8B4F25F27B1CE07B9
 902|1|Legacy|   2|   2|     0|   12712070|C120857602717596C994074211E648D5F821F71A1242C2038B657DA0F494C115
 903|1|Legacy|   1|   2|     0|   12387703|D5BBD8BAC026E6BE9FB2FFBF501866654E1DA90977B2802EDA7CBCE0933C6178
 904|1|Legacy|   1|   2|     0|   12063336|54EC992AC654BE36CEA7B9FC5F5ED33C47748E0BFC575C960781593A850CA6E7
 905|1|Legacy|   3|   2|     0|     924996|16B9AE3BAFD97D81C30C62693BA27C3554A008C7E621B293A06102B1FD6B2C18
 906|1|Segwit|   2|   2|     0|     666448|91BC39C91FDD3A656864816AC7584EA92899BACF9ED67F7668416D6030BA4D54
 907|2|Segwit|   2|   2|     0|    1101827|DCF22A62A39B6A3FB96E0FE3C352C0062B88568187DF97319DFEF4292D2F6891
 908|2|Segwit|   4|   2|     0|    1086016|82F76CC637809D141CEB8D583CD39A753DA5F7A93A49E4105BFA92F976AD64DF
 909|2|Segwit|   5|   2|     0|    1299211|8CA7B8B8B07C6E3C31D697FBA002E74AFBE6D0058B25F5ED9FD05EC7D47DB424
 910|1|Legacy|   1|   1|     0|      65955|79F10524D4C967C9A49A4079A1C7DA7CD6E05ED32431FF85A0139987E26D6E6B
 911|1|Legacy|   1|   2|     0|     271693|5E7008861A027CCAE77EA278C1163E4BBC3B227B7996F55A5354EBB297C9538F
 912|1|Legacy|   1|   2|     0|     208668|C92FCA753825AF19A1814AA01CF8209319698B1BAFF63A83DC4C0D1B7BF8B02F
 913|2|Segwit|   1|   2|     0|     184940|5320656D370F4187CB13415944285AD5193B730AF41C5DBFABB0AE4E6A6DFC47
 914|1|Segwit|   1|   1|     0|      31481|BE41200E7E0F021A9C86CC79150342544A15A94DF082B4A1E93CA2044BBB8C68
 915|1|Segwit|   2|   1|665347|      90593|7FF57A09259E3E9FC037F3143FBBD852A0D029DE398C12056CD2F23B1FE870C3
 916|1|Legacy|   1|   1|     0|      24265|33CA23938986D73C509BCCD7009CD9E6850A995E14C5B7865B3410446AF07035
 917|1|Segwit|   1|   3|     0|   49329046|BE7F6C492EAD97FA3B6C45184740BE3E71C0C233B41AB65FE27B5A2BF7D3E1D6

We can examine a transaction from that block:

C> blockchain -file blk02400.dat -block 52 -tx 886
Transaction Details in Hex (Decimal/Symbolic):

  Version:................02000000 (2)
  Type:...................0001 (Segwit)
  Inputs:.................03 (3)
  Input:1
    Previous Transaction:.83DF8B6DF89B5F7277BAA7D7BA09061FA1B582F2220827D0D33520276BDD78CC
    Previous Output Index:0007 (7)
    Script Length:........17 (23)
    Unlocking Script:.....1600147F1F6A45857B1F358C984B07890F9115D226F8C9
    Sequence:.............FFFFFFFF
  Input:2
    Previous Transaction:.6198DFBF9FB6F4AE7C4DD38F7CC375CA960F6878732EE0697254562D3589559E
    Previous Output Index:0001 (1)
    Script Length:........17 (23)
    Unlocking Script:.....160014ECD7D1B0B8E482D19273326EF77A6EC0A431FB34
    Sequence:.............FFFFFFFF
  Input:3
    Previous Transaction:.0CE30827913BEC7A2EC5216D2796E9D1E23B00B6B875BE03854053E35F95CF52
    Previous Output Index:0001 (1)
    Script Length:........17 (23)
    Unlocking Script:.....1600141C3A7B47ACE893C90CF01983AE2CB54CCA5EE5BC
    Sequence:.............FFFFFFFF
  Outputs:................02 (2)
  Output 1
    Value:................C57A010000000000 (96965)
    Script Length:........19 (25)
    Locking Script:.......76A9147A6DF010C56E2AC4C72F7A5948ED1BAE7ACED92D88AC
  Output 2
    Value:................8205000000000000 (1410)
    Script Length:........17 (23)
    Locking Script:.......A914EF2532E20719E9D40E3A3FE35472FAD80E9B968A87
  Witness 1
    Item Count:...........02 (2)
    Item 1
      Length:.............48 (72)
      Data:...............3045022100D14107F6DDB48AB581E1662E75483466AB5999B306648E61DFDFC3
                          187A7BCDA502207D819B60D30CAC8CB90A017B5A5FC252D03FEBDBE1CB26B748
                          ADEBF23051502401
    Item 2
      Length:.............21 (33)
      Data:...............024C0DB5B46BAF3985BA6CFDD618BF0A32DB00A7A7238CA10D6EF3F78A0DC75C
                          38
  Witness 2
    Item Count:...........02 (2)
    Item 1
      Length:.............47 (71)
      Data:...............304402202276F11B85E56DB648B71BD82B2BBD68C79A810C135123B6134CE7A7
                          4AD613250220085E6CAA73AD9A3BF512BD10DC093DE9CA2FCDEDE0EDD6A3E79C
                          F4371816F10601
    Item 2
      Length:.............21 (33)
      Data:...............02133ADFA21764CD0B13542A7598388B4C91F4F1E6A42A43472AB5052C550DED
                          30
  Witness 3
    Item Count:...........02 (2)
    Item 1
      Length:.............47 (71)
      Data:...............304402204F91C97137BAFB6CE5BAB8588C887D2CDA9BA9FAA9BE03B980E925F8
                          125547F602203F10604628B9472A284A3119D745AF5802AA454BDEA1E4CE8F6B
                          A30DC34ECC3901
    Item 2
      Length:.............21 (33)
      Data:...............026A9722A6DFA935E36C27D9D0BE5BED54FB96D332E368CC4216F6E6D821477A
                          B5
  LockTime:...............00000000 (0)
  (Calculated hash is 94A7F510C18ABA66FAD5B688C14FC4054A25CC3E525B828954A37277F3A50483)

We can look at the same transaction formatted as a markdown table:

C> blockchain -file blk02400.dat -block 52 -tx 886 -format md

TXID: 94A7F510C18ABA66FAD5B688C14FC4054A25CC3E525B828954A37277F3A50483

Hexadecimal Data Meaning
02000000 Version 2
0001 Type Segwit
03 3 Inputs
83DF8B6DF89B5F7277BAA7D7BA09061FA1B582F2220827D0D33520276BDD78CC Input 1 : Previous Transaction ID
0007 Input 1 : Previous Output Index 7
17 Input 1 : Script Length 23
1600147F1F6A45857B1F358C984B07890F9115D226F8C9 Input 1 : Unlocking script
FFFFFFFF Input 1 : Sequence
6198DFBF9FB6F4AE7C4DD38F7CC375CA960F6878732EE0697254562D3589559E Input 2 : Previous Transaction ID
0001 Input 2 : Previous Output Index 1
17 Input 2 : Script Length 23
160014ECD7D1B0B8E482D19273326EF77A6EC0A431FB34 Input 2 : Unlocking script
FFFFFFFF Input 2 : Sequence
0CE30827913BEC7A2EC5216D2796E9D1E23B00B6B875BE03854053E35F95CF52 Input 3 : Previous Transaction ID
0001 Input 3 : Previous Output Index 1
17 Input 3 : Script Length 23
1600141C3A7B47ACE893C90CF01983AE2CB54CCA5EE5BC Input 3 : Unlocking script
FFFFFFFF Input 3 : Sequence
02 2 Outputs
C57A010000000000 Output 1 : Value 96965
19 Output 1 : Script Length 25
76A9147A6DF010C56E2AC4C72F7A5948ED1BAE7ACED92D88AC Output 1 : Locking script
8205000000000000 Output 2 : Value 1410
17 Output 2 : Script Length 23
A914EF2532E20719E9D40E3A3FE35472FAD80E9B968A87 Output 2 : Locking script
02 Witness 0 : Item Count 2
48 Witness 0 : Item 0 : Length 72
3045022100D14107F6DDB48AB581E1662E75483466AB5999B306648E61DFDFC3 Witness 0 : Item 0 : Data
187A7BCDA502207D819B60D30CAC8CB90A017B5A5FC252D03FEBDBE1CB26B748 Witness 0 : Item 0 : ...
ADEBF23051502401 Witness 0 : Item 0 : ...
21 Witness 0 : Item 1 : Length 33
024C0DB5B46BAF3985BA6CFDD618BF0A32DB00A7A7238CA10D6EF3F78A0DC75C Witness 0 : Item 1 : Data
38 Witness 0 : Item 1 : ...
02 Witness 1 : Item Count 2
47 Witness 1 : Item 0 : Length 71
304402202276F11B85E56DB648B71BD82B2BBD68C79A810C135123B6134CE7A7 Witness 1 : Item 0 : Data
4AD613250220085E6CAA73AD9A3BF512BD10DC093DE9CA2FCDEDE0EDD6A3E79C Witness 1 : Item 0 : ...
F4371816F10601 Witness 1 : Item 0 : ...
21 Witness 1 : Item 1 : Length 33
02133ADFA21764CD0B13542A7598388B4C91F4F1E6A42A43472AB5052C550DED Witness 1 : Item 1 : Data
30 Witness 1 : Item 1 : ...
02 Witness 2 : Item Count 2
47 Witness 2 : Item 0 : Length 71
304402204F91C97137BAFB6CE5BAB8588C887D2CDA9BA9FAA9BE03B980E925F8 Witness 2 : Item 0 : Data
125547F602203F10604628B9472A284A3119D745AF5802AA454BDEA1E4CE8F6B Witness 2 : Item 0 : ...
A30DC34ECC3901 Witness 2 : Item 0 : ...
21 Witness 2 : Item 1 : Length 33
026A9722A6DFA935E36C27D9D0BE5BED54FB96D332E368CC4216F6E6D821477A Witness 2 : Item 1 : Data
B5 Witness 2 : Item 1 : ...
00000000 LockTime 0

My parser is a work in progress (very occasionally) but there are several other blockchain parsers available.

3
  • Ah that makes much more sense, thank you! This still leaves me with the question of how to get the actual transactions out from the block, and not just block-level statistics though..
    – incendiary
    Nov 3, 2022 at 2:25
  • 1
    @incendiary: use a block file parser, I believe there are some available. I wrote my own based on the protocol documentation. See amended answer for example. Nov 3, 2022 at 9:46
  • thanks a ton for all this. Definitely cleared a lot of things up for me
    – incendiary
    Nov 4, 2022 at 12:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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