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.
Here is a simple implementation that just works
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()
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 ...
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:
Your logic of xoring obfuscation key with the key seems to be causing an issue. Key and level DB value should be first made the same length. The result block hash should start with zeros. Feel free to copy code from this repo which is in working state
This is a bit late, but I've been struggling with this myself so hopefully I can help out anyone who comes across this thread with a similar question:
Looks like the chainstate obfuscation key begins with an 08, which probably refers to the length of the key. If you remove the 08, you get an obfuscation key of (for the above example) 99b9c2314a85c9b6, which ...
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 ...
To take the information of the bitcoin blockchain, you can use the bitcoin core RPC Framework, for use it, you must have all blockchain on your computer
Download Bitcoin core
aligns the bitcoin node
Configure rpc framework
Use the API to take the information, I prefer using this library with python, this is an example for using it
You can use this ...