Questions tagged [python]

Python is an interpreted, general-purpose high-level programming language whose design philosophy emphasizes code readability.

1 vote
1 answer
31 views

Reading blk.dat files using pybtc does not yield transactions

I am trying to parse the blk.dat files using pybtc but I can't seem to get this right. f = open(block_filename, "rb") lines = f.readlines() for block in tqdm(lines): ...
4 votes
1 answer
60 views

How do you construct witness stack and controlblock in P2TR Script Path outputs?

I have been documenting how to create different types of Tx outputs here, leveraging the Bitcoin Core Test Framework. Particularly for Taproot, I'm working on a scenario of a P2TR Script Path with a ...
0 votes
1 answer
97 views

How to create SegWit address from mnemonic in Python 3.8.10

I am having trouble creating SegWit address from mnemonic. I can't find any useful code to do that. I tried using BitcoinLib but I don't know how to disable saving wallets to disk. EDIT: I found ...
3 votes
1 answer
80 views

Optimising blockchain parsing with rpc + python

I have a python app to track and store utxo in a simple/flat structure that looks like this... from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException # track the utxo trackUtxoList = [] ...
  • 275
0 votes
0 answers
34 views

Bitcoin RPC BrokenPipeError on specific block/transaction

I have a simple python app running through the blockchain as follows... rpc_connection = AuthServiceProxy("http://%s:%s@127.0.0.1:8332"%(rpc_user, rpc_password)) for b in range(blockStart, ...
  • 275
0 votes
1 answer
41 views

Retrieving bitcoin address of the receiver of a transaction with bitcoinrpc

I'm trying to write a simple python implementation using bitcoinrpc to extract the address receiving a transaction but... I'm not sure why certain fields are only accessible inconsistently. E.g. tx['...
  • 275
3 votes
1 answer
911 views

Why is the Bitcoin Core HWI written in Python? If it was rewritten in Rust should the Python HWI still be maintained?

Why is/was the Bitcoin Core HWI written in Python? What have the challenges been of having the HWI written in Python? There seems to be interest and rationale(s) to write another HWI in Rust. Would ...
2 votes
1 answer
63 views

Error validating transaction: unexpected witness payload for non-witness script in a P2TR using script path

I am trying to create a raw transaction P2TR, spending a Taproot UTXO using the script path. I did the following: Create a random private key d and corresponding pubkey P (the internal pubkey) ...
  • 113
3 votes
1 answer
88 views

non-mandatory-script-verify-flag (Invalid Schnorr signature) when I try to send a P2TR tx on testnet

I'm learning to create tx from scratch in order to understand better how bitcoin tx works and how they are structured. I learnt to create tx with legacy address, segwit v0 and I am now learning ...
  • 113
2 votes
1 answer
88 views

Having issues properly generating a p2pkh address in Rust code. (for research purposes not for real use)

I have followed the steps to generate a p2pkh compressed base58 address and am consistently checking it to find that I get an invalid checksum. I am using this python code to check the address: (...
  • 172
1 vote
0 answers
47 views

Cannot import python-bitcoinlib into a simple script

Im writing a simple python script to connect to a local bitcoin node and list transactions. I created a virtual environment with: virtualenv bitcoinenv And then activated: source bitcoinenv/bin/...
  • 137
0 votes
1 answer
43 views

What is the correct way of formatting pubkey_script in coinbase generation transaction?

This may be a simple question for others but I'm struggling trying to understand pubkey_script in the generation transaction. In this Python code I'm trying to create a pubkey_script: from base58 ...
  • 23
0 votes
0 answers
29 views

NameError at /register name 'privtopub' is not defined

from django.shortcuts import render, redirect from django.contrib.auth.models import User, auth from django.contrib import messages from .models import Details from bitcoin import * import random ...
3 votes
1 answer
75 views

Is it possible to retrieve input addresses and input values of bitcoin transactions from raw blk.dat files?

I'm developing a script that processes blk.dat files from bitcoin core. So far, I am able to retrieve the following attributes for transaction inputs: "vin", "index", "...
0 votes
0 answers
25 views

how does n work in Type 1 Deterministic Wallet?

According to Bitcoin wiki: A type 1 deterministic wallet is a simple method of generating addresses from a known starting string. [...] To generate a private key take SHA256(string + n), where n is ...

15 30 50 per page
1
2 3 4 5
22