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
2
votes
2answers
628 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 "...
2
votes
2answers
2k views

How can I create a list of X richest bitcoin addresses?

I have looked around, but I can't find the code related directly to my question. I want to create a list in any format that contains the all accounts with balance over 0 for example. Thanks ahead for ...
2
votes
1answer
286 views

Python: How generate bitcoin addresses using electrum library

What am I doing wrong here? I'm trying to generate bitcoin addresses from the seed but they do not match with ones from electrum application. Did I miss something? And I also have trouble with ...
2
votes
1answer
235 views

Cannot make valid Bitcoin Cash transaction

I've been way in over my head hacking around in various Python Bitcoin libraries. From what I understand, input public keys have to be compressed to be accepted. Is that correct? I have an ...
2
votes
1answer
242 views

Python testnet raw transaction creation error

Based on the script from github. I tried to construct a valid testnet transaction. I had to do some modifications to the script so here is the current code. import struct import base58 import hashlib ...
2
votes
1answer
419 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
415 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 ...
2
votes
1answer
284 views

Pushing a large signed transaction (testnet) using Python

I have been trying to send a signed transaction using pybitcointools (Python) using the blockr_pushtx function, however it consistently returns Exception: {"status":"fail","data":"Could not push your ...
2
votes
2answers
2k views

Bitcoin RPC works in bitcoin-cli but not in python-bitcoinrpc: No JSON object

I'm running a testnet node. I can use bitcoin-cli just fine: >bitcoin-cli.exe getinfo { "version" : 100000, "protocolversion" : 70002, "walletversion" : 60000, [... snipped] But when ...
2
votes
1answer
1k 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=...
2
votes
1answer
23 views

How to parse values in block index leveldb?

So I'm trying to read the block files with Python. From this link, What are the keys used in the blockchain levelDB (ie what are the key:value pairs)?, it tells you how to access the files with ...
2
votes
1answer
2k 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, ...
2
votes
0answers
762 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) ...
2
votes
1answer
309 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 ...
2
votes
0answers
443 views

How to add blockchain.info API key to pibitcointools

I have a query-intensive app I'm building that keeps timing out with the message: Traceback (most recent call last): File "test.py", line 72, in <module> array = bitcoin.multiaccess (...
2
votes
1answer
462 views

What is the required input for python-bitcoinlib getrawtransaction command?

I am running a bitcoin node on my machine, fully synced with RPC commands enabled, rpc server live and txindex=1. In the command-line I can run the following RPC call and obtain the information ...
1
vote
1answer
56 views

Why is Target < Blockhash?

I am currently trying to validate a blocks hash against its target in python3: This is a block in the Blockcypher testnet, and I am using this formula from the Bitcoin Wiki. block_hash = '...
1
vote
2answers
819 views

API Authentication via Python

I'm having trouble following LakeBTC's API instructions for connecting to their API via Python. API Documentation: https://www.lakebtc.com/s/api I have my key (email address) and secret. I'm using ...
1
vote
3answers
2k views

Bitcoin library in python

I need a good library for bitcoin and other BTC-like cryptocurrencies in python. I'm looking for something similar to bitcoinjs but in python. Minimal requirements: generate an EC keypair and get ...
1
vote
1answer
1k views

getrawtransaction seems to only work for certain transactions

I am working through mastering bitcoin. I am confused by getrawtransaction. I would like to look at the first transaction in block 277316. from bitcoinrpc.authproxy import AuthServiceProxy, ...
1
vote
3answers
1k 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 ...
1
vote
2answers
854 views

Help me use python-bitcoinrpc

I have got the api working and i can run commands like access = AuthServiceProxy("http://root:123@127.0.0.1:8332") access.getinfo() However not sure how to use more complicated commands such as: ...
1
vote
1answer
209 views

os.getpid() in Bitcoin's python test scripts - What does it actually do?

I was looking at ../qa/rpc-tests/util.py in order to figure out how arbitrary ports are assigned to each created node. In the first lines of the code it says: ...def p2p_port(n):return 11000 + n + ...
1
vote
1answer
2k views

API Bitfinex question: “key amount should be a decimal string”?

I started writing code for the Bitfinex api yesterday and I've been struggling quite a lot with this. I am using jndok's python implementation. I added my pyblic and secret keys and wrote this line ...
1
vote
2answers
56 views

Why are my Signature Scripts Different from my professors?

