Mercurial > public > bitcaviar-plus
comparison main.py @ 6:5f6d1a28051a
add python package config files
author | Dennis Concepcion Martin <dennisconcepcionmartin@gmail.com> |
---|---|
date | Sun, 24 Oct 2021 15:18:54 +0200 |
parents | 1a8d94b500d8 |
children | e4afde8d5a7e |
comparison
equal
deleted
inserted
replaced
5:1a8d94b500d8 | 6:5f6d1a28051a |
---|---|
1 import json | 1 import os |
2 from src.block import read_block | 2 from src.puppy.block import read_block |
3 | 3 |
4 | 4 |
5 def main(): | 5 def main(): |
6 with open('/Users/dennis/Bitcoin/blocks/blk00000.dat', 'rb') as f: | 6 file_path = '/Users/dennis/Bitcoin/blocks/blk00000.dat' |
7 for i in range(1): | 7 |
8 with open(file_path, 'rb') as f: | |
9 number_of_bytes_in_file = os.path.getsize(file_path) | |
10 | |
11 while f.tell() < number_of_bytes_in_file: | |
8 block = read_block(f) | 12 block = read_block(f) |
9 with open('test_block_0.json', 'w') as f_test: | |
10 json.dump(block, f_test, ensure_ascii=False, indent=4) | |
11 | 13 |
12 | 14 |
13 if __name__ == '__main__': | 15 if __name__ == '__main__': |
14 main() | 16 main() |