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
1answer
94 views

How to Pay to Multisig Wallet Using python-bitcoinrpc?

How do I pay to a multisig wallet? I am using the Python API (based on python-bitcoinrpc) that ships with the bitcoin source code, in directory bitcoin/test/functional. I'm using regtest. I call ...
2
votes
1answer
180 views

How do I sign a transaction in Python?

How do I sign a P2SH transaction in Python? I am using the Python API that ships with the bitcoin source code, in directory bitcoin/test/functional. I'm using regtest. Here is a fragment of my unit ...
2
votes
1answer
77 views

Python implementation for LND path finding algorithm

The most common Lightning nodes use GO, C or Scala for their implementation. Is there any publicly available Python implementation for the path finding algorithm any of the most known clients use (LND,...
2
votes
1answer
3k 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
5k 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
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
2answers
801 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
1answer
235 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 ...
2
votes
2answers
1k 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
803 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
34 views

XPub to YPub Converter (python) - Last digits wrong

The code below is generating an YPub from XPub with the last 6 digits wrong. How can I verify what's happening and fix this error? e.g.: It should be ...
2
votes
1answer
85 views

Cannot import python-bitcoinrpc

I am unable to import the package bitcoinrpc. I have installed it in python2 and python3 using python3 -m pip install python-bitcoinrpc/python -m pip install python-bitcoinrpc AND by cloning the repo ...
2
votes
1answer
272 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
330 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
2answers
528 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
502 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
2answers
660 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 ...
2
votes
1answer
554 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
309 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
2answers
209 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
2
votes
0answers
37 views

How to generate unspendable testnet bitcoin address with python?

I'm trying to generate a testnet address. However, I tried to write this python program (using help of various online code places), and I created this program. The program is designed to take a 20 ...
2
votes
1answer
131 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
0answers
834 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
375 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
0answers
465 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
672 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
84 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
907 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
2answers
105 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 ...
1
vote
1answer
740 views

How to fetch the latest unspent transaction by an address using bitcoind?

I want to build a server, which provide following APIs: 1.Get balance by address. 2.Get latest unspent transaction. 3.broadcast the transaction. First by first, I know I can do above stuffes by ...
1
vote
2answers
89 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
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
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 ...
1
vote
2answers
991 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
231 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
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
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
109 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 ...
1
vote
2answers
44 views

How can I execute `getnewaddress` at my full node from a remote server?

I have a full node running on a digital ocean droplet. I have an app running at heroku, and I want to execute getnewaddress from this app. I'm trying to generate BTC addresses to which users can send ...
1
vote
1answer
124 views

How to run a python script when occur incoming transaction in Bitcoin core 0.18?

I want to run a python script when occur an incoming transaction. I think set zapwallettxes flag in bitcoin.conf but I don't know where set the script path to execute. Is it possible to execute ...
1
vote
1answer
77 views

In Python RPC Calls, How is vout Address Derived for P2PK transaction?

How is the vout address derived for a P2PK transaction? I am using the Python API that ships with the bitcoin source code, in directory bitcoin/test/functional. I'm using regtest. I have written a ...
1
vote
1answer
4k 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
418 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
477 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
279 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
329 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
1answer
298 views

Decoding hex scriptsig in Python

Running decodescript on d1a076722d11ddfd0fadb96d6d960b8b2ad6c6369570cd00df70a801a6be9e44 is returning: { "asm": "0 ...
1
vote
1answer
313 views

How exactly do I decode the block file info in leveldb?

Base on the links https://github.com/bitcoin/bitcoin/blob/fcbc8bfa6d10cac4f16699d6e6e68fb6eb98acd0/src/main.h#L392 and What are the keys used in the blockchain levelDB (ie what are the key:value ...