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
2
votes
0answers
22 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
76 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 ...
2
votes
1answer
40 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
18 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
0answers
36 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
25 views

Generating Derivation keys from root XPRV in Python

Here's what I'm currently doing in JavaScript, I was wondering if there's anyone who knows how to recreate this functionality in Python. all I need to do is: take a base58 xprv (rootKey) -> derive ...
0
votes
0answers
21 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
15 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
75 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
29 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
63 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
75 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
59 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
27 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
84 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
94 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
35 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
207 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
149 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
36 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
44 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
273 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 ...
0
votes
1answer
83 views

How do I convert a private key in hex to a Segwit private key expected by Electrum?

I've been following this code to generate SegWit addresses with python. However, I'm confused because this script doesn't output the private key in a usable way for Electrum. I found this site which ...
0
votes
1answer
29 views

Does python-bitcoinlib and the Bitcoin Core functional test framework share code? Were changes ever pushed down/upstream?

Does python-bitcoinlib and the Bitcoin Core functional test framework share code? Were changes ever pushed down/upstream?
0
votes
0answers
33 views

How to generate bitcoin address with gpu in python [duplicate]

I have seen a lot of bitcoin address generator with python, but all of them run on cpu, and are very slow,, for fun and educational purposes, I have been trying to use gpu to run the python script to ...
1
vote
1answer
56 views

Test vector 1 BIP32 in Python

i tried to replicate code in this git https://github.com/tongokongo/bitcoin-basics/blob/master/HD_wallet/bip32.py . I'm not familiar with python but the xpub is correct (this is the Test Vector 1 from ...
2
votes
2answers
507 views

Download blocks in blk00000.dat format from a specific period

For study purposes, I would like to download blocks from a specific period, i.e. January 2017 - June 2017, in blk.dat format (blk00000.dat, blk*.dat). I downloaded blockchain.core but it makes me ...
0
votes
0answers
23 views

python-bitcoinlib: Synchronise block headers

I am trying to run a simple python script to synchronise the Bitcoin block headers for an SPV client, using the python-bitcoinlib. This is the code that I am running, after doing the handshake: msg = ...
0
votes
1answer
611 views

How to generate Hash160 from a private key with the Bitcoin module

I want to fix the script code. The script generates from a random private key Bitcoin Address by function (pubtoaddr) and works on the Bitcoin module: https://github.com/primal100/pybitcointools/blob/...
2
votes
1answer
80 views

XPub to YPub Converter (python) - Last digits wrong

The code below is generating an YPub from XPub with the last 6 digits wrong. How can I verify what's happening and fix this error? e.g.: It should be ...
0
votes
1answer
98 views

SPV client TCP connection in python

I am trying to implement an SPV client in python (for my own learning). I want to start by making a simple TCP connection to a full node, but I either cannot get a response to my version message, or ...
0
votes
2answers
77 views

library for validating bitcoin private and public keys

I am building a python script that gets a string and determines if it is a valid bitcoin private key or public key, and if so it returns its type/format (base58, BIP32, HexaDecimal etc.) and its ...
1
vote
1answer
70 views

Address generator error with python

I had created a script that creates a bitcoin private key, public key and address, for checking if all works fine I create one and check the private key on https://walletgenerator.net/, and it outputs ...
0
votes
0answers
365 views

How do I get bip32 public key and address from private key in python?

I have checked related questions and did not find answer. I also tried to use "secp256k1", "bip-0032", "seedrecover" and did not succeed. When my input is a private key ...
1
vote
2answers
723 views

How to use python rpc bitcoin to get the historical transaction record of a wallet address

How to use python rpc bitcoin to get the historical transaction record of a wallet address?My computer has synchronized all btc blocks, and txindex=1 has been configured. I want to try to get all the ...
0
votes
0answers
57 views

Parsing transaction hash from rawblock data

