Questions tagged [python]
Python is an interpreted, general-purpose high-level programming language whose design philosophy emphasizes code readability.
367
questions
0
votes
4
answers
6k
views
What is the fastest way to check balance of multiple BTC address in python
I want to check multiple bitcoin addresses balance in python, can someone suggest a script that can do it fast and without getting api error.
0
votes
3
answers
3k
views
How to get correct address from BTC mnemonic phrase in Python
Faced a problem, I have a crypto wallet written in Python, there is a code that creates a wallet address from a mnemonic phrase (In this case, BTC address). But if I enter this mnemonic phrase into ...
0
votes
3
answers
2k
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
1
answer
346
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
1
answer
2k
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
1
answer
123
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
1
answer
289
views
How to "Autoforward" incoming BTC using Electrum
We would like to generate multiple addresses in Electrum, receive BTC to these addresses on a daily basis and auto-forward them to another address automatically.
So the flow would be this:
BTC Sent ...
0
votes
1
answer
54
views
Getting wrong version number of block from block index of Bitcoin Core
I am reading block index using plyvel python package.
Following is the location of block indexes:
export BLOCK_INDEX_DB=$BITCOIN_HOME/blocks/index
Following is the method to decode b128 varint:
def ...
0
votes
1
answer
164
views
How to spend an anyone-can-spend input
I'm trying to teach myself bitcoin script, and so far I'm failing with a seemingly trivial example.
I'm using the Bitcoin Test Framework, and this is what I'm doing (simplified):
# p2sh address for ...
0
votes
3
answers
1k
views
How to convert a single number into Private key in python
https://brainwalletx.github.io/#converter,
5HpHagT65TZzG1PH3CSu63k8DbpvD8s5ip4nEB3kEsreAnchuDf
This private key is generated from 1
If i do this other way on this same site, It gives me different ...
0
votes
1
answer
191
views
Python code error : Hash greater than Target
While trying to run a reference code from GitHUb i am getting an error "Cannot Mine-Hash is greater than Target". As i am just a beginner with coding i am not able to figure this out. Kindly ...
0
votes
2
answers
422
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
1
answer
137
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
1
answer
77
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
1
answer
97
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
1
answer
1k
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
1
answer
555
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
1
answer
6k
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
1
answer
804
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
1
answer
439
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
1
answer
691
views
How to getreceivedbyaddress() with the python-bitcoinlib?
I'm trying to use the python-bitcoinlib in my bitcoin project. I now understand how I can send a payment, but I can't find anything similar to the getreceivedbyaddress() command I normally used.
Isn'...
0
votes
1
answer
147
views
How to convert the results of point doubling (Rx1 and Ry1) to point addition (Rx2 and Ry2) without knowledge of (Qx, Qy) in secp256k1 elliptic curve [closed]
I'm working with the secp256k1 elliptic curve and have point doubling and point addition formulas for this curve. Given the following formulas:
Point Addition Formula in Python3:
s = (Qy - Gy) * pow(...
0
votes
1
answer
42
views
Recreate Java code in python
I have a java code that I need to pass to python but I don't know which libraries to use and how to start and if you can help me I would really appreciate it
MNEMONIC = "twenty four mnemonic ...
0
votes
1
answer
74
views
What is the correct way of formatting pubkey_script in coinbase generation transaction?
This may be a simple question for others but I'm struggling trying to understand pubkey_script in the generation transaction.
In this Python code I'm trying to create a pubkey_script:
from base58 ...
0
votes
1
answer
614
views
Get bitcoin unconfirmed transactions real time
i'm new to bitcoin and was wondering, does anyone know how to get unconfirmed transactions with python? I've tried running my own node but my current hardware won't allow it. Is there a way to query ...
0
votes
3
answers
883
views
Lost 3 words out of 12, and not sure of order, mnemonic seed
I lost 3 words out 12 and not sure of the order of the rest besides the first 3, and the last one. I wrote a Python script with mnemonic and the crypto.com wallet library, it works, to my knowledge ...
0
votes
1
answer
1k
views
How to calculate R, S, and Z from raw bitcoin transaction with witness?
How can I calculate the R, S, and Z values from a raw bitcoin transaction? I can extract them with rscan.py, but that doesn't work for new transactions.
0
votes
2
answers
722
views
is there a way how to explore bitcoin blockchain
if I want to explore bitcoin blockchain for instance get address' information, transactions, and so on. what is the right place where I can grab this info. I tried https://blockchain.info but they ...
0
votes
1
answer
142
views
How many python bitcoin wallets are there? [closed]
Is there a list of legit Python Bitcoin wallets or even other cryptocurrencies?
I did a Google search and got no clear results.
0
votes
1
answer
2k
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
1
answer
75
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
2
answers
3k
views
How to generate Hash160 from a private key with the Bitcoin module
I want to fix the script code. The script generates from a random private key Bitcoin Address by function (pubtoaddr) and works
on the Bitcoin module:
https://github.com/primal100/pybitcointools/blob/...
0
votes
1
answer
5k
views
Help needed with PyWallet and wallet dump using MacOS
Could anyone please give me some guidance on how to perform a wallet dump using PyWallet on a MacBook (macOS 10.12 Sierra)? I’m not very savvy with this stuff at all. Have an old wallet.dat file from ...
0
votes
1
answer
78
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
1
answer
395
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
1
answer
76
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
1
answer
2k
views
How to get uncompressed BTC address and private key from bit module for Python?
I am new in programming and BTC. I want to make some BTC address with private keys. Till now I learn that we have compressed and uncompressed private keys. But I get only compressed private keys and ...
0
votes
1
answer
74
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
1
answer
568
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
2
answers
438
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
1
answer
90
views
Retrieve number of OP-RETURN transaction
Is there a possible way to extract the bitcoin transaction protocoll with Python and extract specifically OP RETURN transaction?
I want to plot the number of those over the course of time to derive ...
0
votes
1
answer
382
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
2
answers
621
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
1
answer
320
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
1
answer
220
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
1
answer
438
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
1
answer
675
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
1
answer
504
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
1
answer
574
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
1
answer
370
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