Questions tagged [python]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
9 views

Lost 3 words out of 12, and not sure of order, mnemonic seed

I lost 3 words out 12 and not sure of the order of the rest besides the first 3, and the last one. I wrote a Python script with mnemonic and the crypto.com wallet library, it works, to my knowledge ...
0
votes
1answer
64 views

How to calculate R, S, and Z from raw bitcoin transaction with witness?

How can I calculate the R, S, and Z values from a raw bitcoin transaction? I can extract them with rscan.py, but that doesn't work for new transactions.
1
vote
3answers
55 views

Trying to get all transactions between two specific dates

I am trying to make a python script for a research project that needs to get all the transactions that happened between point A and B in time, but I can't find any API, website or library where I can ...
0
votes
0answers
21 views

Are these equivalent: GetHash in src/primitives/transaction.cpp, and rehash in test/functional/test_framework/messages.py

Are these equivalent? rehash method of the Python Test Framework data structure CTransaction (link) GetHash method of CMutableTransaction (link, link) If not, is there an equivalent to rehash in Core?
0
votes
1answer
20 views

Getting wrong version number of block from block index of Bitcoin Core

I am reading block index using plyvel python package. Following is the location of block indexes: export BLOCK_INDEX_DB=$BITCOIN_HOME/blocks/index Following is the method to decode b128 varint: def ...
2
votes
3answers
184 views

Why are there limitations between educational and real world usage?

This link looks very practical and "hands in the dirty". But in the example of Python code for node discovery and connections, it often gives warning about the fact it is of "...
1
vote
1answer
54 views

Having trouble creating a Python function that creates non-hardened HD wallet child keys

I am coding my own keys (not for use in production, strictly for learning). I am successfully creating 512 bit seeds from mnemonic phrases, however I am failing at the step of deriving child keys from ...
0
votes
2answers
66 views

is there a way how to explore bitcoin blockchain

if I want to explore bitcoin blockchain for instance get address' information, transactions, and so on. what is the right place where I can grab this info. I tried https://blockchain.info but they ...
0
votes
0answers
80 views

Simple Python code miner which automatically mines and stops

I'm new at BTC mining and I'm still learning. I'm almost medium level in Python. I'm looking for a Python miner that automatically mines using the last block and stops when a new block is found and if ...
0
votes
1answer
44 views

Account Extended Public Key from mnemonic

tell me please, how we can receive Account Extended Public Key from mnemonic phrase via PHP or Python? Or possible in internet we have ready console scripts? I'm going to https://iancoleman.io/bip39/ ...
0
votes
0answers
52 views

What is the easyest python3 script to generate pubkey + addresses from 24 words + passphrase?

Coldcard can generate 24 words from dice, but then I still need to verify that applying my passphrase on top of the 24 words, give me the addresses that coldcard is showing me. What is the easyest ...
0
votes
0answers
24 views

Creating an OP_Return TX with Python bitcoinlib

How can I create an op_return TX with python bitcoinlib? The transaction should include the OP_RETURN HEX-Data and an address where I send my change money
0
votes
2answers
377 views

How to get correct address from BTC mnemonic phrase in Python

Faced a problem, I have a crypto wallet written in Python, there is a code that creates a wallet address from a mnemonic phrase (In this case, BTC address). But if I enter this mnemonic phrase into ...
0
votes
1answer
334 views

How do i properly encode and decode base58 in python?

I was following the tutorial here : https://hackernoon.com/how-to-generate-bitcoin-addresses-technical-address-generation-explanation-rus3z9e i imported base58 to my python project : import base58 I ...
1
vote
2answers
282 views

Derive Segwit Addresses From xPub or zPub using PYTHON

Summary I'm pulling my hair out trying to understand a couple of concepts. I would like to use a Segwit wallet in my Ledger Nano S to derive unhardened(?) child public keys (and thus segwit addresses) ...
0
votes
1answer
117 views

python - No module named 'bitcoin' on Ubuntu using WSL on Windows 10

Which version of python should I use? When running pip3 install python-bitcoinlib I get 'Requirement already satisfied'. I run on Ubuntu using WSL in Windows 10. I have this error: >>> from ...
0
votes
0answers
31 views

