Skip to main content

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
1 vote
0 answers
28 views

python "pbkdf2_hmac" function doesn't return same as Ian Coleman BIP39 tool. Why?

I am trying to go from a BIP39 phrase to Seed to xprv root key. I have the following BIP39 phrase: "prefer offer puppy imitate pink banana because whale letter thought artwork loud" which ...
0xCas's user avatar
  • 11
0 votes
0 answers
27 views

Python code to create a two-input transaction in test net

I made a transaction that can be spent by anyone and now I wanna spend it and bring it back to my address. The problem in it doesn't have enough bitcoin for transaction fee so I'm using another input ...
ali's user avatar
  • 1
0 votes
0 answers
19 views

How to spend one or more p2tr inputs in python?

I see that bitcoinlib does not support taproot yet. Is there any good lib out there to spend one or more taproot inputs? I would like to create txs like this: ... "inputs": [ { &...
user80100's user avatar
0 votes
1 answer
33 views

Unable to spend a script path using buidl python lib

I've been struggling to figure out how to spend a particular script path using buidl python lib. Currently I assume the problem lies in how I construct p2tr address or there's a bug (very unlikely) in ...
katsu's user avatar
  • 21
0 votes
1 answer
131 views

How to generate coinbase transaction in Python?

I know that on this forum a lot of questions on this topic, I have checked most of these, but can't find the solution for my task. I am creating my own algorithm for solo mining bitcoin on Python. I ...
Alex Radik's user avatar
0 votes
1 answer
125 views

How to convert signature to DER encoded format in python

vk = ecdsa.VerifyingKey.from_string(bytes.fromhex(pubKey),curve=ecdsa.SECP256k1) if vk.verify(bytes.fromhex(signature), bytes.fromhex(sha256_hash), hashlib.sha256, sigdecode=sigdecode_der) == True: # ...
aaravm's user avatar
  • 1
0 votes
0 answers
73 views

Old encrypted wallet + bitcoin core

I got desperate, I tried all the instructions I could find on the Internet - nothing helps. What I have: wallet.dat from bitcoin-core encrypted from 2015 (in four different places) the password I ...
LamoSS's user avatar
  • 1
0 votes
0 answers
61 views

Getting error "non-mandatory-script-verify-flag (Witness program hash mismatch)" when trying to send raw signed transaction

I'm trying to send a fairly simple segwit transaction with multiple input and outputs using bitcoinlib, here's how the simplified code looks like: from bitcoinlib.transactions import Output, Key, ...
Javier Villanueva's user avatar
1 vote
1 answer
80 views

Can I read blockchain's information from Electrum's python console?

I wanted to use Electrum's python console, but the documentation just gives a few examples. Is there a more complete documentation about python commands inside Electrum ? Main tasks I currently want ...
ewen-goisot's user avatar
1 vote
0 answers
36 views

scantxoutset timing out

I have extremely simple python code to use scantxoutset. The problem is that when I debug in pycharm it keeps timing out. rpc_connection = rpcConnector.rpcConnect() json_req = [{"desc": &...
user2880722's user avatar
1 vote
1 answer
66 views

I cannot broadcast my raw tx (P2PKH) on testnet: Signature must be zero for failed CHECK(MULTI)SIG operation

I am trying to broadcast my transaction on the test network with no success so far. I get always this error: sendrawtransaction RPC error: {"code":-26,"message":"mandatory-...
Dot Brian's user avatar
2 votes
1 answer
274 views

Partial private key recovery

I had the pleasure of setting up a Bitcoin wallet using the Blue Wallet app and diligently noted down the 52 characters of my private key on a piece of paper for backup purposes. Upon revisiting the ...
minodo's user avatar
  • 21
1 vote
1 answer
101 views

Deriving bip84 addresses with python

Does anyone have a python script deriving the bip84 addresses from the private key? I do have the private root key so I don't need to go all the way from the private key. I'd like to do this with the ...
Peder Rustad's user avatar
1 vote
1 answer
46 views

What is one word seed word exactly?

I have the following code import hashlib import binascii def word_to_private_key(word): sha256_hash = hashlib.sha256(word.encode()).digest() private_key = binascii.hexlify(sha256_hash).decode(...
Asif Iqbal's user avatar
2 votes
3 answers
101 views

How should I install Core Lightning if my VPS won't let me use pip install?

I tried to install Core Lightning on a Ubuntu Digital Ocean droplet using these installation instructions and it won't let me pip install anything giving me an error externally-managed-environment. ...
Michael Folkson's user avatar
1 vote
1 answer
89 views

Nonstandard witness when building a transaction

i try to spend a P2WSH 2of2 multisig input in Python for learning purposes. When i check my assembled TX with testmempoolaccept i get "bad-witness-nonstandard". This is my function to ...
f321x's user avatar
  • 11
2 votes
0 answers
121 views

Bitcoin Core RPC server not working

I have downloaded and installed and got up and running a bitcoin core node, and it is running fine as far as people are connecting to it on port 8333 just fine. However I can't seem to connect to it ...
The Journey's user avatar
0 votes
1 answer
79 views

RPC to Umbrel returns 403

I have mangad to get closer to my goal. My Code # rpc_user and rpc_password are set in the bitcoin.conf file rpc_user = "umbrel" rpc_pass = "pass" rpc_host = "192.168.1.122&...
donbolli's user avatar
0 votes
1 answer
103 views

RPC connect to Umbrel

I have an Umbrel Node on my RaspberryPi4. It is connected to the same router as my Computer, but somehow I can't connect to it using python (bitcoinrpc). My Code rpc_user = "umbrel" rpc_pass ...
donbolli's user avatar
1 vote
1 answer
472 views

Unable to get Taproot address using bitcoinlib

I tried several ways to get a Taproot address from a Private Key with bitcoinlib, but I kept getting different addresses than those I get with Taproot wallets such as Unisat and OKX Wallet. Then, ...
Tprt's user avatar
  • 11
2 votes
1 answer
430 views

Need Help Deriving Extended Private Key from Bitcoin Root Extended Public Key and Non-Hardened Extended Private Key

I am currently working on a challenge that involves deriving a non-hardened extended private key for a specific search path in Bitcoin. The challenge provides the following information: Bitcoin root ...
Ankit Tiwari's user avatar
0 votes
0 answers
42 views

An efficient algorithm for multi-address transactions in a deterministic wallet

I am developing my Bitcoin wallet (testnet) on Python using the Cryptos library. I started integrating support for deterministic wallets and mnemonic words. Now I have enabled users to generate ...
Xemi's user avatar
  • 1
2 votes
0 answers
76 views

How to get transaction fee info using Python from an Electrum server?

I can get a raw transaction and parse it using electrum and bitcoinlib fairly easily: import bitcoinlib from electrum.daemon import Daemon from electrum.simple_config import SimpleConfig class ...
moblie's user avatar
  • 121
0 votes
0 answers
39 views

Getting everything from an xpub

I wrote a small Web Application to display data to the user. I want a crawler in the background, fetching all the data (transaction etc) on all addresses. All the user enters is his xpub. I know this ...
donbolli's user avatar
1 vote
1 answer
457 views

How to compute a TXID of any bitcoin transaction in Python

there, I've already looked at other similar posts on here but with little luck. All im trying to do is calculate the TXID of a transaction after downloading the transaction in hexadecimal from a ...
RabbitHole6565's user avatar
3 votes
1 answer
95 views

Python Script not working / From Xpub to everything

I made a small webapplication to keep track of my wallets. So I want to grab everything i have, using my xpub. Looping through every adress. On the Internet I could find diffrent scripts, but I could ...
donbolli's user avatar
1 vote
0 answers
58 views

Why assertion error in Point addition?

I am doing my research on SECP256k1 but now i am facing assertion error sometimes. I can't seem to find where it comes from, so i once thought its because the resulting point is point at affinity. So ...
Alexio puk2sefu's user avatar
2 votes
1 answer
467 views

How to manually verify an ECDSA signature in Python?

Maybe I got the formula wrong but I heard that x = (z*s^-1)*G+(r*s^-1)*K is the equation for verifying an ECDSA signature but my code says signature is invalid but the values are from a valid bitcoin ...
Alexio puk2sefu's user avatar
0 votes
1 answer
160 views

How to convert the results of point doubling (Rx1 and Ry1) to point addition (Rx2 and Ry2) without knowledge of (Qx, Qy) in secp256k1 elliptic curve [closed]

I'm working with the secp256k1 elliptic curve and have point doubling and point addition formulas for this curve. Given the following formulas: Point Addition Formula in Python3: s = (Qy - Gy) * pow(...
Aviril Smith's user avatar
-3 votes
1 answer
677 views

Order 12 phrase for trust wallet

I have 12 phrases for trust wallet but he is not arranged in the right way. What is the solution? Code python with bip39!! How !?
user avatar
0 votes
1 answer
478 views

Converting compressed WIF to uncompressed WIF so it works with bitcoinaddress Python library

I'm trying to convert a compressed WIF generated by bitcoinaddress python Library but I couldn't find a function to do the task so I collected one. I would like someone to review my code and maybe ...
uak's user avatar
  • 101
1 vote
1 answer
227 views

Native P2WSH over P2SH | P2SH-P2WSH

I'm in the process of attempting to generate a transaction using the Python Bitcoin Utils library. that involves P2WSH-over-P2SH (P2SH-P2WSH). My activity is on the regtest network. Below is the code ...
Deepanshu's user avatar
1 vote
0 answers
75 views

Error when trying to broadcast multi input tx (Programming Bitcoin by Jimmy Song)

I am reading Programming Bitcoin (chapter 7 exercise 5) and I have created a 2 inputs 1 output transaction on testnet which I have signed and it now verifies as true. When I go broadcast the ...
user144329's user avatar
0 votes
0 answers
499 views

faster way to get bip44 address from mnemonic?

Long story short my 12 word seed phrase has a passphrase and I forgot the order. So I did all the permutations of the 12 words to find the valid ones (29939407). So the script below is my way of ...
Dasher Love's user avatar
0 votes
0 answers
126 views

How to calculate the pool difficulty based on mining.set_difficulty method from Stratum protocol?

I am trying to build a simple python cpu miner and I have referenced a few other github repos (for learning purposes not for money purposes). I've noticed that many of them simply ignore the mining....
Isaiah Clemons's user avatar
0 votes
1 answer
235 views

How to get UTXOs Data from the network Using python?

I want to have the Bitcoin Network UTXOs only for a data analysis project and the purpose is visualization of the time series of 1>BTC wallets . how can I do it using python ? ( or is there any ...
user143828's user avatar
0 votes
1 answer
1k views

How to differentiate between BTC transactions and BRC20 transactions on a blockchain?

How to differentiate between BTC transactions and BRC20 transactions on a blockchain using the RCP interface? This is a transaction record that contains BRC20 tokens which I found on a blockchain ...
Mashaji's user avatar
0 votes
0 answers
117 views

Master Node(BIP32 Root Key) to xpriv and xpub

I struggle to make a python script that can make xpriv and xpub (extended public and private key) from the Master Node (BIP32 Root Key). I've derived the Master Node from the BIP39 seed with ...
Peder Rustad's user avatar
1 vote
0 answers
173 views

How to set change address with python bitcoinlib

I am using python's bitcoinlib to try and set up payments where a client sends funds to a server and then sends requests signed with their key as proof that the request came from them. The server ...
Colm Evans's user avatar
1 vote
0 answers
166 views

How to get transaction size as byte before send with Python's bit library?

I am using bit library to make a Bitcoin transaction. I can use methods like this: key.create_transaction([('1Archive1n2C579dMsAu3iC6tWzuQJz8dN', 190, 'jpy')]) or key.send([('...
reza_khalafi's user avatar
1 vote
0 answers
282 views

Bitcoin Transaction Builder in Python

is there a python code that helps build raw bitcoin transactions (Legacy and Segwit)? I have seen javascript but not in python.
Jim Quick's user avatar
1 vote
1 answer
53 views

How to build a raw signed transaction with a FIXED fee? [duplicate]

I was wondering how can we build a transaction with a fixed amount of fees already FIXED. Let's have this configuration 2 Inputs (X:0 = 520 BTC, X:1 = 102 BTC) => 1 RECEIVER (+510 BTC) Fees are: 0....
Loopite's user avatar
  • 301
3 votes
1 answer
142 views

Failing to construct transaction that unlocks P2WSH

I am trying to unlock the P2WSH output of the following transaction: https://blockstream.info/testnet/tx/b435b180c936564cc902ce3d7011643836a74d671159d494f59536e70d977cd2 The script that I'm paying to ...
msinkec's user avatar
  • 43
2 votes
2 answers
174 views

Bitcoind python connection

I'm trying to connect to bitcoind with python3. I'm currently following the instructions of Antonopolous book. This is my code on an IDE: from bitcoin.rpc import RawProxy p = RawProxy() info = p....
Pariya's user avatar
  • 41
1 vote
0 answers
111 views

I get a not a P2TR scriptPubKey error when trying to generate a bech32m taproot compliant P2TR address with python

I have the following script that is supposed to derive a taproot P2TR address: from bitcointx import set_custom_secp256k1_path set_custom_secp256k1_path('./bitcointx_secp256k1_here/libsecp256k1.2....
ChristianOConnor's user avatar
2 votes
2 answers
798 views

How do I generate a testnet segwit v1 taproot compliant bitcoin address?

I have a script that generates a segwit v1 taproot compliant address and private key. The script currently generates a regtest address but with minor tweaks it spits out a mainnet address. I think the ...
ChristianOConnor's user avatar
3 votes
1 answer
645 views

How to get the derivation path of a multi-wallet seed phrase?

I only have the seed phrase. When I enter the seed phrase into, for example, Exodus or Trust Wallet, I can fully recover my Bitcoin in seconds. But how to do this using Python or Node.js?
FledDev's user avatar
  • 151
2 votes
1 answer
72 views

How can I store a file hash in a Schnorr signature? Or something other than an OP_RETURN?

I have this python script that puts file hashes on the bitcoin blockchain: from bitcoinutils.utils import to_satoshis from bitcoinutils.setup import setup from bitcoinutils.transactions import ...
ChristianOConnor's user avatar
2 votes
1 answer
219 views

How do I use python-bitcoin-utils to add an OP_RETURN message into a bitcoin transaction?

I have the following code that successfully created a bitcoin transaction with python-bitcoin-utils: from bitcoinutils.utils import to_satoshis from bitcoinutils.setup import setup from bitcoinutils....
ChristianOConnor's user avatar
2 votes
1 answer
3k views

python-bitcoin-utils - sendrawtransaction RPC error: {"code":-25,"message":"bad-txns-inputs-missingorspent"} when trying to broadcast my tx?

I am trying to create a bitcoin transaction to send all of the funds from tb1qj6zz96g8xgrwpgmdlvmkrjlwzz54sf47086yc9 to tb1qxgm8j0cq7tnftef3t563psl56gtmzxanm5c9uy. ...
ChristianOConnor's user avatar

1
2 3 4 5
8