Mercurial > public > bitcaviar-plus
comparison README.md @ 28:30535f42d0ff
refactor code
author | Dennis Concepcion Martin <dennisconcepcionmartin@gmail.com> |
---|---|
date | Wed, 02 Feb 2022 21:16:10 +0100 |
parents | 2a4ee2f23e0c |
children | d9537541d623 |
comparison
equal
deleted
inserted
replaced
27:348a07008703 | 28:30535f42d0ff |
---|---|
3 <img src="https://user-images.githubusercontent.com/66180929/136657868-0ec6971b-ed76-43f3-9689-f643e8893706.png" /> | 3 <img src="https://user-images.githubusercontent.com/66180929/136657868-0ec6971b-ed76-43f3-9689-f643e8893706.png" /> |
4 </p> | 4 </p> |
5 | 5 |
6 | 6 |
7 # bitcaviar-plus | 7 # bitcaviar-plus |
8 | |
8 A Bitcoin blockchain parser written in Python. | 9 A Bitcoin blockchain parser written in Python. |
9 | 10 |
10 ## Installation | 11 ## Installation |
11 Clone repository | 12 |
13 ### Recommended | |
14 | |
12 ```bash | 15 ```bash |
13 pip install bitcaviar-plus | 16 pip install bitcaviar-plus |
14 ``` | 17 ``` |
15 | 18 |
19 ### Manual | |
20 | |
21 ```bash | |
22 python setup.py install | |
23 ``` | |
24 | |
16 ## Usage | 25 ## Usage |
17 ### Deserialize first block from file `blk00000.dat` | 26 |
27 ### Deserialize Genesis block | |
28 | |
18 ```python | 29 ```python |
19 from bitcaviar_plus.block import deserialize_block | 30 from bitcaviar_plus.block import deserialize_block |
20 | 31 |
21 | 32 |
22 def parse_genesis_block(): | 33 def parse_genesis_block(): |
24 block = deserialize_block(f) | 35 block = deserialize_block(f) |
25 print(block) | 36 print(block) |
26 ``` | 37 ``` |
27 | 38 |
28 ### Deserialize entire blockchain | 39 ### Deserialize entire blockchain |
40 | |
29 ```python | 41 ```python |
30 import os | 42 import os |
31 from bitcaviar_plus.block import deserialize_block | 43 from bitcaviar_plus.block import deserialize_block |
32 from bitcaviar_plus.errors import InvalidMagicBytes | 44 from bitcaviar_plus.errors import InvalidMagicBytes |
33 | 45 |
45 except InvalidMagicBytes as e: | 57 except InvalidMagicBytes as e: |
46 print(e) | 58 print(e) |
47 ``` | 59 ``` |
48 | 60 |
49 ### Example output | 61 ### Example output |
62 | |
50 ```json | 63 ```json |
51 { | 64 { |
52 "magic_number":"f9beb4d9", | 65 "magic_number":"f9beb4d9", |
53 "size":"0000011d", | 66 "size":"0000011d", |
54 "id":"000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f", | 67 "id":"000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f", |