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
0
votes
1answer
307 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": "...
1
vote
0answers
12 views

P2SH address as a product of public keys

Assuming the multisig 2 of 3, if I do have extended public keys (xpub) for all 3 cosigners (with proper derivations), can I somewhat get the result address (P2SH)? How to calculate the "script&...
0
votes
0answers
23 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
1answer
101 views

Trying to create a bitcoin based webapp in python which takes BTC deposits. How would I use pybitcointools to implement this?

Trying to create a bitcoin based webapp in python which takes BTC deposits (New to Bitcoin in general, but want to get involved). Although I would preferably want to use a different address for each ...
1
vote
1answer
59 views

Python: Why the addresses and keys generated by pywallet and bip32utils using the same 12 mnemonic words don't match?

I tried to generate wallets by using pywallet and bip32utils (Python). But I noted that the addresses/keys of the 2 wallets, namely wallet_pywallet and wallet_bip39 don't match with each other. I ...
0
votes
0answers
26 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 ...
0
votes
1answer
482 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 ...
0
votes
0answers
33 views

How Create Bitcoin wallet from a private key works?

I'm trying to understand how i can create a pair of bitcoin private key and public key with : https://github.com/Destiner/blocksmith for example : import blocksmith kg = blocksmith.KeyGenerator() ...
1
vote
1answer
616 views

Decoding hex scriptsig in Python

Running decodescript on d1a076722d11ddfd0fadb96d6d960b8b2ad6c6369570cd00df70a801a6be9e44 is returning: { "asm": "0 ...
1
vote
0answers
22 views

bitcoin-etl: problems with installing

I am trying to install bitcoin-etl: https://github.com/blockchain-etl/bitcoin-etl to analyze bitcoin blockchain. I have Mac OS and python3, I run this in terminal: pip install bitcoin-etl Also tried ...
1
vote
2answers
509 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 ...
0
votes
1answer
29 views

How can I pull the “Candles” argument from the Huobi websocket data?

I've a problem with Huobi Websocket, I know my ways in REST API but new to asyncio and websockets, and Huobi only gives resonable amount of history through websocket request so I'm stuck with it. I'm ...
3
votes
1answer
22 views

How to verify a lnurl-auth callback with python

I want to create a Python implementation of an lnurl-auth server. I started a quick HTTP server to be the callback url, and captured the signed callback sent by BLW on Android. ?tag=login &k1=...
0
votes
1answer
4k 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
1answer
116 views

How can I generate SegWit addresses from a mnemonic using python?

So, I have written a script that generates BIP39 mnemonics. I now want to generate N native SegWit public keys from this mnemonic. I have found this, but it generates legacy addresses. It uses the ...
0
votes
1answer
154 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: ") # ...
2
votes
1answer
858 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) ...
0
votes
1answer
65 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
1answer
50 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
0answers
32 views

Process for finding nonce

Assume we have a transaction in hex (tx_hex) and we want to find a nonce such that SHA-256(SHA-256(nonce|| tx_hex)) = new_transaction_id ('||' denotes concatenation) first bits consist of 32 zeros. ...
8
votes
4answers
5k views

How can I test if a bitcoin address is compressed or not?

I have two bitcoin addresses: 1D8VSXHFAWNhAbruwUMbNp4hsXAnRNkYvX 12T15tvMGaymMX97X9KxVzyLF323r8v6Hg One is compressed, one is not. How can I test which is which? (Preferably using python 2.7) ...
0
votes
1answer
91 views

What is the program in Python that print information about the current block?

What is the program in Python that print information about the current block the world try to mine (I mean Version, Previous Block, Merkle Root, Time, Bits) plus how many zeros we are looking for for ...
0
votes
1answer
461 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
2answers
159 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 ...
1
vote
0answers
36 views

How do I fix socket.timeout error when getting data from blockchain.info? [closed]

I'm writing a python script using the blockchain API that takes as input a list of seed addresses, gets their transactions and the input/output addresses of each transaction. Then I get the ...
0
votes
1answer
43 views

How do I convert a private key in hex to a Segwit private key expected by Electrum?

