Questions tagged [python]
Python is an interpreted, general-purpose high-level programming language whose design philosophy emphasizes code readability.
234
questions
2
votes
1answer
286 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 = ...
0
votes
1answer
2k views
ModuleNotFoundError: No module named 'bitcoin'
Here's my code:
from bitcoin.rpc import RawProxy
# Create a connection to local Bitcoin Core node
p = RawProxy()
# Run the getinfo command, store the resulting data in info
info = p.getinfo()
# ...
2
votes
1answer
181 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. ...
0
votes
1answer
471 views
Electrum Gap Limit from CLI
Is there any way to change wallet gap limit in Electrum from command line? If yes, how? If not, could it be bypassed using some kind of external script? I really need to avoid GUI. Thank you in ...
4
votes
1answer
502 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 ...
0
votes
1answer
618 views
need advice for Python interaction with bitcoin-core wallet
I've read about a few Python libraries that performs JSON-RPC calls to bitcoind. However, not many are actively developed/maintained, nor are they widely used in production environment. Since bitcoind ...
2
votes
1answer
654 views
How to create a p2sh transaction with a scriptsig of OP_true?
How can I create a p2sh transaction with a scriptsig containing OP_TRUE only, removing the need for a digital signature, which will be broadcasted and mined?
Also could some one provide an example of ...
0
votes
1answer
302 views
Pycoin: How to sign SegWit transaction via Pycoin?
My target is to make transaction with unspent transaction outputs(UTXOS).
The information of UTXOs is as follow.
[
{
"pt_idx": 0,
"subaccount": 37,
"ga_asset_id": 1,
"value": "...
0
votes
1answer
335 views
Pycoin: How to send transaction?
There is a problem in making and sending transaction.
I got UTXOS by using API(GreenAddress), and from utxos I made a transaction. But calculated fee is always larger than one in original GA service.
...
0
votes
1answer
38 views
GreenAddress: Noticfication of receiving transaction
I'm developing python project using greenaddress API. I use pycoin package.
I almost completed, but I can't resolve notification problem.
Using greenaddress API, the notification received is as follow....
0
votes
1answer
384 views
How to set up a private chain/local testnet : reverse engineering the blockchain code
Long story short, I want to set up a private chain/a testnet blockchain that can run locally just to fiddle and play with it just to learn how it works. So I have a general understanding of how things ...
1
vote
1answer
173 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 ...
0
votes
1answer
403 views
Can I, and how do I query the Bitcoin Core wallet to give me a list of all transactions for any specified address?
I've read some conflicting things on this. Given any address, what would be the json command and or how would I import into python, such a query to my bitcoin core wallet for an array of all the tx ...
1
vote
1answer
157 views
Wrong testnet address generation [python]
I'm trying to generate a testnet address without success.Main net address is working fine. Here is my code. The generated testnet address from this code is :CNFNz61dzQ2NQ9RCnjJFrm2de7nLbbT9xSv which ...
1
vote
1answer
545 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
576 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
0answers
378 views
Having trouble using GDAX API to place market buy order
Here is the documentation I'm following and to place a buy order, the syntax follows the following format:
# Buy 0.01 BTC @ 100 USD
auth_client.buy(price='100.00', #USD
size='0.01', #...
0
votes
0answers
127 views
Issues when attempting to get accounts using the GDAX API
Here is the github I have working with:
https://github.com/danpaquin/gdax-python
When I run the following code:
auth_client.get_accounts()
I'm getting the following error:
TypeError: expected ...
0
votes
0answers
241 views
Help with multi-input transaction by code
I'm trying to consolidate multiple inputs into a single output, all left over is for the miner.
When I send my transaction to a peer, it is never mined.
I believe something is invalid in the multi-...
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)
...
0
votes
1answer
398 views
How secure is bitcoin private key generated by this script? [closed]
I found this python script on github.
It generates a pair of bitcoin private key and address.
I know the private key may be vulnerable if it is created insecurely.
I don't have much knowledge ...
1
vote
0answers
38 views
Which exchanges, if any, satisfy the following requirements? [closed]
Accepts non-US/non-EU citizens (specifically, they must accept South African citizens).
Must be a mostly international or US based exchange (like Coinbase or Kraken).
That is, it's supply and demand ...
2
votes
1answer
286 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 ...
0
votes
1answer
200 views
What python code is necessary to convert the integers of a bitcoin public key into the proper hex version thereof?
If I get a public key of two integers, x and y values what code is necessary to convert them into their hex versions without any additional letters, or numbers? This is half a Python programming ...
2
votes
1answer
344 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
...
0
votes
1answer
332 views
How to get the number of Bitcoin transactions every 30mins using API in python?
I'd like to get number of Bitcoin transactions every 30 minutes using API in python.
Does someone know sample code how to mount in Github or any website?
2
votes
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 ...
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 ...
4
votes
2answers
8k 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 ...
0
votes
1answer
5k views
Bittrex websockets: How to get the order history?
Using the Bittrex websockets API I am able to get the summary updates for all markets and also the exchange updates for specific markets.
However, I am not able to receive the order history (as ...
0
votes
1answer
520 views
Python source code for issuing a new altcoin?
I was wondering if anyone here know a python source code for making an altcoin? I found some tutorial on C++, but since I am not familiar with the language I cannot understand the code fully?
And if ...
1
vote
2answers
1k views
Convert plaintext script into hex-encoded script in python
I'm creating a program (for an altcoin I'm developing) that should make it easy to create OP_RETURN transactions. Currently I'm having some trouble with actually creating the script pythonically (I ...
2
votes
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
0answers
203 views
What is the Best Way to Learn python-bitcoinlib?
I have tried to find tutorials everywhere, but can't find anything. Is there any step by step guide to use the library?
1
vote
0answers
335 views
Running trezorctl / python-trezor on macOS Sierra
As I am not familiar with python I am currently having trouble getting trezorctl running. After installing pip and running pip install trezor from my admin account I get the following error message ...
1
vote
1answer
5k views
binascii.Error: Odd-length string for Python Implementation of Bitcoin
https://gist.github.com/vivosmith/f0e692d9aedbc39ec8d3eb4651bc107c
I was trying to implement this video in Python 3
But the issue is that, it was implemented in Python 2
So I tried to implement ...
5
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 ...
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 ...
1
vote
1answer
589 views
merkle root 2 codes
While trying to calculate the merkle root in python from the data i got from the mining pool.... i found there are 2 different codes.
code 1:
def build_merkle_root(coinbase_hash_bin, merkle_branch):...
4
votes
2answers
2k 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 + ...
2
votes
4answers
2k views
How to read each bitcoin block by python
I need to read all Bitcoin transactions from the first one until now and extract all Bitcoin addresses for further analyses
Any idea how to do it in Python?
2
votes
1answer
734 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 ...
2
votes
2answers
9k 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 ...
0
votes
1answer
479 views
How to generate Electrum address with pybitcointools
I want to create a payment service where I want to be able to charge each client according to its invoice. I picked Electrum as my underlying wallet and pybitcontools as my Python interface.
I would ...
1
vote
1answer
423 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 = '...
0
votes
1answer
848 views
Pybitcointools python 3.5 support
I am trying to run Vitalik Buterin's python bitcoin wrapper.
I installed it from PyPi (pip install pybitcointools ).
When I try to run:
import bitcoin
I get the following error:
ImportError ...
2
votes
1answer
3k 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 ...
1
vote
1answer
490 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 ...
3
votes
1answer
982 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 ...
0
votes
1answer
178 views
How can I work out why a transaction isn't being included in any blocks? [duplicate]
I've crafted a testnet p2sh address using python-bitcoinlib.
The script contents is 2-of-2 multisig: 2, key1, key2, 2, OP_CHECKMULTISIG
Redeem script:
...