People who code: we want your input. Take the Survey

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
1k 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
465 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
79 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
3answers
130 views

Is there a simple python script for xpub generation from private key

I need a python script to verify, in an air gapped system, that my 24-word (or 12-word) mnemonic seed indeed generates the xpub that my wallet is showing me. Is there a simple script that does that, ...
0
votes
1answer
103 views

Is there such a service as an unlimited Bitcoin wallet with an API?

Well, I did tons of research and currently I'm using bitcoinlib for python to have a wallet which should be able to hold over one million addresses and occassionally broadcast transactions. It has ...
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
115 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
2answers
77 views

library for validating bitcoin private and public keys

I am building a python script that gets a string and determines if it is a valid bitcoin private key or public key, and if so it returns its type/format (base58, BIP32, HexaDecimal etc.) and its ...
0
votes
1answer
75 views

How can bitinfocharts.com know the changes in BTC deposited to Binance?

I find this page here, which tells me how much BTC is deposited to Binance. How does this (or a similar) page work? When I deposit BTC to Binance, I am given an address, which I am fairly sure it's ...
0
votes
1answer
984 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
43 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
70 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
856 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
302 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
3k 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
660 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
194 views

How convert Bitcoin Privat Key Compression to public address?

This script gets the public address from the uncompressed private key. import ecdsa import hashlib import base58 private_key = input("privatekey: ") # ...
0
votes
1answer
27 views

Does python-bitcoinlib and the Bitcoin Core functional test framework share code? Were changes ever pushed down/upstream?

Does python-bitcoinlib and the Bitcoin Core functional test framework share code? Were changes ever pushed down/upstream?
0
votes
1answer
47 views

Calculate BitcoinGold Block Header Hash [closed]

I am trying to calculate block hash # 632295 { 'version': 536870912, 'prev_block_hash': '000000017590609fd72cadc5fd05732cfa1760bd882213afbb7b788c42e115c8', 'merkle_root': '...
0
votes
1answer
68 views

I need a few lines of python to make WIF addresses

I have code which generates WIF keys from hex keys. It just need a few more lines to generate WIF addresses. ------------------------ import binascii, hashlib, base58, sys def convert(z): ...
0
votes
1answer
37 views

Why downloaded Block Size doesn't match with actual block size mentioned on network?

I am trying to download a block(Height:474044) using an API from here in python. Block is obviously downloaded in JSON format. But when I store it in a file on my system it shows very weird size ...
0
votes
1answer
53 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
255 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
83 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
641 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
2answers
238 views

How to get the block hash in the chainstate leveldb?

From this link What are the keys used in the blockchain levelDB (ie what are the key:value pairs)?, to get the block hash I use the obfuscation key and xor it with the result I get from the db. So I ...
0
votes
1answer
293 views

How do I use an issued API key in my python 3 script to bypass the request limiter?

I got an API key from blockchain.info to bypass the request limiter, but I don't know how to use it and I can't find any relevant info online. url = "https://blockchain.info/rawblock/" + str(s) ...
0
votes
2answers
175 views

What are the web3py equivalent for communicating with bitcoin in Python?

I am fairly new to working with Python, I have a requirement where I need to perform some basic bitcoin operations on my local system rather than relying on some external API's, those function mainly ...
0
votes
1answer
283 views

Python - Querying bitcoin's block header using leveldb

I am facing a stupid problem. I am trying to read bitcoin/blocks/index leveldb using plyvel. I've set up a regtest and i know there is a block with the hash : ...
0
votes
1answer
189 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
138 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
320 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
394 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
429 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
421 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
541 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
354 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
427 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
192 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
428 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 -...
0
votes
1answer
1k views

converting RUBY script into PYTHON ( Recovering private key when someone uses the same k twice )

require 'ecdsa' public_key_hex = '02a50eb66887d03fe186b608f477d99bc7631c56e64bb3af7dc97e71b917c5b364' msghash1_hex = '01b125d18422cdfa7b153f5bcf5b01927cf59791d1d9810009c70cd37b14f4e6' msghash2_hex = '...
0
votes
2answers
2k views

How to use bitcoin-python

I'm trying to create a bitcoin address with the bitcoin-python library. I tried this code: import bitcoinrpc bitcoinrpc.connect_to_local().getnewaddress() But I got this error: error: [Errno 10061]...
0
votes
1answer
541 views

Ubuntu 14 LTS with SX tools installation issues

I'm trying to install the SX (http://SX.dyne.org) tools using Ubuntu 14 LTS following the installation instructions (http://sx.dyne.org/introduction.html#installation). I use wget to download the SH ...
0
votes
0answers
18 views

Coin selection algorithm using Python and Bitcoin Core JSON-RPC

I am looking for the easiest way to implement this using Python: Save all the amount of UTXOs in an array(not sure if tuple or list or set or dictionary) User wants to send 0.1 BTC, won't pay more ...
0
votes
0answers
19 views

Generating Derivation keys from root XPRV in Python

Here's what I'm currently doing in JavaScript, I was wondering if there's anyone who knows how to recreate this functionality in Python. all I need to do is: take a base58 xprv (rootKey) -> derive ...
0
votes
0answers
17 views

How to modify for Hex to base58check converter via python

I am far from programming, I found this convenient script, it just has an input - a text file with a HEX list in a column and the output of the result - a text file with a WIF list in a stack. I would ...
0
votes
0answers
14 views

How can I programmatically check if a 12 word mnemonic is valid? [duplicate]

I would like to use python to check if a 12 word mnemonic is valid. How can this be done?
0
votes
0answers
75 views

What's up with the block size of block# 295182?

I found an anomaly in the block size data: block 295182. This one seems to have a way higher payload. What happened there? Or is this there something wrong with my parsing? This file block does ...
0
votes
0answers
60 views

bitcoin core wallet and python bitcoin-lib

I have a regtest bitcoin environment with nodes and wallets. I'm running bitcoind and bitcoin-cli, version v0.21.0.0. So in my node i created my wallet with a bitcoin-cli -regtest createwallet node1 &...
0
votes
0answers
71 views

Generate BTC Compressed Address

The below code generate uncompressed address with and the Private key for this uncompressed address. How to generate compressed address with it's private key ? I know there is packages like bitcoin ...