bob_addr = "1NWzVg38ggPoVGAG2VWt6ktdWMaV6S1pJk"#"1FMb8Jnn1jSh7yjDFfonC8xCCH3ittoEzB" bob_hashed_pubkey = base58check.b58decode(bob_addr)[1:] bob2_hashed_pubkey = b'\xec\x06\xb2\xbf\x18\xc8\x97\x06\...
1
vote
1answer
363 views

When I call the blockchain.info API, I an error. What can i do to solve this problem?

A script that calls the blockchain.info API to find the UTXO related to an address # get unspent outputs from blockchain API import json import requests # example address address = '...
1
vote
1answer
427 views

ScriptSig field during P2PKH transaction signature

In P2PKH transactions, the content after signing the transaction contains: <signature(with hash_flag)><public_key>. However, since the signature can't sign itself, during the signature ...
1
vote
1answer
253 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-...
1
vote
1answer
254 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 ...
1
vote
2answers
9k views

Solving PyCrypto 2.6.1 errors for Python 3.4 (Windows7 x64)?

Whilst there's less of an issue with Python 2.7, Python 3.4 relies on the pycrypto library for numerous wrappers/APIs/tools such as BlockTrail, pycoin, pybitcointools, etc etc. The error I'm getting:...
1
vote
2answers
32 views

Why getinfo() and listchannels() inactive channel count differs?

I have strange results comparing node information outputs between getinfo() and listchannels() calls. Maybe someone has thoughts what is wrong (with my trivial code or with c-lightning itself): chans ...
1
vote
1answer
42 views

Create a transaction spendable in a specific block height

I am new in Bitcoin and I try to create an address in Bitcoind and send a transaction that the amount will be spendable in a specific height of the blockchain. Here is what I have done: privateKey = ...
1
vote
1answer
51 views

Mutlisig tansactions with trezor with multiple inputs and outputs not able to broadcast

I am trying to do a multisig here is my final hex ...
1
vote
3answers
1k 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 ...
1
vote
1answer
305 views

Altcoin - genesis block - TypeError: __init__() takes exactly 2 arguments (3 given)

I'm trying to use the genesis script from innova to generate a genesis block of Xevan_hash https://github.com/innovacoin/GenesisH0/blob/master/genesis.py I'm using these parameters: python genesis....
1
vote
1answer
195 views

bitcoin chainstate database parsing in python giving wrong value

I am trying to decode chainstate db for a specific out index for a transaction in python just for learning. Transaction ID: 4d4a4c6ca4f3c91e69563199943336d3279fad71c9e8d9c1708ef9dc6ac16000 out index = ...
1
vote
1answer
158 views

Project on modelling Bitcoin blockchain data

I am doing a thesis project on modelling Bitcoin blockchain data, but atm I am having trouble getting data from the Bitcoin blockchain into a format that is easy to deal with in e.g. Python. I have ...
1
vote
1answer
462 views

Can I connect to Litecoin, Dash, BitcoinCash, Doge, etc. RPC with Bitcoin RPC client?

I want to set up a few nodes for different Bitcoin-derived cryptocurrencies and regularly query them for data via the JSON-RPC API. The thing is: I can't find much information on any other RPC API ...
1
vote
1answer
378 views

Is it possible to spend bitcoins from private key 0?

In [1]: from bitcoin import * In [2]: privtoaddr(0) Out[2]: '16QaFeudRUt8NYy2yzjm3BMvG4xBbAsBFM' On blockchain.info, there is 0.01 BTC unspent in this address. Is it possible to spend the bitcoins? ...
1
vote
1answer
3k views

ecdsa - Create Private key and Bitcoin Address

I have the following code: import binascii import hashlib from fastecdsa import keys, curve # generate a private key for curve P256 priv_key = keys.gen_private_key(curve.secp256k1) print (priv_key) ...
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
787 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
1answer
778 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 ...
1
vote
1answer
322 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 ...
1
vote
1answer
122 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'...
1
vote
1answer
113 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 ...
1
vote
1answer
470 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
184 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?
1
vote
1answer
205 views

BIP39 Japanese Mnemonic vector unit test process

There is a json for unit tests of Japanese characters which I want to validate using Python, specifically with this fork of pybitcointools, which has bip39 functionality. Unit tests from Trezor's ...
1
vote
1answer
846 views

Sample programs written using python-bitcoinlib?

Where can I get source codes of programs written using the python-bitcoinlib?