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
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
4k 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
493 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
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
770 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
225 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
760 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
261 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
302 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
470 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
522 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
303 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
0answers
35 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
82 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
820 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
347 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
457 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
592 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
73 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
896 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
1answer
625 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
79 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
3answers
3k 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
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
948 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
223 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
40 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
62 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
71 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
3answers
3k 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
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
408 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
463 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
275 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
319 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
119 views

Decoding hex scriptsig in Python

Running decodescript on d1a076722d11ddfd0fadb96d6d960b8b2ad6c6369570cd00df70a801a6be9e44 is returning: { "asm": "0 ...
1
vote
1answer
217 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 ...
1
vote
2answers
45 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
59 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
68 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
1answer
427 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
252 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
166 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 ...