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 votes
0 answers
27 views

Verifying P2WPKH using ECDSA

I am trying to verify a P2WPKH Input of a transaction. The steps that I have figured out: I am done with verifying the PKH with Public in Witness field I am stuck with the verification of the ...
Yuvraj Chhetri's user avatar
0 votes
0 answers
22 views

Python bitcoin transaction script(OP_Codes) [closed]

I want to verify a Bitcoin transaction in Python without using Bitcoin libraries. The transaction contains many inputs with P2PKH, P2SH(multisig), P2WKH, P2WSH, P2TR etc. Any method that can be used ...
Yuvraj Chhetri's user avatar
-1 votes
0 answers
20 views

How to POST using RobinHood Crypto API in Python?

I'm using the new RobinHood crypto API documented here: https://docs.robinhood.com/crypto/trading/#tag/Trading/operation/api_v1_post_crypto_trading_order I am successful with all GET endpoints, but ...
Elliptica's user avatar
0 votes
1 answer
54 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
45 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
27 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
58 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
29 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
48 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
117 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
53 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
35 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
83 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
70 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
88 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
53 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
74 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
265 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
358 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
35 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
58 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
36 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
330 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
89 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
55 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
378 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
148 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
596 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
321 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
  • 1
1 vote
1 answer
206 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
65 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
340 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
105 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
198 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
90 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
147 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
151 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
247 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
51 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
131 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
142 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
104 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
682 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
0 votes
0 answers
79 views

How to get unspents using the private key of the bip84 wallet

Maybe my question is stupid, but I really can't figure out why when I use the bip44 private key, it works, but if it's bip84, it doesn't from bit import PrivateKey, Key import bitcoinlib my_key = ...
dropless's user avatar
3 votes
1 answer
554 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
71 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
184 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
2k 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 vote
1 answer
110 views

I am trying to convert the 12 words into BTC addresses, but they do not match

I am trying to convert the 12 words into BTC addresses, but they do not match the ones shown to me by Safepal, Coinomi, and Trust Wallet. I have tried using several libraries and doing it manually. I ...
Nigan's user avatar
  • 19

1
2 3 4 5
8