Using blockchain_parser to parse blk files stored on S3
14:09 12 May 2022

I'm trying to use alecalve's bitcoin-parser pkg for python. The problem is, my node is saved on an s3 bucket. As the parser uses os.path.expanduser for the .dat files dir, expecting a filesystem, I can't just use my s3 path. The example from the documentation is:

import os
from blockchain_parser.blockchain import Blockchain


blockchain = Blockchain(os.path.expanduser('~/.bitcoin/blocks'))
for block in blockchain.get_ordered_blocks(os.path.expanduser('~/.bitcoin/blocks/index'), end=1000):
    print("height=%d block=%s" % (block.height, block.hash))

And the error I'm getting is as follows:

'name' arg must be a byte string or a unicode string

Is there a way to use s3fs or any different s3-to-filesystem method to use the s3 paths as dirs for the parser to work as intended?

python amazon-s3 filesystems