Hot answers tagged

4 votes

Order 12 phrase for trust wallet

12 words have only 12! = 479'001'600 possible orders. Create a script that iterates through all possible orders test whether the 12 words have a valid checksum if so, generate the relevant output ...
Murch's user avatar
  • 74.6k
4 votes
Accepted

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

How to differentiate between BTC transactions and BRC20 transactions Well, you can't because they are not disjoint sets, all BRC-20 transactions are also BTC transactions. You identify BTC ...
RedGrittyBrick's user avatar
4 votes
Accepted

How to manually verify an ECDSA signature in Python?

As I suspected the error was the + sign on two points instead point addition is required, so I modified the code like this: def addp(P,Q): point1 = Point(curve, P[0], P[1]) point2 = Point(...
Alexio puk2sefu's user avatar
3 votes

How to compute a TXID of any bitcoin transaction in Python

That's a SegWit transaction, not all of it is part of the transaction hash preimage (see here for details). You have to exclude the SegWit parts. This Bash one-liner returns the correct TXID: echo '...
bca-0353f40e's user avatar
  • 1,025
3 votes

Python library for Multisignature HD wallets

Stepan Snigirev's embit library: https://github.com/diybitcoinhardware/embit/blob/master/src/embit/bip32.py It powers the Specter DIY hardware wallet, Specter Desktop software wallet, and the ...
Keith Mukai's user avatar
3 votes
Accepted

Failing to construct transaction that unlocks P2WSH

The problem is this line: tx.witnesses.append(Script(['OP_5', 'OP_0', p2wsh_witness_script.to_hex()])) Perhaps confusingly, bitcoinutils uses the same API for scripts as it does for witness stacks (...
Vojtěch Strnad's user avatar
3 votes

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

You can obtain the extended private key with different derivation paths from a mnemonic using the NodeJS libraries: [email protected] bip39 and bs58check. From the extended private key you can ...
m1xolyd1an's user avatar
  • 5,626
2 votes

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

It is usualy discouraged to embed data directly on the blockchain because it is not supposed to be used like that and by doing so you can congest the network and make the blockchain grow in size for ...
Saxtheowl's user avatar
  • 2,780
2 votes

python bitcoin_explorer can't read block 761249

Block 761249 (2022-11-01 10:44:19) contains transaction 73be398c4bdc43709db7398106609eea2a7841aaf3a4fa2000dc18184faa2a7e which is size 500.142 kB and is pretty strange, it contains mostly zeroes. Some ...
RedGrittyBrick's user avatar
2 votes
Accepted

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

Based on Pieter Wuille comments "You do need to concatenate the leaf version, internal public key, and taproot script merkle branch elements into a single control block stack item" this the ...
Bitcoin_1o1's user avatar
2 votes
Accepted

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

Here's some working code for calculating a parent extended private key from a master extended public key and child extended private key. #!/usr/bin/env python3 # pip install hdwallet # pip install ...
inersha's user avatar
  • 3,053
2 votes
Accepted

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

openoms suggested this fix on Telegram to keep using pip: sudo rm /usr/lib/python3.*/EXTERNALLY-MANAGED Christian Decker added some context around Core Lightning's use of Python in its build process:...
Michael Folkson's user avatar
1 vote

What is one word seed word exactly?

As you can see in the code, the word is hashed using SHA256 to get the private key. Because private keys in Bitcoin have 32 bytes, you can't just use any word directly as a private key, and one way of ...
Vojtěch Strnad's user avatar
1 vote

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

The reason for the issue are changes introduced recently in Python and not the policy of your VPS. There are two solutions for this: 1. Install Python dependencies with a package manager like apt, e.g....
John Smith's user avatar
1 vote

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

Check environment variables: Some Docker containers or cloud environments might restrict pip commands. Ensure variables like PIP_NO_INDEX or PIP_DISABLE_PYPI are not set to restrict package ...
sehar talokar's user avatar
1 vote

Unable to get Taproot address using bitcoinlib

python-bitcoinlib doesn't have Taproot support at all (including bech32m, key tweaking, Taproot trees of scripts) at the time of writing (January 2024). There is an open issue here. Taproot tweaks an ...
Michael Folkson's user avatar
1 vote
Accepted

Python Script not working / From Xpub to everything

This script refuses to read my xpub, xpub = Key.from_text('xpub') Other examples I have seen show the argument to from_text() as expecting a key in wallet interchange format (WIF). I don't know ...
RedGrittyBrick's user avatar
1 vote

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

Yes, but it's pretty silly. If you use your addition formula for Qx = Gx, the intermediary s will be 0. From this, it follows that Rx = -2Qx = -2Gx and Ry = -Qy. So if you instead wanted doubling (all ...
Pieter Wuille's user avatar
1 vote

Bitcoind python connection

Two important errors in the output you present are: FileNotFoundError: [Errno 2] No such file or directory: '/home/pariya/.bitcoin/.cookie' and ValueError: Cookie file unusable ([Errno 2] No such ...
Vojta Myslivec's user avatar
1 vote

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

Private keys are just big numbers. Although there's a nit on x-only keys (you must use keys whose pubkeys have an even y coordinate), it doesn't appear to be a problem here, since you can generate ...
Davidson Souza's user avatar
1 vote
Accepted

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

I fixed the script. The below code was used to make this transaction https://blockstream.info/testnet/tx/a86f0187be2eca4590a456e2423a2f5286b269c3b777846092ceb2fc44270aad. from bitcoinutils.utils ...
ChristianOConnor's user avatar
1 vote

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

For P2PKH, you've hashed the private key rather than the public key. For P2SH, you've hashed the public key and used the P2SH version number, however that is not what a P2SH address should be. Rather ...
Ava Chow's user avatar
  • 70.1k
1 vote

Recreate Java code in python

I have a java code that I need to pass to python Unless the same library has been ported to both languages, there will probably be no direct equivalent. Instead it will probably be best to describe ...
RedGrittyBrick's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible