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
876 views

Sample programs written using python-bitcoinlib?

Where can I get source codes of programs written using the python-bitcoinlib?
1
vote
1answer
560 views

How do I print unspent transaction outputs of an address using pybitcointools

I am a beginner looking to write a simple program that takes an input (address) and prints the unspent amount in it. I copied some code from chapter 4 of Mastering Bitcoin to generate a random ...
1
vote
2answers
1k views

Running pybitcointools & python-bitcoinlib concurrently

This is somewhat Python-based, but I feel it is more a Bitcoin question than a Python question. The problem is running pybitcointools and python-bitcoinlib concurrently, as both packages use the name ...
1
vote
1answer
53 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
0answers
116 views

How to sign bitcoin raw transactions with Python offline

I have a raw bitcoin transaction created using createrawtransaction unsigned_tx = "...
1
vote
1answer
273 views

Bitcoin RPC connection

I am trying to insert bitcoin transactions into MongoDB using python3. Below is my code : import pymongo import sys import json import time from bitcoinrpc.authproxy import AuthServiceProxy, ...
1
vote
0answers
23 views

Why does this return an ssl error when using pybitcointools?

Really confused as to why this error persists. I have upgraded pip ( I believe) And have installed pybitcointools...
1
vote
1answer
80 views

Is it possible to deploy a python script on Ethereum Virtual Network or NEO? [closed]

Is it possible to deploy a python script as a dApp on the Ethereum or NEO virtual network?
1
vote
0answers
110 views

getblockchaininfo timeout using API only

Thanks in advance. If I call getblockchaininfo through bitcoin-cli it just works. It might take a while but it works all the time. If I call it from within a Python Script from bitcoin.rpc import ...
1
vote
1answer
267 views

How to recover wallet by importing private key on testnet?

I want to test the functionality of wallet recovery via private key import on the testnet. Preferably thru an online service. I only want to test the functionality so that I can verify that it's ...
1
vote
1answer
112 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
0answers
373 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', #...
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 ...
1
vote
2answers
818 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 ...
1
vote
0answers
193 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
222 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
483 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):...
1
vote
1answer
144 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
0answers
744 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
0answers
146 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 ...
1
vote
0answers
410 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: ...
1
vote
1answer
920 views

How to verify ECDSA of a sample litecoin tx using pycoin?

I'm using the litecoin testnet network for testing. I have a UTXO at 053baee857adfdc16959e9dbc9618e0e935f0a1e51e226e651fcd67242f1f462 with a vout of 0. I make a raw transaction sending the coins to ...
1
vote
0answers
429 views

How to get bitcoin address from the pubkey_hash using bitcoin-abe or something else?

I'm using: https://github.com/bitcoin-abe/bitcoin-abe to import the blockchain into a mysql DB it is almost done after 5 days. So I started looking at the data and didn't see any addresses. I know the ...
0
votes
1answer
52 views

Why future Bitcoin Core release shouldn't be in python?

Python offers various advantages including simplified rules of coding and ease of readability. It offers OOP, cross platform compatibility and has numerous libraries that have been added over time. It ...
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. ...
0
votes
1answer
111 views

How to send user input data(Bitcoin address) from iPhone to server and then send Bitcoin back to user's Bitcoin address?

Background I just got started yesterday learning Python and I'm currently building my first iPhone game. What I'm trying to do is create a Bitcoin Pot Jar inside an iPhone app like Sarutobi:https://...
0
votes
1answer
34 views

Checking external bitcoin address balances via JSON-RPC API

I'm using bitcoin core json-rpc api in python and am wondering why... getreceivedbyaddress() ...doesn't allow me to specify an address that isn't in my local wallet? The whole blockchain is open, ...
0
votes
1answer
27 views

These testnet outputs are not making sense to me

Today I took some time to mess around with the bit Python library, which I find pretty easy to use. I have been wanting to do some Bitcoin programming for a while, so I decided to create a simple web ...
0
votes
1answer
45 views

getrawtransaction not working for 0th BTC block transaction

I am trying to insert BTC blocks and transactions in MONGODB collection from count 0 using Python3. getrawtransaction is giving output for block 1 but not for block 0. Can somebody help me why this ...
0
votes
1answer
447 views

bitcoin rpc api createrawtransaction with python returns -3: Expected type array, got object

experimenting with JSON RPC API using bitcoinrpc.authproxy for python. so far it works in all instances accept when i try to create a raw transaction. somewhere along the way im passing parameters in ...
0
votes
1answer
398 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 ...
0
votes
1answer
354 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 ...
0
votes
1answer
38 views

Source and (mis)handling of the private key for a basic tx

I'm looking to get "hands on" with signing, however when I adapt Runeks' thorough answer at https://bitcoin.stackexchange.com/a/5241/89798 my code invariably fails reporting that I've used the wrong ...
0
votes
1answer
19 views

How to convert a python example with getinfo to a usable function?

From Antonopoulos' book I try to use the example 3-3 on page 49 which uses a python skript called rpc_example.py to show the usage of the JSON-RPC API: from bitcoin.rpc import RawProxy p = ...
0
votes
1answer
20 views

Alternative to Python pip bitcoin

This Python pip package https://pypi.org/project/bitcoin/ was originally developed by Vitalik Buterin (that Ethereum guy) but is no longer maintained. Is there any alternative equivalent pip package ...
0
votes
1answer
55 views

Is there a Python or SageMath implementation for solving the ECDL problem for small secret multiplier?

I am looking for a Python script or SageMath code implementation for testing the Baby Step - Giant Stepand Pollard Rhoalgorithms on the secp256k1 curve. I have read that these algorithms are well ...
0
votes
1answer
72 views

Struggling to successfully broadcast a p2pkh transaction

I've been experimenting with sending bitcoin transactions with python for the past week. I successfully was able to send p2wpkh->ALL address types, p2sh-p2wpkh->ALL address types. What I am ...
0
votes
1answer
72 views

What could this Python Assertion error mean?

When I run the code below, sending a BTC transaction to the blockchain (using blockcypher api) I get an Assertion Error. I am not sure what an Assertion error means. The code: Btw the address had ...
0
votes
1answer
92 views

bitcoinrpc.authproxy.JSONRPCException: -26: 16: bad-txns-in-belowout

I am getting this exception, when I am using sendrawtransaction. And all I want to do is translate this docs to Python code, and I have searched for a while but both Can anyone shed any light on this ...
0
votes
1answer
240 views

python bitcoin public key to address code error

import hashlib b58chars = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' def hex_open_key_to_hex_hesh160(hex_open_key): h160 = hashlib.new('ripemd160') h160.update(hashlib.sha256(('04'+...
0
votes
1answer
1k 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() # ...
0
votes
1answer
336 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 ...
0
votes
1answer
318 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 ...
0
votes
1answer
302 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 ...
0
votes
1answer
466 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 ...
0
votes
1answer
3k 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 ...
0
votes
1answer
316 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
0
votes
1answer
341 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'...
0
votes
1answer
171 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. ...
0
votes
2answers
371 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 -...