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
1answer
2k views

How to start working with blk*.dat data?

I have the complete bitcoins block data (blk00000.dat, blk00001.dat.....). I want to convert it into some readable format like csv or json. Can it be done using python or any other software ?
1
vote
1answer
155 views

SIGHASH_SINGLE vbuterin/pybitcointools

Checking the implementation of Buterin's bitcoin tools I've noticed something strange. According to the Bitcoin developers guide, sighash_single signs only the outputs that match the input where the ...
1
vote
1answer
960 views

Stratum Server Exception “[coin] is not connected”

When i running 'twistd -ny launcher.tac' i getting the following Exception. The connection okay. Please help me to fix this issue. 2017-01-30 19:33:43,094 INFO bitcoin_rpc # Checking for submitblock ...
1
vote
0answers
778 views

Electrum - using a fixed fee regardless of transaction size

I am using Electrum 2.7.12, and I intend to use the python console to paytomany() while using a fixed fee. I have tried following directions from http://matt.ramuta.me/blog/1419787186410-how-to-write-...
1
vote
1answer
1k views

Sending transaction with Python + raw protocol

Two days ago I've found a few articles, about using raw bitcoin protocol, and now I'm still trying to send a transaction. My code is based on this class, and if I understand all of this bitcoin magic ...
2
votes
2answers
550 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 ...
1
vote
3answers
2k views

Library for generating HD keys/addresses (ideally for python)

I require a library that I can create (and later import) a HD master key, which I will use to generate hundreds of addresses for both testnet and mainnet! Ideally, I need a python library (but had ...
2
votes
1answer
3k 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
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
2answers
674 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 ...
5
votes
1answer
207 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 ...
0
votes
1answer
329 views

What's the easiest way to hook into multiple BTC exchanges?

If you want to compare prices of BTC across multiple exchanges, is there a central mechanism or place to do so? I have been unable to find such a thing from my research
5
votes
1answer
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.
3
votes
1answer
2k 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 ...
1
vote
1answer
425 views

anyone attempted a multiple p2sh(multisig) send (ideally using python)?

I attempted to use pycoin to do a "create_signed_tx" in python, but had no joy: Do you think it might be technically possible to use spendables(UTXOs) from multiple source P2SH wallets in a single ...
5
votes
1answer
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" ...
2
votes
1answer
851 views

I can't connect to RPC from python. JSONRPCException: -342

Tryed to run this code : from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException import logging import json logging.basicConfig() logging.getLogger("BitcoinRPC").setLevel(logging.DEBUG) ...
1
vote
0answers
149 views

Troubleshooting pybitcointools: signing transaction valid only for certain hash values

From my pybitcointools fork's issues: I'm having some weird issues with the signature sometimes it works and other times it doesn't. When I see '[ALL]' in scriptSig that's when I know it's ...
0
votes
1answer
421 views

cannotsend error using python bitcoin library to send bitcoin on testnet

When I run the script from bitcoin.core import COIN, b2lx import bitcoin.wallet import bitcoin.rpc rpc = bitcoin.rpc.Proxy() addr = bitcoin.wallet.CBitcoinAddress('mfrMeTKojpEXFXpcQiRr7zA3Bff4UBgZTx'...
3
votes
1answer
498 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))? ...
0
votes
1answer
186 views

Troubleshooting pybitcointools transaction signing/verification

I'm having several problems getting tests to successfully run under my fork (or vbuterin's pybitcointools, and I'm hoping someone with a combined Python / Bitcoin knowledge can provide some insight. ...
1
vote
1answer
132 views

micropayment channels, n-m addresses, interoperability

I just read bitcoinJ's working with contracts tutorial and I am puzzled as: it seems to me that n-m addresses are implemented in Bitcoinj using plain multisig (as defined in this bit of the developer'...
2
votes
1answer
544 views

from b58check to hex and back

I am manipulating (with pybitcointools) some regular addresses as well as some P2SH and stumbled upon the following: Case 1: >>> b58check_to_hex('17rq8m5SW8XoZ9dHEkQyBfc5w2XQnQvznz') '...
2
votes
1answer
449 views

Mining algorithm in vb.net

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 ...
2
votes
1answer
759 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, ...
1
vote
0answers
455 views

Is there any library to process scriptSig script in transaction, and other scripts?

I'm trying to parse hex representation of scriptSig, in normal transactions there are variable int, r&s, pubkey. But some are really weird, like those ones: ...
2
votes
2answers
839 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 ...
1
vote
1answer
114 views

Making a Server?

Can anyone give me some advice? I'm looking to learn how to make an independent market for selling and buying CS:GO skins for BTC. I'm using Django and I want all BTC to be stored and processed ...
2
votes
1answer
82 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,'...
0
votes
1answer
1k views

Create raw transaction in python

I have a private key (raw + WIF) and I want to send all funds from that address - fee to another address. Is there a raw python function that can do that for me ? I will broadcast the tx manually. ...
3
votes
1answer
349 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 ...
6
votes
1answer
3k 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 ...
0
votes
2answers
414 views

Regtest: address is still at zero after sending some bitcoins

I'm trying to send some btc to an address in Regtest mode: the address where I want to send is: mjeoXvBnD4DtZumeSJEjNJfLb4RrhpbH1H $ bitcoin-cli -regtest -rpcuser=bitcoinrpc -rpcpassword=Alice -...
4
votes
4answers
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 ...
1
vote
1answer
280 views

python-bitcoinrpc: only DEBUG available?

I'm starting with python-bitcoinrpc from J.Garzik. I'm using to try it the code provided by James D'Angelo (from Bitcoin 101 on youtube): Apparently, there were some major changes with python-...
12
votes
4answers
18k 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 ...
2
votes
2answers
795 views

Convert a list of 64 hex keys to private import format

Is there a python script that i could use to convert a list of private hex keys to there import format in bulk? How would I go about this.. Could this be adjusted to take a .txt list of hex ...
1
vote
1answer
337 views

Regular Expressions for DER signature hex (also req, address, TxIDs)?

I'm using Python (2.7) and its re module for recognition of various Bitcoin data, namely: addresses, DER sigs, OP Return hexdata, TxIDs I've been using re.compile: for example, for a valid Tx ...
2
votes
1answer
130 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 ...
6
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 ...
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 ...
1
vote
1answer
189 views

question on Armory bitcoin wallet scripting

Has anyone built the Armory Bitcoin wallet successfully and created the wallet using python and Armory as a library instead of using the GUI?
2
votes
1answer
856 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 ...
3
votes
1answer
784 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 ...
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 ...
6
votes
1answer
837 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({...
2
votes
1answer
3k 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
611 views

Duplicate r value for an address: only an issue for a multi-input Tx?

I've modified the r-scan Python code to look beyond the 50 Txs the Blockchain.info API usually returns. My modifications take all the r values for my address and look for duplicates, but a commented ...
5
votes
2answers
829 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 ...