Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [python]

Python is an interpreted, general-purpose high-level programming language whose design philosophy emphasizes code readability.

22
votes
1answer
5k 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!). ...
10
votes
4answers
14k 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 ...
7
votes
3answers
4k 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) ...
6
votes
3answers
10k 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 ...
6
votes
4answers
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 ...
6
votes
1answer
639 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({...
6
votes
1answer
7k views

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

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.
6
votes
1answer
156 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 ...
5
votes
2answers
978 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 ...
5
votes
2answers
548 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 ...
5
votes
1answer
2k 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 ...
5
votes
3answers
2k 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 ...
5
votes
1answer
1k 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 ...
4
votes
4answers
5k 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 ...
4
votes
1answer
4k 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 ...
4
votes
2answers
2k 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 ...
4
votes
2answers
3k 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?
4
votes
2answers
6k 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 ...
4
votes
1answer
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 ...
4
votes
2answers
1k 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 + ...
4
votes
1answer
956 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" ...
4
votes
1answer
625 views

Chainstate LevelDB corruption after reading from the database

I've been working with the LevelDB for a few weeks, coding some tools to access the database and parse the data to be human readable. However, every single time I read from the chainstate the data ...
4
votes
1answer
601 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/...
3
votes
1answer
1k 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 ...
3
votes
2answers
565 views

Type and Amount of Transaction in Blockchain API

I am building myself an alert program with which I want to send myself an alert via email if there are transactions ongoing at all (5) of my addresses. I have chosen the Blockchain API because I ...
3
votes
1answer
76 views

When I use the “send_many()” function in the blockchain.info api, have I to pay the fee only once or for each?

The blockchain.info api looks like this: The link is: https://github.com/blockchain/api-v1-client-python/blob/master/docs/wallet.md But when I give a fee like this: add={'address1':amount1,'...
3
votes
2answers
2k views

When are multiple transactions spending the same output in the same block considered a double spend?

Here is an example of multiple transactions in the same block, all spending from the same output. I created these using the Electrum wallet, telling Electrum to spend a little bit of the BTC from the ...
3
votes
1answer
531 views

help me to understand this mining code

Help me to understand this code, spend all day to understand this code, and learned python from scratch, now I understand what operators do, but still some parts are complex to me. import hashlib, ...
3
votes
1answer
376 views

Coin selection algorithm in Python to optimally select UTXO

Does anyone know of a good coin selection algorithm in Python that's perhaps similar to the one in Bitcoin Core (currently this: github/bitcoin/src/wallet.cpp (per guidance from stackexchange/1077))? ...
3
votes
1answer
562 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 ...
3
votes
1answer
286 views

Python code to vb.net (2012) - help me to eliminate the errors

I wanted to convert the following bitcoin mining python code to VB.net (2012) and I tried to convert it's functionality, but it throws some errors and I'm stuck as I even can't get the resulting value ...
3
votes
1answer
306 views

Why does getNewAddress take so long? Often times out python-bitcoinrpc

Bitcoin 0.11 on a Raspberry Pi 2: https://github.com/jgarzik/python-bitcoinrpc I am using this RPC auth proxy to talk to bitcoind from Python. I have a script that requests getmempoolinfo every 1 ...
2
votes
4answers
1k views

pycoin command line transaction

Is there a quick way to do transactions knowing only the private key(secret exponent) and the destination address, preferably from a command line utility such as pycoin? I am using Debian/Ubuntu and ...
2
votes
2answers
5k 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 ...
2
votes
2answers
2k 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 ...
2
votes
1answer
104 views

Extract lightning network funding transactions with python bitcoin blockchain parser lib

My ultimate goal is to parse funding transactions (as well as channel closes in a later step) from the blockchain. In order to do so I wanted to start with a funding transaction and disect it. ...
2
votes
1answer
265 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 ...
2
votes
1answer
2k views

How to convert a WIF private key to a BIP32 extended private key

I am trying to recover the extended BIP32 master private key from its extended BIP32 public key (which I already know) and a WIF private key (which I obtained by decrypting a BIP38 seed with a ...
2
votes
1answer
2k views

How to generate Bitcoin private - public keys with ECDSA module?

Pretty same question was asked here, but maybe there is a way to generate keys using ecdsa module in just a few lines of code?
2
votes
1answer
123 views

How to get the “BTC” abbreviation via command line?

I'm writing a module that connects to multiple wallets at once and I would like to have a way I can simply query the coin daemon for its coins abbreviation (not the "microcoins" as asked in a comment ...
2
votes
1answer
735 views

Constructing, signing, and pushing a Bitcoin transaction by using pybitcointools with Python

I'm utilizing the pybitcointools module in python 3.4 I've went through time and time again in the examples listed on the github page, but it isn't documented very well nor is the code. My situation ...
2
votes
1answer
2k views

Are there any Python modules that decode raw transaction data?

I'm currently doing RPC calls to bitcoin-cli within python to get raw block data: bitcoin-cli getblock BLOCKHASH False I've already written a function that cuts off the block header and splits the ...
2
votes
1answer
1k 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. ...
2
votes
1answer
2k 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 ...
2
votes
2answers
3k 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 ...
2
votes
2answers
362 views

Unable to send 'version' message correctly

Few days ago I've found this article about using raw Bitcoin protocol and now I'm trying to make my own transaction with Python. But I'm already stuck on sending version message. I've tried to use ...
2
votes
1answer
2k views

How to install Electrum wallet in an offline Linux computer?

So I want to play with the Electrum wallet, but as Cold Storage. Then what I plan to do is to install a raw Ubuntu 16.04 LTS into a computer "A" which I will never plug to the internet. So, with ...
2
votes
2answers
624 views

getting bitcoin address of blk*.dat files

I know that getting the address from the blk*.dat files is discussed a lot of times. But I don't get it why? When I have the raw scriptSig I can encode it and get the bitcoin address or not? E.g. the ...
2
votes
2answers
974 views

OP_RETURN using python

I'm trying to make a simple program that can reliably upload an OP_RETURN transaction. I have found some examples online, but so far they don't work consistently. The ones that go through seem to be ...
2
votes
2answers
566 views

“value” field in raw transaction: Rounded Bitcoins (float) or Satoshis?

I am getting confused about the Bitcoin amount presentation in a raw transaction's "value" field. If i want to spend 0.05 BTC, for instance, which of these is the correct value? "value" : 0.05 "...