Hot answers tagged

3

While I'm not sure of the technical requirements or limitations you have around building you platform. It sounds to me like your best option is simply running your own Bitcoin node itself. There are lots of online examples that could help you get started. I found bitcoin.org's guides particularly useful: https://bitcoin.org/en/developer-examples https://...


2

This might not be a satisfying answer but if you look at the eclair git repo and their Wiki you will find that the eclair API is a JSON API and is exposed via http and web sockets and can be queried with regular http requests. If you look at the c-lightning python client it is a tool that talks via a unixDomainSocket to the exposed lightningd api. So I ...


2

You're looking for walletnotify setting in bitcoin.conf It will call the specified script for every transaction received for your own wallets. walletnotify=/some/path/mywalletscript.py Here mywalletscript.py will handle the JSON data passed into it. Here is a sample walletnotify implementation including database access. It's a bit dated but should give ...


2

I came up with a script to pay to, and spend from, a multisig wallet. Here are the steps I was missing before: madd1 = msig1["address"] a1 = w0_rpc.getaddressinfo(madd1) scriptPubKey1 = a1["scriptPubKey"] pubkey1 = hex_str_to_bytes(scriptPubKey1) tx1.vout.append(CTxOut(int(8 * COIN), pubkey1)) Below is the full script. #!/usr/bin/env python3 import ...


2

P2PK scripts don't actually have addresses, it is really a bug that an address is shown for P2PK outputs that has been fixed for Bitcoin Core 0.19 (to be released soon) and later. Given a public key, you can derive an address from it by hashing the public key first with SHA256, then that hash with RIPEMD160. This result is known as the hash160. The hash160 ...


2

To manually build scriptSig you need to concatenate the length of the signature, the signature, the length of the pubkey and then the pubkey in binary form. For example, let's take a look at a random TX I happen to have open on my console: ./bitcoin-cli getrawtransaction 055f9c6dc094cf21fa224e1eb4a54ee3cc44ae9daa8aa47f98df5c73c48997f9 1 We want the vin: ...


2

These implementations use some form of the Dijkstra algorithm which is implemented in the open source networkx python lib https://networkx.github.io/documentation/stable/reference/algorithms/shortest_paths.html also electrum wallet is working on lightning. I think they followed pretty much the lnd code base so one could check their pathfing implementation at ...


2

Bitcoin Core does not track each individual address, only the addresses associated with your wallet. There are other clients, such as bitcore-insight and btcd, which maintain a separate address index. Alternatively, you can implement an index yourself, or run an existing one such as ElectrumX.


2

This is expected. You don't appear to be accounting for fees. If you account for them, you get: +0.0005 386d83da01218ca74cbe72b19a6814293b98357921042a9b03ab39706fef8736 +0.0001 8e95c68f524e557a9b42d11207effae89c4e61913c5c4758adb142a6cdd03848 -0.00001 with -0.00034408 as Fees 91224995f2c240159141a499b91db8d26f0a6425fb12f5277d2f735576596aa7 -0.00001 with -0....


2

Based on the address the binance gave you, after they sweep the funds into their hotwallet, you can run common-input heuristic on this deposit address (assuming it was swept in with other inputs). The more addresses and sweeps, the better the accuracy and amount of addresses in the final (result) set. https://en.bitcoin.it/wiki/Privacy#Common-input-...


1

I think this video will explain it in details (python): https://youtu.be/tX-XokHf_nI Using the code from video, pip packages ecdsa , hashlib and base58: import ecdsa import hashlib import base58 # WIF to private key by https://en.bitcoin.it/wiki/Wallet_import_format Private_key = base58.b58decode_check("5JYJWrRd7sbqEzL9KR9dYTGrxyLqZEhPtnCtcvhC5t8ZvWgS9iC")...


1

It is resolved. block_array: List = list() block_array.append(struct.pack('<L', block['version'])) block_array.append(bytes.fromhex(block['prev_block_hash'])[::-1]) block_array.append(bytes.fromhex(block['merkle_root'])[::-1]) block_array.append(struct.pack("<L", block['height'])) # 632295 block_array.append(bytes.fromhex(block['reserved'])) # 0 ...


1

You are deserializing every value as an integer but that is incorrect. The values are serialized as variable length integers with high bits signalling the length of the integer which are dropped for the actual integer value itself. So you need to fix your code to deserialize the bytes as varints instead of just integers with fixed lengths. The following ...


1

I used SSH. Had to do something special with heroku to get it to work though https://stackoverflow.com/questions/21575582/ssh-tunneling-from-heroku/27361295#27361295


1

As chytrik said, a better way of generating new addresses on a remote server would be to export an extended public key (xpub) from your wallet and put only the xpub online. Then your private key material would remain offline, and you could generate new child addresses from the xpub using BIP32. If you still want to execute getnewaddress on your node, you ...


1

For one, there is no JSON block format - different APIs have different ways of interpreting and displaying a block in a JSON response, and none of them will ever match the block size. Your mistake appears to be saving the actual hex block as text. 1996396 = 2 * 998198 You must write the data as an actual binary file. i.e., write 12 as the byte 0x12, ...


1

There are at least two I'm aware of: Python-bitcoinlib and bitcoin_tools


1

Here is a simple implementation that just works import requests class EclairClient(): def __init__(self,host, port, password, service_name=None, session=None): self._host = host self._port = port self._password = password self._session = session if session is None: self._session = requests.Session() ...


1

The issue is public key compression, as noted in your edit. The original code does not handle compressed public keys. Try adding k.set_compressed(True) before #here we retrieve the public key data generated from the supplied private key ...


1

Your code works well, but you have an error when you go to call the function getBlock(), with the bitcoin core reference the getBlock() function have a parameter and this parameter is the hash of the block. So, your code works because of the RPC framework response with an error bitcoin.rpc.JSONRPCError: {'code': -1, 'message': 'getblock "blockhash" ( ...


1

Try this library by Peter Todd https://github.com/petertodd/python-bitcoinlib Or pycoin https://github.com/richardkiss/pycoin


1

In Sage. Let's first define a finite field of size 2^32 (over which exhaustively searching would be painful but doable, but Pollard-Rho should be pretty fast). sage F = GF(2^32 - 5) And a prime-ordered elliptic curve over it (y^2 = x^3 + x + 13 happens to be prime) sage: E = EllipticCurve(F, [1, 13]) Let's call the order of the curve n: sage: n = E....


Only top voted, non community-wiki answers of a minimum length are eligible