I've been following this code to generate SegWit addresses with python. However, I'm confused because this script doesn't output the private key in a usable way for Electrum. I found this site which ...
30
votes
2answers
8k views

How is the whitepaper decoded from the blockchain (Tx with ~1000x m of n multisig outputs)

The whitepaper is apparently encoded at 54e48e5f5c656b26c3bca14a8c95aa583d07ebe84dde3b7dd4a78f4e4186e713, which is an m of n multisig Tx with 947 outputs (just under the scriptsig limit of 20kB!). ...
0
votes
1answer
188 views

broadcasting error for raw bitcoin transaction testnet

I am trying to create a raw transaction and send it to the testnet. I am using testnet keys and here is the simplified readable output from my script: decoded private key: ...
3
votes
1answer
239 views

Python library for Multisignature HD wallets

Is there is any python library is available that allow creation of Multisignature HD wallets ?
0
votes
1answer
84 views

SPV client TCP connection in python

I am trying to implement an SPV client in python (for my own learning). I want to start by making a simple TCP connection to a full node, but I either cannot get a response to my version message, or ...
2
votes
1answer
549 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, ...
0
votes
1answer
400 views

Question about Python library coincurve/libsecp256k

I am a noob with cryptography, just trying to learn using python and the library Coincurve ( https://github.com/ofek/coincurve ) which is a mature Python binding for libsecp256k1. The following code ...
0
votes
1answer
67 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
25 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?
2
votes
1answer
674 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 ...
2
votes
1answer
515 views

Mining algorithm in vb.net

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 ...
0
votes
1answer
122 views

How do I get the value of a btc address transaction with pybitcoin tools?

Lets say that I execute the code below when the user accesses the deposit page. my_private_key = random_key() my_public_key = privtopub(my_private_key) my_address = pubtoaddr(my_public_key) And I ...
0
votes
0answers
32 views

How to generate bitcoin address with gpu in python [duplicate]

I have seen a lot of bitcoin address generator with python, but all of them run on cpu, and are very slow,, for fun and educational purposes, I have been trying to use gpu to run the python script to ...
3
votes
1answer
2k views

How do I convert Public Key x value to y in Python and verify?

I have been using the BTC Address utility which enables me to type in something like: 020F031CA83F3FB372BD6C2430119E0B947CF059D19CDEA98F4CEFFEF620C584F9 Then clicking a button the program can spit ...
1
vote
1answer
51 views

Test vector 1 BIP32 in Python

i tried to replicate code in this git https://github.com/tongokongo/bitcoin-basics/blob/master/HD_wallet/bip32.py . I'm not familiar with python but the xpub is correct (this is the Test Vector 1 from ...
0
votes
1answer
271 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) ...
2
votes
2answers
356 views

Download blocks in blk00000.dat format from a specific period

For study purposes, I would like to download blocks from a specific period, i.e. January 2017 - June 2017, in blk.dat format (blk00000.dat, blk*.dat). I downloaded blockchain.core but it makes me ...
0
votes
0answers
23 views

python-bitcoinlib: Synchronise block headers

I am trying to run a simple python script to synchronise the Bitcoin block headers for an SPV client, using the python-bitcoinlib. This is the code that I am running, after doing the handshake: msg = ...
4
votes
1answer
512 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 ...
5
votes
2answers
3k 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
1answer
63 views

XPub to YPub Converter (python) - Last digits wrong

The code below is generating an YPub from XPub with the last 6 digits wrong. How can I verify what's happening and fix this error? e.g.: It should be ...
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 ...
1
vote
2answers
442 views

How to use python rpc bitcoin to get the historical transaction record of a wallet address

How to use python rpc bitcoin to get the historical transaction record of a wallet address?My computer has synchronized all btc blocks, and txindex=1 has been configured. I want to try to get all the ...
1
vote
1answer
62 views

Address generator error with python

I had created a script that creates a bitcoin private key, public key and address, for checking if all works fine I create one and check the private key on https://walletgenerator.net/, and it outputs ...
0
votes
2answers
223 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 ...

1
2 3 4 5