I got block raw data next url https://blockchain.info/rawblock/00000000000000000002447735c7723ee9188322c0938e6587866a4458b9135f?format=hex Can I find transaction hash in url used python?
0
votes
0answers
27 views

Can I get all block header data like the SPV node?

It hasn't been long since I studied Blockchain. I only need header data, not all block data, for study purposes. As far as I know, the SPV node stores only the block's header information. Can i get ...
2
votes
1answer
250 views

Cannot import python-bitcoinrpc

I am unable to import the package bitcoinrpc. I have installed it in python2 and python3 using python3 -m pip install python-bitcoinrpc/python -m pip install python-bitcoinrpc AND by cloning the repo ...
0
votes
1answer
5k views

Help needed with PyWallet and wallet dump using MacOS

Could anyone please give me some guidance on how to perform a wallet dump using PyWallet on a MacBook (macOS 10.12 Sierra)? I’m not very savvy with this stuff at all. Have an old wallet.dat file from ...
2
votes
2answers
1k views

convert private key to bitcoin address using python or php

I have private key like this 5JYJWrRd7sbqEzL9KR9dYTGrxyLqZEhPtnCtcvhC5t8ZvWgS9iC how to convert to bicoin address using python or php? example bitcoin address 18V7u8YNHKwG944TCkzYYj32hb6fdFPvQf
0
votes
1answer
76 views

How can bitinfocharts.com know the changes in BTC deposited to Binance?

I find this page here, which tells me how much BTC is deposited to Binance. How does this (or a similar) page work? When I deposit BTC to Binance, I am given an address, which I am fairly sure it's ...
0
votes
1answer
47 views

Calculate BitcoinGold Block Header Hash [closed]

I am trying to calculate block hash # 632295 { 'version': 536870912, 'prev_block_hash': '000000017590609fd72cadc5fd05732cfa1760bd882213afbb7b788c42e115c8', 'merkle_root': '...
1
vote
0answers
200 views

Connection refused when using bitcoinrpc on Linux

I am new to python-bitcoinrpc(also new to VM Linux actually) and I want to use the blockchain parser from alecalve to get ordered blocks. I used Windows to download the blockchain data into an ...
0
votes
1answer
103 views

Is there such a service as an unlimited Bitcoin wallet with an API?

Well, I did tons of research and currently I'm using bitcoinlib for python to have a wallet which should be able to hold over one million addresses and occassionally broadcast transactions. It has ...
0
votes
1answer
69 views

I need a few lines of python to make WIF addresses

I have code which generates WIF keys from hex keys. It just need a few more lines to generate WIF addresses. ------------------------ import binascii, hashlib, base58, sys def convert(z): ...
1
vote
2answers
64 views

How can I execute `getnewaddress` at my full node from a remote server?

I have a full node running on a digital ocean droplet. I have an app running at heroku, and I want to execute getnewaddress from this app. I'm trying to generate BTC addresses to which users can send ...
0
votes
0answers
25 views

How can I ask for reward after mining? [duplicate]

Let's assume that I found the nonce for the block the world try to mine now. How can I say in python that this is the nonce and this is my wallet address so transfer the reward to it?! Note: This ...
0
votes
1answer
46 views

bip39 converting from entropy to seed failing tests with entropy “00000000000000000000000000000000”

Trying to convert hexadecimal string of entropy to seed sentence with the below snippet. Failing the first test with 16 zero bytes. It seems that my function came to conclusion that checksum is '1011' ...
0
votes
1answer
37 views

Why downloaded Block Size doesn't match with actual block size mentioned on network?

I am trying to download a block(Height:474044) using an API from here in python. Block is obviously downloaded in JSON format. But when I store it in a file on my system it shows very weird size ...
0
votes
1answer
623 views

How to get uncompressed BTC address and private key from bit module for Python?

I am new in programming and BTC. I want to make some BTC address with private keys. Till now I learn that we have compressed and uncompressed private keys. But I get only compressed private keys and ...

1
2 3 4 5