Blockchain Info BTC Hash-Rate API

I'd like to get the history of hash rate, Miners Revenue, Difficulty, Block Size of BTC (& other coins) since 2013 and preferably in different granularity (i.e., 1d, 1hr,...) with Python. I know ...
0
votes
1answer
141 views

Struggling to Decode Raw Hex Data of a Block

I am trying to Decode the Raw hex data of a Coinbase Block to check my understanding of the DS but I am facing some difficulties in decoding marked by a ? below: Q1. Can someone please check the ...
1
vote
1answer
157 views

How can I retrieve all transactions for an address using the blockchain API?

Tell me how to interact with https://www.blockchain.com/. 1). I need to withdraw all transactions from the address, my code outputs transactions only for the last day? 2). How do I add additional ...
0
votes
0answers
128 views

How do you Derive Addresses from a BIP49 Master Public Key using P2WPKH-P2SH?

I am trying to derive addresses from a master public key (aka extended public key) in python. I don't fully understand the math behind the key derivation, but have been able to decode the master ...
0
votes
3answers
244 views

How to convert a single number into Private key in python

https://brainwalletx.github.io/#converter, 5HpHagT65TZzG1PH3CSu63k8DbpvD8s5ip4nEB3kEsreAnchuDf This private key is generated from 1 If i do this other way on this same site, It gives me different ...
0
votes
0answers
153 views

How to run simple python function on GPU using cuda and numba?

I have a simple code that I would like to run on GPU. I have seen many tutorial and it seems like I have to put @cuda.jit before my function to use it on gpu, but it is not working. For the moment, ...
4
votes
1answer
165 views

How can I access remote lightningd with pyln-client

I'm looking for a way to do python graph analytics on a local machine that can call a remote lightningd to get up to date nodes and edge data from the lightning node server. How do I need to configure ...
1
vote
1answer
144 views

Get node 1 to mine another block, send it to node 2, and check that node 2 received it

I am trying to write a test with the bitcoin/test/functional/example_test.py to get node 1 to mine another block, send it to node 2, and check that node 2 received it. Any idea on how to go about/get ...
0
votes
1answer
105 views

How many python bitcoin wallets are there? [closed]

Is there a list of legit Python Bitcoin wallets or even other cryptocurrencies? I did a Google search and got no clear results.
0
votes
0answers
36 views

calculate transaction fee

I have been trying to write an application for transferring bitcoin programmatically using python and bit library. However, I'm currently stuck on how to calculate transaction fee. from bit import Key ...
1
vote
1answer
307 views

how to convert WIF key return to HEX format

any one knows how to convert WIF key return to hex format please also let me know if the private key is out side range of ecc then how to import it to some wallet ?
2
votes
1answer
95 views

Problem spending funds from P2WSH address: non-mandatory-script-verify-flag

I've tried to find an answer here and on BTT but without luck so far. I'm having issues creating a transaction to spend from a P2WSH address which I created and sent funds to. I based my code off of ...
1
vote
0answers
38 views

Using RBF in python application

I'd like to create transactions within my python application, that support replace-by-fee RBF (BIP125). Apparently, if I want to be able to replace my transaction later on, I need to signal that ...
2
votes
2answers
93 views

The example signature in BIP143 doesn't validate?

In BIP143 the first example has a witness signature and it doesn't appear to validate/be correct?! I wrote a super simple python program to demonstrate import ecdsa import asn1 #Importing the 3 ...
1
vote
1answer
62 views

Translate c++ function into python: sha256 hash mismatch [closed]

This is not related to bitcoin but it uses most of the bitcoin codebase. I would like to translate some c++ code into python but struggle really hard to get the hashes right. This is the function I ...
0
votes
0answers
27 views

Coin selection algorithm using Python and Bitcoin Core JSON-RPC

I am looking for the easiest way to implement this using Python: Save all the amount of UTXOs in an array(not sure if tuple or list or set or dictionary) User wants to send 0.1 BTC, won't pay more ...
1
vote
1answer
130 views

Python Code - import error : cannot import name "privtopub" from 'bitcoin'

