Tuesday, November 5, 2024

handle – Is it doable to retrieve enter addresses and enter values of bitcoin transactions from uncooked blk.dat recordsdata?

E.g. in Python with https://github.com/alecalve/python-bitcoin-blockchain-parser:

#!/usr/bin/env python3

# stdlib
import os
import sys

# Third social gathering
from bitcoin.core.script import *
import blockchain_parser.blockchain

datadir="/residence/ciro/snap/bitcoin-core/widespread/.bitcoin/blocks"
blockchain = blockchain_parser.blockchain.Blockchain(datadir)
for block in blockchain.get_ordered_blocks(
    os.path.be part of(datadir, 'index'),
    cache="cache.pkl",
):
    for txno, tx in enumerate(block.transactions):
        print(tx.txid)
        print('inputs')
        for inp in tx.inputs:
            print(inp.sequence_number)
            print(inp.witnesses)
            print(inp.script)
            print(inp.transaction_index)

necessities.txt

#git+https://github.com/alecalve/python-bitcoin-blockchain-parser.git@c06f420995b345c9a193c8be6e0916eb70335863
git+https://github.com/cirosantilli/[email protected]
requests==2.31.0

I wanted a small patch on my fork: https://github.com/alecalve/python-bitcoin-blockchain-parser/pull/112

Pattern output:

tx 63f9df910b54c60a391e0842cd485c455f9c7fb7c7c79eb07706b2c0ef7ebe93
4294967295
[]
Script(ffff001d 8101)
4294967295
tx 58d089afb985c772232e17dec60c9eed5c281d985cace881fb1f6b34c43e7500
4294967295
[]
Script(ffff001d 5e)
4294967295

At https://github.com/cirosantilli/bitcoin-strings-with-txids/blob/b560fc0bcfb6f0f64a256bdcd15b48810262dc67/primary.py I used some extra of their performance for my functions which can function additional reference.

I have not researched quite a bit earlier than selecting this one, but it surely type of works. Generally I ponder if there is a sooner one although in some compiled language, however this one will get there ultimately.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles