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
33 votes
3 answers
13k views

How is the whitepaper decoded from the blockchain (Tx with ~1000x m of n multisig outputs)

The whitepaper is apparently encoded at 54e48e5f5c656b26c3bca14a8c95aa583d07ebe84dde3b7dd4a78f4e4186e713, which is an m of n multisig Tx with 947 outputs (just under the scriptsig limit of 20kB!). ...
Wizard Of Ozzie's user avatar
16 votes
4 answers
22k views

A complete bitcoin implementation in Python?

I recently became aware that python-bitcoinlib is not a full bitcoin node implementation, but rather a set of tools to work with bitcoin-core cpp. I would like to know whether there are some ...
user2277550's user avatar
10 votes
3 answers
16k views

Is it possible to create a transaction in pure python without needing to run bitcoin locally?

Lets say I have a bitcoin address that has 10 BTC sent to it. I also have the private key for this address Using Python (2 or 3) is there a way to create a signed transaction (which I believe is a ...
priestc's user avatar
  • 311
8 votes
4 answers
8k views

How can I test if a bitcoin address is compressed or not?

I have two bitcoin addresses: 1D8VSXHFAWNhAbruwUMbNp4hsXAnRNkYvX 12T15tvMGaymMX97X9KxVzyLF323r8v6Hg One is compressed, one is not. How can I test which is which? (Preferably using python 2.7) ...
derrend's user avatar
  • 696
8 votes
1 answer
1k views

Does bitcoind accept batch RPC calls?

Am currently sending RPC calls to bitcoind in Python3 in series using JSON: import json, requests def pull(command, foo): headers = {'content-type': 'application/json'} payload = json.dumps({...
SLee's user avatar
  • 133
7 votes
4 answers
4k views

Is there bitcoin implementation in python or C#?

I want to play with the implementation to better understand the inner workings of Bitcoin. I'm familiar mostly with python and C# and found no clients in either of the languages. My C skills are rusty ...
Moonwalker's user avatar
7 votes
2 answers
6k views

python-bitcoinlib | Create Private Keys, Public Keys and Addresses - How to Do It?

I'm trying to use the python-bitcoinlib library but its docs aren't entirely clear to me. I'm a programmer but quite new to Python, and not very versed in the Bitcoin protocol. What's the process, ...
Gal Grünfeld's user avatar
7 votes
1 answer
788 views

How does bitcoin functional test framework work?

Could someone explain how and where in the code the bitcoin test framework calls map to C++ bitcoin core code or RPC calls such that regression suite tests the bitcoin core functionality? Background ...
Happy ITWala's user avatar
7 votes
3 answers
3k views

bitcoin.rpc python library problem

I am working through Master Bitcoin. I got the bitcoin client up and running. I am now trying to access the client from python. In the example, there is a line that says from bitcoin.rpc import ...
user2242044's user avatar
6 votes
1 answer
4k views

Recovering a HD wallet from a partial seed phrase

I am attempting to help recover a wallet where the owner only wrote down 11 of the 12 words in the seed phrase. Initially, I thought the task would be a quick and well-defined, but it appears to be a ...
LivingInformation's user avatar
6 votes
2 answers
3k views

Mining Block header bit reversing

While trying to understand the mining process and checking in python..... i am puzzled with which info from/to pool are in Little Endian, which one needs reversing in building the block header + ...
Santan's user avatar
  • 75
6 votes
3 answers
3k views

Starting point for listening to bitcoin network transactions in Python

I would like to create a python script that listens to the bitcoin network and monitors some addresses, stored in a mysql db. As soon as a transaction is broadcast with one of these addresses as an ...
DDecoene's user avatar
  • 299
6 votes
3 answers
476 views

Python library for Multisignature HD wallets

Is there is any python library is available that allow creation of Multisignature HD wallets ?
Pankaj Kumar's user avatar
6 votes
1 answer
264 views

What is better, pre-existing Bitcoin-core API bindings for python or custom wrapper functions

How advisable is using the following code to query the bitcoin core as compared to using some python RPC library. import os btc_prefix = 'bitcoin-cli ' def getblockcount(btc_prefix): print("in ...
Shabahat M. Ayubi's user avatar
5 votes
4 answers
15k views

Convert WIF to private key

I am aware how to convert the private key into WIF format in python, now I am trying to reverse this process and convert a WIF formatted private key back into a 256-bit private key, following this ...
Fabulous Job's user avatar
5 votes
2 answers
1k views

Why is Python popular in Bitcoin projects?

When checking out open source projects related to Bitcoin, I see that many are written in, or make a large use of, Python language. I mostly use Ruby and have little experience in Python; so, I would ...
mc9's user avatar
  • 233
5 votes
2 answers
927 views

The complement of s (when s < curve order / 2)

Bitcoinlib refers to the requirement that if s > ORDER / 2, then the complement of s should be used instead since it's one byte shorter This sounds like it's referring to the inverse or negative s ...
Wizard Of Ozzie's user avatar
5 votes
3 answers
17k views

How to generate public and private key pairs from the 12 seed words in python

I basically followed the instructions here How to generate mycelium addresses from the 12 words in python So my code is similar: from bip32utils import BIP32Key from bip32utils import BIP32_HARDEN ...
Stormy Dan's user avatar
5 votes
1 answer
244 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 ...
Simon's user avatar
  • 51
5 votes
1 answer
7k views

Where can I learn how to build a blockchain from scratch? [closed]

I am a newby programmer, I am learning python and objective C and I want to learn how to build a blockchain from the beginning. Are there any resources that could help me.
iivri  andre's user avatar
5 votes
1 answer
1k views

Making peer connection in Python

I'm trying to make a simple peer connection using Python. If I understand correctly communication begins by sending a "version" packet to the receiving node. The node then sends back a "verack" ...
Abovestand's user avatar
5 votes
1 answer
512 views

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

I have been documenting how to create different types of Tx outputs here, leveraging the Bitcoin Core Test Framework. Particularly for Taproot, I'm working on a scenario of a P2TR Script Path with a ...
Bitcoin_1o1's user avatar
5 votes
1 answer
2k views

Best Python API for sending Bitcoins from a Multi-Sig wallet

I want to create a multi-sig wallet which I can broadcast transactions through an API. I would like a wallet with a permanent public address not one that changes every time I run the code. I was going ...
Joshua's user avatar
  • 151
4 votes
4 answers
6k views

Algorithmic trading python library?

I am starting to do Algorithmic trading in cryptocurrencies using Python libraries. Most exchanges have RESTful APIs that make it easy to write you own code and get started. However, I would like to ...
fccoelho's user avatar
  • 211
4 votes
2 answers
2k 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 ...
Eugenio Cortesi's user avatar
4 votes
1 answer
6k views

Signing a raw transaction with Python ECDSA (or OpenSSL)

I'm looking for specifics of Step15-17 from Redeeming a raw Tx Step By Step, which is essentially the step where the concatenated raw Tx structure is double sha256 hashed, and then signed with an ...
Wizard Of Ozzie's user avatar
4 votes
2 answers
4k views

How can I run an Electrum console command from outside Electrum (in Linux)?

I want to use my electrum wallet balance in my another python application. How do I make a call to the getbalance() function?
latgarf's user avatar
  • 141
4 votes
1 answer
1k views

non-mandatory-script-verify-flag (Invalid Schnorr signature) when I try to send a P2TR tx on testnet

I'm learning to create tx from scratch in order to understand better how bitcoin tx works and how they are structured. I learnt to create tx with legacy address, segwit v0 and I am now learning ...
alemaz98's user avatar
  • 143
4 votes
1 answer
180 views

How does the BIP340 lift_x algorithm work?

Couple questions of code that I'm reviewing trying to learn schnorr sigs. Why do we want an odd private key? I see even tests on the private key and then subtract it from the SECP256K1 Order to get an ...
Kaizen's user avatar
  • 331
4 votes
2 answers
6k 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
R ford's user avatar
  • 81
4 votes
2 answers
8k views

How to access market price from Python?

I am struggling to get access to the kind of information I have on cryptowat.ch. For example on Kraken there is an API, but I didn't find how to get the past history, the volume information, etc. Is ...
nowox's user avatar
  • 227
4 votes
1 answer
3k views

Are there any blockchain inspection tools/libraries?

I am going to write software that gets information from the blockchain directly. Are there any tools or libraries to speed up that process? I am looking for things like decoding and encoding ...
haael's user avatar
  • 183
4 votes
2 answers
193 views

Is it possible to retrieve input addresses and input values of bitcoin transactions from raw blk.dat files?

I'm developing a script that processes blk.dat files from bitcoin core. So far, I am able to retrieve the following attributes for transaction inputs: "vin", "index", "...
Andreas's user avatar
  • 89
4 votes
1 answer
4k views

How to generate mycelium addresses from the 12 words in python

I am trying to re-generate the receiving addresses (and change addresses, for that matter) my mycelium wallet has generated. So far I've used trezor's implementation of BIP39 to generate the entropy ...
Gabriel's user avatar
  • 115
4 votes
1 answer
2k views

How can I check if a bip32 xpub key is valid using python?

I'm on the hunt for some python code that will tell me if a string is a valid bip32 xpub key but I'm having trouble finding any. I also would like to check if a string is a valid bitcoin address. ...
derrend's user avatar
  • 696
4 votes
1 answer
1k views

Best method for getting bulk address information (total sent, received, and final balance)

I need to go through a large list (about 100 000) of bitcoin addresses, and, if they have a final balance, find that as well as the total sent and recieved. I am working in python, and I have looked ...
MrJanx's user avatar
  • 41
4 votes
1 answer
177 views

Problems with multiple wallets on RPC in bitcoin-core

I have been playing around a bit with Bitcoin Core (version 23.0), more specifically connecting to different wallets in Bitcoin Core through RPC in Python. I have found this library and tried to ...
chilixxd's user avatar
4 votes
2 answers
2k 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) ...
mike-a's user avatar
  • 55
4 votes
1 answer
326 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=...
Spencer Dupre's user avatar
4 votes
1 answer
809 views

Clarification of BIP32 hierarchical deterministic multisig scripts

As everyone is aware, I'm a huge proponent of Vitalik Buterin's pybitcointools Python 2.7/3.x library. I am having a some trouble understanding the BIP32 concepts, which are coded in the deterministic/...
Wizard Of Ozzie's user avatar
4 votes
1 answer
2k views

bitcoind JSON-RPC interface timeouts under unit tests

I am running unit tests against bitcoind which do JSON-RPC requests in high rate. Random failures are an issue. E.g. if you have something like this in printconsole logs: ThreadRPCServer method=...
Mikko Ohtamaa's user avatar
4 votes
0 answers
295 views

Creating a P2SH-P2WPKH using Bitcoin Functional Test Framework

I'm using the Bitcoin Functional Test framework to understand how SegWit works by analyzing and building a P2SH-P2WPKH transaction. When I run my code the transaction gets created, but when I inspect ...
Bitcoin_1o1's user avatar
3 votes
1 answer
966 views

Why is the Bitcoin Core HWI written in Python? If it was rewritten in Rust should the Python HWI still be maintained?

Why is/was the Bitcoin Core HWI written in Python? What have the challenges been of having the HWI written in Python? There seems to be interest and rationale(s) to write another HWI in Rust. Would ...
Michael Folkson's user avatar
3 votes
1 answer
3k views

How do I convert Public Key x value to y in Python and verify?

I have been using the BTC Address utility which enables me to type in something like: 020F031CA83F3FB372BD6C2430119E0B947CF059D19CDEA98F4CEFFEF620C584F9 Then clicking a button the program can spit ...
lungbubble's user avatar
3 votes
2 answers
3k views

How does the bip32 version bytes convert to base58?

Converting the BIP32 version bytes - x04\x88\xad\xe4 - from base256 to base58 and base58Check returns 7irrX and 1kz713TZjju, respectively. I thought the version bytes represented xprv. What am I ...
Wizard Of Ozzie's user avatar
3 votes
2 answers
3k views

How to use python reference for encoding a bech32 address?

Could someone provide an example of how to use the python reference implementation for generating a bech32 address? For example, generating a mainnet bech32 address for this scriptPubKey: "...
Darius's user avatar
  • 789
3 votes
1 answer
275 views

Optimising blockchain parsing with rpc + python

I have a python app to track and store utxo in a simple/flat structure that looks like this... from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException # track the utxo trackUtxoList = [] ...
d3wannabe's user avatar
  • 275
3 votes
4 answers
10k views

How to produce a Hash160 bitcoin address?

tl;dr How should one perform Hash160, using most basic tools? ==================================================== Hi, I'm trying to figure out, how transactions work in bitcoin. When I choose ...
lotrus28's user avatar
  • 141
3 votes
1 answer
419 views

What is the probability of an ECDSA signature being less than 71 bytes

Since DER requires R and s values being minimally encoded signed integers, they could be less than the expected 32 bytes. What is the probability that one or both of R and s are less than 32 bytes for ...
Ava Chow's user avatar
  • 70.4k
3 votes
2 answers
3k 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 ...
user51679's user avatar

1
2 3 4 5
8