Hello everyone when I start this code on PYCHARM looks like no problem. But when I turned this code from python to exe and exe don't start and it says: import error: cannot import name "...
0
votes
0answers
107 views

How to modify for Hex to base58check converter via python

I am far from programming, I found this convenient script, it just has an input - a text file with a HEX list in a column and the output of the result - a text file with a WIF list in a stack. I would ...
0
votes
0answers
49 views

How can I programmatically check if a 12 word mnemonic is valid? [duplicate]

I would like to use python to check if a 12 word mnemonic is valid. How can this be done?
0
votes
0answers
79 views

What's up with the block size of block# 295182?

I found an anomaly in the block size data: block 295182. This one seems to have a way higher payload. What happened there? Or is this there something wrong with my parsing? This file block does ...
1
vote
0answers
34 views

P2SH address as a product of public keys

Assuming the multisig 2 of 3, if I do have extended public keys (xpub) for all 3 cosigners (with proper derivations), can I somewhat get the result address (P2SH)? How to calculate the "script&...
0
votes
0answers
96 views

bitcoin core wallet and python bitcoin-lib

I have a regtest bitcoin environment with nodes and wallets. I'm running bitcoind and bitcoin-cli, version v0.21.0.0. So in my node i created my wallet with a bitcoin-cli -regtest createwallet node1 &...
0
votes
0answers
113 views

Generate BTC Compressed Address

The below code generate uncompressed address with and the Private key for this uncompressed address. How to generate compressed address with it's private key ? I know there is packages like bitcoin ...
0
votes
0answers
82 views

How Create Bitcoin wallet from a private key works?

I'm trying to understand how i can create a pair of bitcoin private key and public key with : https://github.com/Destiner/blocksmith for example : import blocksmith kg = blocksmith.KeyGenerator() ...
1
vote
0answers
33 views

bitcoin-etl: problems with installing

I am trying to install bitcoin-etl: https://github.com/blockchain-etl/bitcoin-etl to analyze bitcoin blockchain. I have Mac OS and python3, I run this in terminal: pip install bitcoin-etl Also tried ...
0
votes
1answer
202 views

How can I pull the "Candles" argument from the Huobi websocket data?

I've a problem with Huobi Websocket, I know my ways in REST API but new to asyncio and websockets, and Huobi only gives resonable amount of history through websocket request so I'm stuck with it. I'm ...
1
vote
1answer
266 views

Python: Why the addresses and keys generated by pywallet and bip32utils using the same 12 mnemonic words don't match?

I tried to generate wallets by using pywallet and bip32utils (Python). But I noted that the addresses/keys of the 2 wallets, namely wallet_pywallet and wallet_bip39 don't match with each other. I ...
3
votes
1answer
92 views

How to verify a lnurl-auth callback with python

I want to create a Python implementation of an lnurl-auth server. I started a quick HTTP server to be the callback url, and captured the signed callback sent by BLW on Android. ?tag=login &k1=...
0
votes
1answer
602 views

How convert Bitcoin Privat Key Compression to public address?

This script gets the public address from the uncompressed private key. import ecdsa import hashlib import base58 private_key = input("privatekey: ") # ...
0
votes
3answers
579 views

Is there a simple python script for xpub generation from private key

I need a python script to verify, in an air gapped system, that my 24-word (or 12-word) mnemonic seed indeed generates the xpub that my wallet is showing me. Is there a simple script that does that, ...
0
votes
0answers
63 views

Process for finding nonce

Assume we have a transaction in hex (tx_hex) and we want to find a nonce such that SHA-256(SHA-256(nonce|| tx_hex)) = new_transaction_id ('||' denotes concatenation) first bits consist of 32 zeros. ...
1
vote
0answers
55 views

How do I fix socket.timeout error when getting data from blockchain.info? [closed]

I'm writing a python script using the blockchain API that takes as input a list of seed addresses, gets their transactions and the input/output addresses of each transaction. Then I get the ...
0
votes
1answer
825 views

How can I generate SegWit addresses from a mnemonic using python?

So, I have written a script that generates BIP39 mnemonics. I now want to generate N native SegWit public keys from this mnemonic. I have found this, but it generates legacy addresses. It uses the ...

1
2 3 4 5 6